-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpowerop.h
More file actions
48 lines (39 loc) · 861 Bytes
/
Copy pathpowerop.h
File metadata and controls
48 lines (39 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#ifndef POWEROP_H
#define POWEROP_H
#include <QObject>
#include <QDateTime>
#include <QString>
#include <QStringList>
struct PowerResult
{
bool success = false;
QString message;
};
enum class PowerAction
{
Shutdown,
Reboot,
Sleep,
Hibernate,
CloseMonitor
};
class PowerOp : public QObject
{
Q_OBJECT
public:
explicit PowerOp(QObject *parent = nullptr);
PowerResult shutdown();
PowerResult reboot();
PowerResult sleep();
PowerResult hibernate();
PowerResult closeMonitor();
PowerResult requestAuthorization(PowerAction action);
PowerResult schedulePowerAction(PowerAction action, int delaySeconds);
PowerResult cancelScheduledPowerActions();
bool supportsSleep() const;
bool supportsHibernate() const;
signals:
private:
QString m_linuxScheduledUnit;
};
#endif // POWEROP_H