Refactor monitor tab GUI setup
This commit is contained in:
parent
afd6de62a0
commit
69a68ce67c
@ -24,19 +24,14 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
|
|||||||
|
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
|
|
||||||
connect(m_ui.monitorBrightnessSlider, &QSlider::valueChanged, [this](int value) {
|
m_sensors = enumerateSensors();
|
||||||
const auto mappedBrightness = utils::map(value, 0, 100, 0.f, 1.f);
|
m_monitors = enumerateMonitors();
|
||||||
const auto newBrightness = std::clamp(mappedBrightness, 0.f, 1.f);
|
|
||||||
qDebug(ltr("Overriding brightness with %1").arg(newBrightness));
|
setupMonitorsTab();
|
||||||
m_brightness = newBrightness;
|
|
||||||
});
|
|
||||||
|
|
||||||
setupTrayIcon();
|
setupTrayIcon();
|
||||||
|
|
||||||
setupCallbackTimer();
|
setupCallbackTimer();
|
||||||
|
|
||||||
m_sensors = enumerateSensors();
|
|
||||||
m_monitors = enumerateMonitors();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@ -90,6 +85,16 @@ void MainWindow::loadIcons()
|
|||||||
qDebug(ltr("Icons loaded"));
|
qDebug(ltr("Icons loaded"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::setupMonitorsTab()
|
||||||
|
{
|
||||||
|
connect(m_ui.monitorBrightnessSlider, &QSlider::valueChanged, [this](int value) {
|
||||||
|
const auto mappedBrightness = utils::map(value, 0, 100, 0.f, 1.f);
|
||||||
|
const auto newBrightness = std::clamp(mappedBrightness, 0.f, 1.f);
|
||||||
|
qDebug(ltr("Overriding brightness with %1").arg(newBrightness));
|
||||||
|
m_brightness = newBrightness;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::setupTrayIcon()
|
void MainWindow::setupTrayIcon()
|
||||||
{
|
{
|
||||||
loadIcons();
|
loadIcons();
|
||||||
|
@ -29,6 +29,8 @@ class MainWindow : public QMainWindow {
|
|||||||
void closeEvent(QCloseEvent* event) override;
|
void closeEvent(QCloseEvent* event) override;
|
||||||
|
|
||||||
void loadIcons();
|
void loadIcons();
|
||||||
|
|
||||||
|
void setupMonitorsTab();
|
||||||
void setupTrayIcon();
|
void setupTrayIcon();
|
||||||
void setupCallbackTimer();
|
void setupCallbackTimer();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user