Changeset View
Changeset View
Standalone View
Standalone View
applets/nightcolor/plugin/monitor.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2019 Vlad Zahorodnii <vladzzag@gmail.com> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU General Public License as published by | ||||
6 | * the Free Software Foundation; either version 2 of the License, or | ||||
7 | * (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 | ||||
12 | * GNU General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU General Public License | ||||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
16 | */ | ||||
17 | | ||||
18 | #pragma once | ||||
19 | | ||||
20 | #include <QObject> | ||||
21 | | ||||
22 | class MonitorPrivate; | ||||
23 | | ||||
24 | /** | ||||
25 | * The Monitor provides a way for monitoring the state of Night Color. | ||||
26 | */ | ||||
27 | class Monitor : public QObject | ||||
28 | { | ||||
29 | Q_OBJECT | ||||
30 | | ||||
31 | /** | ||||
32 | * This property holds a value to indicate if Night Color is available. | ||||
33 | */ | ||||
34 | Q_PROPERTY(bool available READ isAvailable NOTIFY availableChanged) | ||||
35 | | ||||
36 | /** | ||||
37 | * This property holds a value to indicate if Night Color is enabled. | ||||
38 | */ | ||||
39 | Q_PROPERTY(bool enabled READ isEnabled NOTIFY enabledChanged) | ||||
40 | | ||||
41 | /** | ||||
42 | * This property holds a value to indicate if Night Color is running. | ||||
43 | */ | ||||
44 | Q_PROPERTY(bool running READ isRunning NOTIFY runningChanged) | ||||
45 | | ||||
46 | /** | ||||
47 | * This property holds a value to indicate currently applied color temperature. | ||||
48 | */ | ||||
49 | Q_PROPERTY(int currentTemperature READ currentTemperature NOTIFY currentTemperatureChanged) | ||||
50 | | ||||
51 | /** | ||||
52 | * This property holds a value to indicate currently applied color temperature. | ||||
53 | */ | ||||
54 | Q_PROPERTY(int targetTemperature READ targetTemperature NOTIFY targetTemperatureChanged) | ||||
55 | | ||||
56 | public: | ||||
57 | explicit Monitor(QObject *parent = nullptr); | ||||
58 | ~Monitor() override; | ||||
59 | | ||||
60 | /** | ||||
61 | * Returns @c true if Night Color is available; otherwise @c false. | ||||
62 | */ | ||||
63 | bool isAvailable() const; | ||||
64 | | ||||
65 | /** | ||||
66 | * Returns @c true if Night Color is enabled; otherwise @c false. | ||||
67 | */ | ||||
68 | bool isEnabled() const; | ||||
69 | | ||||
70 | /** | ||||
71 | * Returns @c true if Night Color is running; otherwise @c false. | ||||
72 | */ | ||||
73 | bool isRunning() const; | ||||
74 | | ||||
75 | /** | ||||
76 | * Returns currently applied screen color temperature. | ||||
77 | */ | ||||
78 | int currentTemperature() const; | ||||
79 | | ||||
80 | /** | ||||
81 | * Returns currently applied screen color temperature. | ||||
82 | */ | ||||
83 | int targetTemperature() const; | ||||
84 | | ||||
85 | Q_SIGNALS: | ||||
86 | /** | ||||
87 | * This signal is emitted when Night Color becomes (un)available. | ||||
88 | */ | ||||
89 | void availableChanged(); | ||||
90 | | ||||
91 | /** | ||||
92 | * Emitted whenever Night Color is enabled or disabled. | ||||
93 | */ | ||||
94 | void enabledChanged(); | ||||
95 | | ||||
96 | /** | ||||
97 | * Emitted whenever Night Color starts or stops running. | ||||
98 | */ | ||||
99 | void runningChanged(); | ||||
100 | | ||||
101 | /** | ||||
102 | * Emitted whenever the current screen color temperature has changed. | ||||
103 | */ | ||||
104 | void currentTemperatureChanged(); | ||||
105 | | ||||
106 | /** | ||||
107 | * Emitted whenever the current screen color temperature has changed. | ||||
108 | */ | ||||
109 | void targetTemperatureChanged(); | ||||
110 | | ||||
111 | private: | ||||
112 | MonitorPrivate *d; | ||||
113 | }; |