Changeset View
Changeset View
Standalone View
Standalone View
colorcorrection/colorcorrectdbusinterface.h
Show All 26 Lines | |||||
27 | namespace KWin | 27 | namespace KWin | ||
28 | { | 28 | { | ||
29 | 29 | | |||
30 | namespace ColorCorrect | 30 | namespace ColorCorrect | ||
31 | { | 31 | { | ||
32 | 32 | | |||
33 | class Manager; | 33 | class Manager; | ||
34 | 34 | | |||
35 | class ColorCorrectDBusInterface : public QObject | 35 | class ColorCorrectDBusInterface : public QObject, public QDBusContext | ||
36 | { | 36 | { | ||
37 | Q_OBJECT | 37 | Q_OBJECT | ||
38 | Q_CLASSINFO("D-Bus Interface", "org.kde.kwin.ColorCorrect") | 38 | Q_CLASSINFO("D-Bus Interface", "org.kde.kwin.ColorCorrect") | ||
39 | Q_PROPERTY(bool inhibited READ isInhibited) | ||||
39 | 40 | | |||
40 | public: | 41 | public: | ||
41 | explicit ColorCorrectDBusInterface(Manager *parent); | 42 | explicit ColorCorrectDBusInterface(Manager *parent); | ||
42 | ~ColorCorrectDBusInterface() override = default; | 43 | ~ColorCorrectDBusInterface() override = default; | ||
43 | 44 | | |||
45 | bool isInhibited() const; | ||||
46 | | ||||
44 | public Q_SLOTS: | 47 | public Q_SLOTS: | ||
45 | /** | 48 | /** | ||
46 | * @brief Gives information about the current state of Night Color. | 49 | * @brief Gives information about the current state of Night Color. | ||
47 | * | 50 | * | ||
48 | * The returned variant hash has always the fields: | 51 | * The returned variant hash has always the fields: | ||
49 | * - ActiveEnabled | 52 | * - ActiveEnabled | ||
50 | * - Active | 53 | * - Active | ||
51 | * - Mode | 54 | * - Mode | ||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | |||||
96 | */ | 99 | */ | ||
97 | bool setNightColorConfig(QHash<QString, QVariant> data); | 100 | bool setNightColorConfig(QHash<QString, QVariant> data); | ||
98 | /** | 101 | /** | ||
99 | * @brief For receiving auto location updates, primarily through the KDE Daemon | 102 | * @brief For receiving auto location updates, primarily through the KDE Daemon | ||
100 | * @return void | 103 | * @return void | ||
101 | * @since 5.12 | 104 | * @since 5.12 | ||
102 | */ | 105 | */ | ||
103 | void nightColorAutoLocationUpdate(double latitude, double longitude); | 106 | void nightColorAutoLocationUpdate(double latitude, double longitude); | ||
107 | /** | ||||
108 | * @brief Temporarily blocks Night Color. | ||||
109 | * @since 5.18 | ||||
110 | */ | ||||
111 | uint inhibit(); | ||||
112 | /** | ||||
113 | * @brief Cancels the previous call to inhibit(). | ||||
114 | * @since 5.18 | ||||
115 | */ | ||||
116 | void uninhibit(uint cookie); | ||||
104 | 117 | | |||
105 | Q_SIGNALS: | 118 | Q_SIGNALS: | ||
106 | /** | 119 | /** | ||
107 | * @brief Emits that the Night Color configuration has been changed. | 120 | * @brief Emits that the Night Color configuration has been changed. | ||
108 | * | 121 | * | ||
109 | * The provided variant hash provides the same fields as nightColorInfo | 122 | * The provided variant hash provides the same fields as nightColorInfo | ||
110 | * | 123 | * | ||
111 | * @return void | 124 | * @return void | ||
112 | * @see nightColorInfo | 125 | * @see nightColorInfo | ||
113 | * @see nightColorConfigChange | 126 | * @see nightColorConfigChange | ||
114 | * @since 5.12 | 127 | * @since 5.12 | ||
115 | */ | 128 | */ | ||
116 | void nightColorConfigChanged(QHash<QString, QVariant> data); | 129 | void nightColorConfigChanged(QHash<QString, QVariant> data); | ||
117 | 130 | | |||
131 | private Q_SLOTS: | ||||
132 | void removeInhibitorService(const QString &serviceName); | ||||
133 | | ||||
118 | private: | 134 | private: | ||
135 | void uninhibit(const QString &serviceName, uint cookie); | ||||
136 | | ||||
119 | Manager *m_manager; | 137 | Manager *m_manager; | ||
138 | QDBusServiceWatcher *m_inhibitorWatcher; | ||||
139 | QMultiHash<QString, uint> m_inhibitors; | ||||
140 | uint m_lastInhibitionCookie = 0; | ||||
120 | }; | 141 | }; | ||
121 | 142 | | |||
122 | } | 143 | } | ||
123 | 144 | | |||
124 | } | 145 | } | ||
125 | 146 | | |||
126 | #endif // KWIN_NIGHTCOLOR_DBUS_INTERFACE_H | 147 | #endif // KWIN_NIGHTCOLOR_DBUS_INTERFACE_H |