From 5253dc1df66b6e2094e4d51b2dcc1fea908eaf0f Mon Sep 17 00:00:00 2001 From: BlackMark Date: Fri, 17 Jul 2020 18:49:28 +0200 Subject: [PATCH] Implement monitor reset button --- AdaptiveBrightness/main_window.cpp | 8 ++++++++ AdaptiveBrightness/main_window.hpp | 2 ++ 2 files changed, 10 insertions(+) diff --git a/AdaptiveBrightness/main_window.cpp b/AdaptiveBrightness/main_window.cpp index 345e387..2064b71 100644 --- a/AdaptiveBrightness/main_window.cpp +++ b/AdaptiveBrightness/main_window.cpp @@ -117,6 +117,7 @@ void MainWindow::setupMonitorsTab() { connect(m_ui.monitorDropdown, QOverload::of(&QComboBox::currentIndexChanged), this, &MainWindow::updateCurrentMonitorGUI); connect(m_ui.monitorEnumerateButton, &QAbstractButton::clicked, [this](bool) { enumMonitors(); }); + connect(m_ui.monitorResetButton, &QAbstractButton::clicked, [this](bool) { resetAllMonitorSettings(); }); setupLimitsSlider(); setupOverallLimitsSlider(); @@ -266,6 +267,13 @@ void MainWindow::setupCallbackTimer() qDebug(ltr("Callback timer started")); } +void MainWindow::resetAllMonitorSettings() +{ + m_ui.monitorOverallMinBrightnessSlider->setValue(0); + m_ui.monitorOverallMaxBrightnessSlider->setValue(100); + m_ui.monitorOverallOverrideCheck->setCheckState(Qt::CheckState::Unchecked); +} + void MainWindow::updateCurrentMonitorGUI(int index) { if(index == -1) { diff --git a/AdaptiveBrightness/main_window.hpp b/AdaptiveBrightness/main_window.hpp index 7383aed..2a39108 100644 --- a/AdaptiveBrightness/main_window.hpp +++ b/AdaptiveBrightness/main_window.hpp @@ -43,6 +43,8 @@ class MainWindow : public QMainWindow { void setupTrayIcon(); void setupCallbackTimer(); + void resetAllMonitorSettings(); + void updateCurrentMonitorGUI(int index); void updateState();