bug fix:
I726MV 【主要】【电源管理】睡眠前十秒,没有降低屏幕亮度 I726LY 【主要】【电源管理】关闭显示器前十秒,没有降低屏幕亮度
This commit is contained in:
parent
901b9f8c8c
commit
bcb7ae8bf5
|
@ -31,11 +31,12 @@ CompatibleInterface::CompatibleInterface(QObject *parent) : QObject(parent)
|
|||
"org.ukui.powermanagement.interface",
|
||||
QDBusConnection::systemBus());
|
||||
|
||||
m_brightnes = brightnesssettings->get(BRIGHTNESS).toInt();
|
||||
connect(brightnesssettings, &QGSettings::changed, [=](QString key) {
|
||||
if (BRIGHTNESS == key) {
|
||||
brightnes=brightnesssettings->get(BRIGHTNESS).toInt();
|
||||
interface->call("RegulateBrightness",brightnes);
|
||||
qDebug()<<"brightness"<<brightnes;
|
||||
m_brightnes = brightnesssettings->get(BRIGHTNESS).toInt();
|
||||
interface->call("RegulateBrightness", m_brightnes);
|
||||
qDebug() << "brightness"<< m_brightnes;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -45,3 +46,16 @@ CompatibleInterface::~CompatibleInterface()
|
|||
delete iface;
|
||||
delete interface;
|
||||
}
|
||||
|
||||
void CompatibleInterface::reduceBrightness()
|
||||
{
|
||||
int brightness = m_brightnes * 0.7;
|
||||
interface->call("RegulateBrightness", brightness);
|
||||
qDebug() << "reduce brightness";
|
||||
}
|
||||
|
||||
void CompatibleInterface::restoreBrightness()
|
||||
{
|
||||
interface->call("RegulateBrightness", m_brightnes);
|
||||
qDebug() << "restore brightness";
|
||||
}
|
||||
|
|
|
@ -32,10 +32,12 @@ public:
|
|||
explicit CompatibleInterface(QObject *parent = nullptr);
|
||||
~CompatibleInterface();
|
||||
|
||||
void reduceBrightness();
|
||||
void restoreBrightness();
|
||||
private:
|
||||
QGSettings *brightnesssettings;
|
||||
|
||||
int brightnes;
|
||||
int m_brightnes;
|
||||
QDBusInterface *iface;
|
||||
QDBusInterface *interface;
|
||||
|
||||
|
|
|
@ -144,13 +144,13 @@ void PowerManagerCenter::dealIdleEvent(const QString &type)
|
|||
} else if (SLEEP_DISPLAY == type) {
|
||||
m_control->dealControlAction(TURN_OFF_DISPLAY, true);
|
||||
} else if (REDUCE_BRIGHTNESS == type) {
|
||||
m_brightness->reduceBrightness();
|
||||
m_compatibleInterface->reduceBrightness();
|
||||
m_isIdleBrightness = true;
|
||||
} else if (ENTER_IDLE_STATE == type) {
|
||||
setIdleTime(machineType);
|
||||
} else if (EXIT_IDLE_STATE == type) {
|
||||
if (Laptop == machineType && m_isIdleBrightness) {
|
||||
m_brightness->restoreBrightness();
|
||||
m_compatibleInterface->restoreBrightness();
|
||||
m_isIdleBrightness = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue