From 200ad19d95b6953a529050e5abf927d1edc1c217 Mon Sep 17 00:00:00 2001 From: BlackMark Date: Sun, 12 Jul 2020 18:13:53 +0200 Subject: [PATCH] Add GUI layout for monitors and sensors --- AdaptiveBrightness/AdaptiveBrightness.ui | 549 +++++++++++++++++++++-- AdaptiveBrightness/main_window.cpp | 8 +- 2 files changed, 519 insertions(+), 38 deletions(-) diff --git a/AdaptiveBrightness/AdaptiveBrightness.ui b/AdaptiveBrightness/AdaptiveBrightness.ui index 5d19ddb..a958462 100644 --- a/AdaptiveBrightness/AdaptiveBrightness.ui +++ b/AdaptiveBrightness/AdaptiveBrightness.ui @@ -6,8 +6,8 @@ 0 0 - 406 - 306 + 450 + 555 @@ -18,47 +18,522 @@ :/AdaptiveBrightness/resources/system.ico:/AdaptiveBrightness/resources/system.ico - + - - - Manual brightness control + + + 0 - - - - - Brightness - - - Qt::Horizontal - - - - + + + Monitors + + + + + + Monitor + + + + + + + 0 + 0 + + + + + + + + Re-enumerate + + + + + + + Limits + + + + + + Qt::Horizontal + + + + + + + Minimum + + + + + + + Qt::Horizontal + + + + + + + Maximum + + + + + + + 0% + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + 100% + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Brightness + + + + + + Qt::Horizontal + + + + + + + Manual override + + + + + + + 50% + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + Overall limits + + + + + + Minimum + + + + + + + Qt::Horizontal + + + + + + + 0% + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Maximum + + + + + + + Qt::Horizontal + + + + + + + 100% + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Qt::Vertical + + + + 218 + 35 + + + + + + + + Restore all monitors to defaults + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Overall brightness + + + + + + Qt::Horizontal + + + + + + + 50% + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Manual override + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Sensors + + + + + + Sensor module + + + + + + Re-enumerate + + + + + + + + 0 + 0 + + + + + + + + Readout + + + + + + + 0 + 0 + + + + QFrame::NoFrame + + + QFrame::Plain + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustToContents + + + 0 + + + + Sensor + + + + + Raw value + + + + + Percentage + + + + + LDR1: Front + + + 50 + + + 50% + + + + + LDR2: Bottom + + + 70 + + + 70% + + + + + LDR3: Top + + + 100 + + + 100% + + + + + + + + + + + Sensor aggregation + + + + + + Function + + + + + + + + 0 + 0 + + + + + + + + Module result: + + + + + + + 50% + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + Restore all sensors to defaults + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Total aggregation + + + + + + Function + + + + + + + + 0 + 0 + + + + + + + + Result: + + + + + + + 50% + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + - - - - 0 - 0 - 406 - 21 - - - - - - TopToolBarArea - - - false - - - diff --git a/AdaptiveBrightness/main_window.cpp b/AdaptiveBrightness/main_window.cpp index 520d70e..f2384d3 100644 --- a/AdaptiveBrightness/main_window.cpp +++ b/AdaptiveBrightness/main_window.cpp @@ -7,6 +7,9 @@ #include #include +#include +#include +#include #include #include @@ -20,7 +23,10 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent) qDebug(ltr("Creating main window")); m_ui.setupUi(this); - m_manualBrightnessSlider = m_ui.centralWidget->findChild("groupBox")->findChild("horizontalSlider"); + + const auto tabs = m_ui.centralWidget->findChild("tabWidget"); + const auto tab = tabs->findChild("tab"); + m_manualBrightnessSlider = tab->findChild("horizontalSlider"); if(m_manualBrightnessSlider) { connect(m_manualBrightnessSlider, &QSlider::valueChanged, [this](int value) {