Compare commits
3 Commits
17a4890fdc
...
5943b72fef
Author | SHA1 | Date | |
---|---|---|---|
5943b72fef | |||
8f4dec0bff | |||
78f3daf1ff |
@ -127,6 +127,55 @@ void MainWindow::setupMonitorsTab()
|
||||
qDebug(ltr("Overriding brightness with %1").arg(newBrightness));
|
||||
m_brightness = newBrightness;
|
||||
});
|
||||
|
||||
setupLimitsSlider();
|
||||
setupOverallLimitsSlider();
|
||||
}
|
||||
|
||||
void MainWindow::setupLimitsSlider()
|
||||
{
|
||||
connect(m_ui.monitorMinBrightnessSlider, &QSlider::valueChanged, [this](int value) {
|
||||
m_ui.monitorMinBrightnessValueLabel->setText(tr("%1%").arg(value, 3));
|
||||
if(value > m_ui.monitorMaxBrightnessSlider->value()) {
|
||||
m_ui.monitorMaxBrightnessSlider->setValue(value);
|
||||
}
|
||||
const auto curIdx = m_ui.monitorDropdown->currentIndex();
|
||||
m_monitors[curIdx].minBrightness = utils::map(value, 0, 100, 0.f, 1.f);
|
||||
updateCurrentMonitorGUI(curIdx);
|
||||
});
|
||||
connect(m_ui.monitorMaxBrightnessSlider, &QSlider::valueChanged, [this](int value) {
|
||||
m_ui.monitorMaxBrightnessValueLabel->setText(tr("%1%").arg(value, 3));
|
||||
if(value < m_ui.monitorMinBrightnessSlider->value()) {
|
||||
m_ui.monitorMinBrightnessSlider->setValue(value);
|
||||
}
|
||||
const auto curIdx = m_ui.monitorDropdown->currentIndex();
|
||||
m_monitors[curIdx].maxBrightness = utils::map(value, 0, 100, 0.f, 1.f);
|
||||
updateCurrentMonitorGUI(curIdx);
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::setupOverallLimitsSlider()
|
||||
{
|
||||
connect(m_ui.monitorOverallMinBrightnessSlider, &QSlider::valueChanged, [this](int value) {
|
||||
m_ui.monitorOverallMinBrightnessValueLabel->setText(tr("%1%").arg(value, 3));
|
||||
if(value > m_ui.monitorOverallMaxBrightnessSlider->value()) {
|
||||
m_ui.monitorOverallMaxBrightnessSlider->setValue(value);
|
||||
}
|
||||
for(auto& monitor: m_monitors) {
|
||||
monitor.minBrightness = utils::map(value, 0, 100, 0.f, 1.f);
|
||||
}
|
||||
updateCurrentMonitorGUI(m_ui.monitorDropdown->currentIndex());
|
||||
});
|
||||
connect(m_ui.monitorOverallMaxBrightnessSlider, &QSlider::valueChanged, [this](int value) {
|
||||
m_ui.monitorOverallMaxBrightnessValueLabel->setText(tr("%1%").arg(value, 3));
|
||||
if(value < m_ui.monitorOverallMinBrightnessSlider->value()) {
|
||||
m_ui.monitorOverallMinBrightnessSlider->setValue(value);
|
||||
}
|
||||
for(auto& monitor: m_monitors) {
|
||||
monitor.maxBrightness = utils::map(value, 0, 100, 0.f, 1.f);
|
||||
}
|
||||
updateCurrentMonitorGUI(m_ui.monitorDropdown->currentIndex());
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::setupTrayIcon()
|
||||
@ -187,13 +236,13 @@ void MainWindow::updateCurrentMonitorGUI(int index)
|
||||
const auto maximum = utils::map(m_monitors[index].maxBrightness, 0.f, 1.f, 0, 100);
|
||||
|
||||
m_ui.monitorMinBrightnessSlider->setValue(minimum);
|
||||
m_ui.monitorMinBrightnessValueLabel->setText(QString("%1%").arg(minimum, 3, 10));
|
||||
m_ui.monitorMinBrightnessValueLabel->setText(QString("%1%").arg(minimum, 3));
|
||||
|
||||
m_ui.monitorMaxBrightnessSlider->setValue(maximum);
|
||||
m_ui.monitorMaxBrightnessValueLabel->setText(QString("%1%").arg(maximum, 3, 10));
|
||||
m_ui.monitorMaxBrightnessValueLabel->setText(QString("%1%").arg(maximum, 3));
|
||||
|
||||
m_ui.monitorBrightnessSlider->setValue(brightness);
|
||||
m_ui.monitorBrightnessValueLabel->setText(QString("%1%").arg(brightness, 3, 10));
|
||||
m_ui.monitorBrightnessValueLabel->setText(QString("%1%").arg(brightness, 3));
|
||||
|
||||
m_ui.monitorOverrideCheck->setChecked(m_monitors[index].manualOverride);
|
||||
}
|
||||
|
@ -34,6 +34,9 @@ class MainWindow : public QMainWindow {
|
||||
void loadIcons();
|
||||
|
||||
void setupMonitorsTab();
|
||||
void setupLimitsSlider();
|
||||
void setupOverallLimitsSlider();
|
||||
|
||||
void setupTrayIcon();
|
||||
void setupCallbackTimer();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user