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 | public: | ||||
52 | explicit Monitor(QObject *parent = nullptr); | ||||
53 | ~Monitor() override; | ||||
54 | | ||||
55 | /** | ||||
56 | * Returns @c true if Night Color is available; otherwise @c false. | ||||
57 | */ | ||||
58 | bool isAvailable() const; | ||||
59 | | ||||
60 | /** | ||||
61 | * Returns @c true if Night Color is enabled; otherwise @c false. | ||||
62 | */ | ||||
63 | bool isEnabled() const; | ||||
64 | | ||||
65 | /** | ||||
66 | * Returns @c true if Night Color is running; otherwise @c false. | ||||
67 | */ | ||||
68 | bool isRunning() const; | ||||
69 | | ||||
70 | /** | ||||
71 | * Returns currently applied screen color temperature. | ||||
72 | */ | ||||
73 | int currentTemperature() const; | ||||
74 | | ||||
75 | Q_SIGNALS: | ||||
76 | /** | ||||
77 | * This signal is emitted when Night Color becomes (un)available. | ||||
78 | */ | ||||
79 | void availableChanged(); | ||||
80 | | ||||
81 | /** | ||||
82 | * Emitted whenever Night Color is enabled or disabled. | ||||
83 | */ | ||||
84 | void enabledChanged(); | ||||
85 | | ||||
86 | /** | ||||
87 | * Emitted whenever Night Color starts or stops running. | ||||
88 | */ | ||||
89 | void runningChanged(); | ||||
90 | | ||||
91 | /** | ||||
92 | * Emitted whenever the current screen color temperature has changed. | ||||
93 | */ | ||||
94 | void currentTemperatureChanged(); | ||||
95 | | ||||
96 | private: | ||||
97 | MonitorPrivate *d; | ||||
98 | }; |