Add manual override slider
This commit is contained in:
parent
46e0e8d0a6
commit
5af9bc133c
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
<width>406</width>
|
||||
<height>306</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -17,13 +17,35 @@
|
||||
<iconset resource="AdaptiveBrightness.qrc">
|
||||
<normaloff>:/AdaptiveBrightness/resources/system.ico</normaloff>:/AdaptiveBrightness/resources/system.ico</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget"/>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<item row="0" column="1">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Manual brightness control</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QSlider" name="horizontalSlider">
|
||||
<property name="toolTip">
|
||||
<string>Brightness</string>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<width>406</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <QGroupBox>
|
||||
#include <QSlider>
|
||||
#include <QtDebug>
|
||||
#include <QtGlobal>
|
||||
|
||||
@ -18,6 +20,16 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
|
||||
qDebug(ltr("Creating main window"));
|
||||
|
||||
m_ui.setupUi(this);
|
||||
auto slider = m_ui.centralWidget->findChild<QGroupBox*>("groupBox")->findChild<QSlider*>("horizontalSlider");
|
||||
|
||||
if(slider) {
|
||||
connect(slider, &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;
|
||||
});
|
||||
}
|
||||
|
||||
loadIcons();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user