Implement manual override checkboxes

This commit is contained in:
BlackMark 2020-07-12 19:14:15 +02:00
parent 69a68ce67c
commit 7b791a071b

View File

@ -87,6 +87,17 @@ void MainWindow::loadIcons()
void MainWindow::setupMonitorsTab() 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) { connect(m_ui.monitorBrightnessSlider, &QSlider::valueChanged, [this](int value) {
const auto mappedBrightness = utils::map(value, 0, 100, 0.f, 1.f); const auto mappedBrightness = utils::map(value, 0, 100, 0.f, 1.f);
const auto newBrightness = std::clamp(mappedBrightness, 0.f, 1.f); const auto newBrightness = std::clamp(mappedBrightness, 0.f, 1.f);