Update overall brightness slider if all monitors match
This commit is contained in:
parent
ddec3d2431
commit
7ea9638488
@ -331,6 +331,7 @@ bool MainWindow::setMonitorBrightness(float brightness)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool errorOccurred = false;
|
bool errorOccurred = false;
|
||||||
|
bool allMonitorsSameBrightness = true;
|
||||||
|
|
||||||
for(size_t i = 0; i < m_monitors.size(); ++i) {
|
for(size_t i = 0; i < m_monitors.size(); ++i) {
|
||||||
if(!std::isnan(brightness) && !m_monitors[i].manualOverride) {
|
if(!std::isnan(brightness) && !m_monitors[i].manualOverride) {
|
||||||
@ -339,6 +340,10 @@ bool MainWindow::setMonitorBrightness(float brightness)
|
|||||||
|
|
||||||
m_monitors[i].brightness = std::clamp(m_monitors[i].brightness, m_monitors[i].minBrightness, m_monitors[i].maxBrightness);
|
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)) {
|
if(!m_monitors[i].driver.setBrightness(m_monitors[i].brightness)) {
|
||||||
errorOccurred = true;
|
errorOccurred = true;
|
||||||
}
|
}
|
||||||
@ -347,6 +352,10 @@ bool MainWindow::setMonitorBrightness(float brightness)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(allMonitorsSameBrightness) {
|
||||||
|
m_ui.monitorOverallBrightnessSlider->setValue(utils::map(m_monitors.front().brightness, 0.f, 1.f, 0, 100));
|
||||||
|
}
|
||||||
|
|
||||||
return !errorOccurred;
|
return !errorOccurred;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user