Add manual override slider
This commit is contained in:
parent
46e0e8d0a6
commit
5af9bc133c
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>600</width>
|
<width>406</width>
|
||||||
<height>400</height>
|
<height>306</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -17,13 +17,35 @@
|
|||||||
<iconset resource="AdaptiveBrightness.qrc">
|
<iconset resource="AdaptiveBrightness.qrc">
|
||||||
<normaloff>:/AdaptiveBrightness/resources/system.ico</normaloff>:/AdaptiveBrightness/resources/system.ico</iconset>
|
<normaloff>:/AdaptiveBrightness/resources/system.ico</normaloff>:/AdaptiveBrightness/resources/system.ico</iconset>
|
||||||
</property>
|
</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">
|
<widget class="QMenuBar" name="menuBar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>600</width>
|
<width>406</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QSlider>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
@ -18,6 +20,16 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent)
|
|||||||
qDebug(ltr("Creating main window"));
|
qDebug(ltr("Creating main window"));
|
||||||
|
|
||||||
m_ui.setupUi(this);
|
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();
|
loadIcons();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user