From 7b791a071b9b34dc63078ebe7a87a5a5a68dfc57 Mon Sep 17 00:00:00 2001 From: BlackMark Date: Sun, 12 Jul 2020 19:14:15 +0200 Subject: [PATCH] Implement manual override checkboxes --- AdaptiveBrightness/main_window.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/AdaptiveBrightness/main_window.cpp b/AdaptiveBrightness/main_window.cpp index 30c4521..8277944 100644 --- a/AdaptiveBrightness/main_window.cpp +++ b/AdaptiveBrightness/main_window.cpp @@ -87,6 +87,17 @@ void MainWindow::loadIcons() void MainWindow::setupMonitorsTab() { + m_ui.monitorBrightnessSlider->setDisabled(true); + m_ui.monitorOverallBrightnessSlider->setDisabled(true); + + m_ui.monitorOverrideCheck->setChecked(false); + connect(m_ui.monitorOverrideCheck, &QCheckBox::stateChanged, + [this](int state) { m_ui.monitorBrightnessSlider->setEnabled(state == Qt::CheckState::Checked); }); + + m_ui.monitorOverallOverrideCheck->setChecked(false); + connect(m_ui.monitorOverallOverrideCheck, &QCheckBox::stateChanged, + [this](int state) { m_ui.monitorOverallBrightnessSlider->setEnabled(state == Qt::CheckState::Checked); }); + connect(m_ui.monitorBrightnessSlider, &QSlider::valueChanged, [this](int value) { const auto mappedBrightness = utils::map(value, 0, 100, 0.f, 1.f); const auto newBrightness = std::clamp(mappedBrightness, 0.f, 1.f);