mirror of https://github.com/cutefishos/core
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
871 B
C++
41 lines
871 B
C++
#ifndef CUTEFISH_SETTINGS_POWERMANAGER_H
|
|
#define CUTEFISH_SETTINGS_POWERMANAGER_H
|
|
|
|
#include <QObject>
|
|
#include <QSettings>
|
|
|
|
class DimDisplayAction;
|
|
class UPowerManager;
|
|
|
|
class PowerManager : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit PowerManager(UPowerManager *upowerManager, QObject *parent = nullptr);
|
|
|
|
public slots:
|
|
void setBatteryScreenOff(int timeout);
|
|
void setACScreenOff(int timeout);
|
|
void setDimDisplayTimeout(int timeout);
|
|
|
|
private slots:
|
|
void onBatteryChanged();
|
|
void onLidClosedChanged();
|
|
|
|
private:
|
|
void loadSettings();
|
|
void applyPolicy();
|
|
void writePowerSetting(const QString &key, const QVariant &value);
|
|
|
|
QSettings m_settings;
|
|
UPowerManager *m_upowerManager;
|
|
DimDisplayAction *m_dimDisplayAction;
|
|
|
|
int m_batteryScreenOff = 300;
|
|
int m_acScreenOff = 1200;
|
|
bool m_onBattery = false;
|
|
};
|
|
|
|
#endif
|