Projects
Eulaceura:Factory
kiran-cpanel-power
_service:obs_scm:0005-fix-brightness-set-minmum...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0005-fix-brightness-set-minmum-brightness-to-20-957b0262.patch of Package kiran-cpanel-power
From 957b026270e6bd2c707e5065f1c0540e1a33f0a6 Mon Sep 17 00:00:00 2001 From: liuxinhao <liuxinhao@kylinos.com.cn> Date: Wed, 19 Jan 2022 11:11:20 +0800 Subject: [PATCH 5/5] fix(brightness): set minmum brightness to 20% MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 设置最小亮度为20% Closes #48486 --- .../general-settings-page.cpp | 30 ++++++++++--------- translations/kiran-cpanel-power.zh_CN.ts | 4 +-- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/pages/general-settings/general-settings-page.cpp b/src/pages/general-settings/general-settings-page.cpp index 55e5c47..3c25d3b 100644 --- a/src/pages/general-settings/general-settings-page.cpp +++ b/src/pages/general-settings/general-settings-page.cpp @@ -133,7 +133,7 @@ void GeneralSettingsPage::initUI() ///初始化QSlider,和延迟设置的Timer ui->slider_brightness->setMaximum(100); - ui->slider_brightness->setMinimum(0); + ui->slider_brightness->setMinimum(20); m_brightnessTimer.setInterval(300); m_brightnessTimer.setSingleShot(true); @@ -254,7 +254,15 @@ void GeneralSettingsPage::load() monitorBrightnessPercent = monitorBrightnessReply.value(); } QSignalBlocker signalBlocker(ui->slider_brightness); - setBrightnessPercent(monitorBrightnessPercent); + if( monitorBrightnessPercent == -1 ) + { + ui->slider_brightness->setMaximum(ui->slider_brightness->maximum()); + ui->slider_brightness->setEnabled(false); + } + else + { + setBrightnessPercent(monitorBrightnessPercent); + } /// idle time if (m_sessionSettings) @@ -321,20 +329,14 @@ void GeneralSettingsPage::handleComboBoxCurrentIdxChanged(int idx) void GeneralSettingsPage::setBrightnessPercent(int percent) { - if (percent < 0) + if (percent < ui->slider_brightness->minimum()) { - ui->slider_brightness->setEnabled(false); - m_brightnessValue = 0; - ui->slider_brightness->setValue(0); - ui->label_brightnessPercent->setText(tr("brightness adjustment not available")); - } - else - { - ui->slider_brightness->setEnabled(true); - ui->slider_brightness->setValue(percent); - m_brightnessValue = percent; - ui->label_brightnessPercent->setText(QString("%1%").arg(percent)); + percent = ui->slider_brightness->minimum(); } + + ui->slider_brightness->setValue(percent); + m_brightnessValue = percent; + ui->label_brightnessPercent->setText(QString("%1%").arg(percent)); } QSize GeneralSettingsPage::sizeHint() const diff --git a/translations/kiran-cpanel-power.zh_CN.ts b/translations/kiran-cpanel-power.zh_CN.ts index db5bbfb..1a46089 100644 --- a/translations/kiran-cpanel-power.zh_CN.ts +++ b/translations/kiran-cpanel-power.zh_CN.ts @@ -214,12 +214,12 @@ <translation>亮度调整不可用</translation> </message> <message> - <location filename="../src/pages/general-settings/general-settings-page.cpp" line="353"/> + <location filename="../src/pages/general-settings/general-settings-page.cpp" line="354"/> <source>%1hour</source> <translation>%1小时</translation> </message> <message> - <location filename="../src/pages/general-settings/general-settings-page.cpp" line="357"/> + <location filename="../src/pages/general-settings/general-settings-page.cpp" line="358"/> <source>%1minute</source> <translation>%1分钟</translation> </message> -- 2.27.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2