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);
|
||||
|
||||
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;
|
||||
});
|
||||
m_sensors = enumerateSensors();
|
||||
m_monitors = enumerateMonitors();
|
||||
|
||||
setupMonitorsTab();
|
||||
|
||||
setupTrayIcon();
|
||||
|
||||
setupCallbackTimer();
|
||||
|
||||
m_sensors = enumerateSensors();
|
||||
m_monitors = enumerateMonitors();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -90,6 +85,16 @@ void MainWindow::loadIcons()
|
||||
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()
|
||||
{
|
||||
loadIcons();
|
||||
|
@ -29,6 +29,8 @@ class MainWindow : public QMainWindow {
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
void loadIcons();
|
||||
|
||||
void setupMonitorsTab();
|
||||
void setupTrayIcon();
|
||||
void setupCallbackTimer();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user