Changeset View
Changeset View
Standalone View
Standalone View
src/powermanagementinterface.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2019 Matthieu Gallien <matthieu_gallien@yahoo.fr> | ||||
3 | * | ||||
4 | * This program is free software: you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU Lesser General Public | ||||
6 | * License as published by the Free Software Foundation; either | ||||
7 | * version 3 of the License, or (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
12 | * Lesser General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU Lesser General Public License | ||||
15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||||
16 | */ | ||||
17 | | ||||
18 | #ifndef POWERMANAGEMENTINTERFACE_H | ||||
19 | #define POWERMANAGEMENTINTERFACE_H | ||||
20 | | ||||
21 | #include <QObject> | ||||
22 | | ||||
23 | #include <memory> | ||||
24 | | ||||
25 | class QDBusPendingCallWatcher; | ||||
26 | class PowerManagementInterfacePrivate; | ||||
27 | | ||||
28 | class PowerManagementInterface : public QObject | ||||
29 | { | ||||
30 | | ||||
31 | Q_OBJECT | ||||
32 | | ||||
33 | Q_PROPERTY(bool preventSleep | ||||
34 | READ preventSleep | ||||
35 | WRITE setPreventSleep | ||||
36 | NOTIFY preventSleepChanged) | ||||
37 | | ||||
38 | Q_PROPERTY(bool sleepInhibited | ||||
39 | READ sleepInhibited | ||||
40 | NOTIFY sleepInhibitedChanged) | ||||
41 | | ||||
42 | public: | ||||
43 | | ||||
44 | explicit PowerManagementInterface(QObject *parent = nullptr); | ||||
45 | | ||||
46 | ~PowerManagementInterface(); | ||||
47 | | ||||
48 | bool preventSleep() const; | ||||
49 | | ||||
50 | bool sleepInhibited() const; | ||||
51 | | ||||
52 | Q_SIGNALS: | ||||
53 | | ||||
54 | void preventSleepChanged(); | ||||
55 | | ||||
56 | void sleepInhibitedChanged(); | ||||
57 | | ||||
58 | public Q_SLOTS: | ||||
59 | | ||||
60 | void setPreventSleep(bool value); | ||||
61 | | ||||
62 | void retryInhibitingSleep(); | ||||
63 | | ||||
64 | private Q_SLOTS: | ||||
65 | | ||||
66 | void hostSleepInhibitChanged(); | ||||
67 | | ||||
68 | void inhibitDBusCallFinishedPlasmaWorkspace(QDBusPendingCallWatcher *aWatcher); | ||||
69 | | ||||
70 | void uninhibitDBusCallFinishedPlasmaWorkspace(QDBusPendingCallWatcher *aWatcher); | ||||
71 | | ||||
72 | void inhibitDBusCallFinishedGnomeWorkspace(QDBusPendingCallWatcher *aWatcher); | ||||
73 | | ||||
74 | void uninhibitDBusCallFinishedGnomeWorkspace(QDBusPendingCallWatcher *aWatcher); | ||||
75 | | ||||
76 | void inhibitDBusCallFinishedLogindWorkspace(QDBusPendingCallWatcher *aWatcher); | ||||
77 | | ||||
78 | private: | ||||
79 | | ||||
80 | void inhibitSleepPlasmaWorkspace(); | ||||
81 | | ||||
82 | void uninhibitSleepPlasmaWorkspace(); | ||||
83 | | ||||
84 | void inhibitSleepGnomeWorkspace(); | ||||
85 | | ||||
86 | void uninhibitSleepGnomeWorkspace(); | ||||
87 | | ||||
88 | void inhibitSleepLogindWorkspace(); | ||||
89 | | ||||
90 | void uninhibitSleepLogindWorkspace(); | ||||
91 | | ||||
92 | void inhibitSleepWindowsWorkspace(); | ||||
93 | | ||||
94 | void uninhibitSleepWindowsWorkspace(); | ||||
95 | | ||||
96 | std::unique_ptr<PowerManagementInterfacePrivate> d; | ||||
97 | | ||||
98 | }; | ||||
99 | | ||||
100 | #endif // POWERMANAGEMENTINTERFACE_H |