Compare commits
2 Commits
aeca6a5dc0
...
7ea9638488
Author | SHA1 | Date | |
---|---|---|---|
7ea9638488 | |||
ddec3d2431 |
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user