From 364e29fa261b9868a8b5dcb70d62cc9850aa4449 Mon Sep 17 00:00:00 2001 From: Blazer Date: Thu, 9 May 2024 22:11:19 -0500 Subject: [PATCH] Brightness range adjustment --- src/app/arbiter.cpp | 4 ++-- src/app/session.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/arbiter.cpp b/src/app/arbiter.cpp index 2c8c6302..7acb003d 100644 --- a/src/app/arbiter.cpp +++ b/src/app/arbiter.cpp @@ -198,12 +198,12 @@ void Arbiter::set_brightness(uint8_t brightness) void Arbiter::decrease_brightness(uint8_t val) { - this->set_brightness(std::min(std::max(76, this->system().brightness.value - val), 255)); + this->set_brightness(std::min(std::max(20, this->system().brightness.value - val), 180)); } void Arbiter::increase_brightness(uint8_t val) { - this->set_brightness(std::min(std::max(76, this->system().brightness.value + val), 255)); + this->set_brightness(std::min(std::max(20, this->system().brightness.value + val), 180)); } void Arbiter::set_volume(uint8_t volume) diff --git a/src/app/session.cpp b/src/app/session.cpp index b7b23139..fd0d816c 100644 --- a/src/app/session.cpp +++ b/src/app/session.cpp @@ -164,7 +164,7 @@ const char *Session::System::Brightness::AUTO_PLUGIN = "auto"; Session::System::Brightness::Brightness(QSettings &settings) : plugin(settings.value("System/Brightness/plugin", Session::System::Brightness::AUTO_PLUGIN).toString()) - , value(settings.value("System/Brightness/value", 255).toUInt()) + , value(settings.value("System/Brightness/value", 180).toUInt()) , loader_() { for (const auto file : Session::plugin_dir("brightness").entryInfoList(QDir::Files)) { @@ -206,7 +206,7 @@ void Session::System::Brightness::set() void Session::System::Brightness::reset() { if (auto plugin = qobject_cast(this->loader_.instance())) - plugin->set(255); + plugin->set(180); } const QList &Session::System::Brightness::plugins() const @@ -313,7 +313,7 @@ QWidget *Session::Forge::brightness_slider(bool buttons) const auto slider = new QSlider(Qt::Orientation::Horizontal); slider->setTracking(false); - slider->setRange(76, 255); + slider->setRange(20, 180); slider->setValue(this->arbiter_.system().brightness.value); QObject::connect(slider, &QSlider::sliderReleased, [this, slider]{ this->arbiter_.set_brightness(slider->sliderPosition()); @@ -324,12 +324,12 @@ QWidget *Session::Forge::brightness_slider(bool buttons) const auto dim_button = new QPushButton(); dim_button->setFlat(true); this->iconize("brightness_low", dim_button, 26); - QObject::connect(dim_button, &QPushButton::clicked, [this]{ this->arbiter_.decrease_brightness(18); }); + QObject::connect(dim_button, &QPushButton::clicked, [this]{ this->arbiter_.decrease_brightness(20); }); auto brighten_button = new QPushButton(); brighten_button->setFlat(true); this->iconize("brightness_high", brighten_button, 26); - QObject::connect(brighten_button, &QPushButton::clicked, [this]{ this->arbiter_.increase_brightness(18); }); + QObject::connect(brighten_button, &QPushButton::clicked, [this]{ this->arbiter_.increase_brightness(20); }); layout->addWidget(dim_button); layout->addWidget(brighten_button);