Implement limits slider
This commit is contained in:
parent
8f4dec0bff
commit
5943b72fef
@ -128,17 +128,53 @@ void MainWindow::setupMonitorsTab()
|
||||
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());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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