Compare commits

...

2 Commits

Author SHA1 Message Date
7ea9638488 Update overall brightness slider if all monitors match 2020-07-17 17:36:00 +02:00
ddec3d2431 Collapse else-if 2020-07-17 17:31:56 +02:00

View File

@ -331,6 +331,7 @@ bool MainWindow::setMonitorBrightness(float brightness)
}
bool errorOccurred = false;
bool allMonitorsSameBrightness = true;
for(size_t i = 0; i < m_monitors.size(); ++i) {
if(!std::isnan(brightness) && !m_monitors[i].manualOverride) {
@ -339,16 +340,22 @@ bool MainWindow::setMonitorBrightness(float brightness)
m_monitors[i].brightness = std::clamp(m_monitors[i].brightness, m_monitors[i].minBrightness, m_monitors[i].maxBrightness);
if(i > 0 && m_monitors[i - 1].brightness != m_monitors[i].brightness) {
allMonitorsSameBrightness = false;
}
if(!m_monitors[i].driver.setBrightness(m_monitors[i].brightness)) {
errorOccurred = true;
}
else {
if(m_ui.monitorDropdown->currentIndex() == i) {
updateCurrentMonitorGUI(i);
}
else if(m_ui.monitorDropdown->currentIndex() == i) {
updateCurrentMonitorGUI(i);
}
}
if(allMonitorsSameBrightness) {
m_ui.monitorOverallBrightnessSlider->setValue(utils::map(m_monitors.front().brightness, 0.f, 1.f, 0, 100));
}
return !errorOccurred;
}