File indexing completed on 2024-05-19 16:31:39
0001 /* 0002 * SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QObject> 0010 0011 class MonitorPrivate; 0012 0013 /** 0014 * The Monitor provides a way for monitoring the state of Night Color. 0015 */ 0016 class Monitor : public QObject 0017 { 0018 Q_OBJECT 0019 0020 /** 0021 * This property holds a value to indicate if Night Color is available. 0022 */ 0023 Q_PROPERTY(bool available READ isAvailable NOTIFY availableChanged) 0024 0025 /** 0026 * This property holds a value to indicate if Night Color is enabled. 0027 */ 0028 Q_PROPERTY(bool enabled READ isEnabled NOTIFY enabledChanged) 0029 0030 /** 0031 * This property holds a value to indicate if Night Color is running. 0032 */ 0033 Q_PROPERTY(bool running READ isRunning NOTIFY runningChanged) 0034 0035 /** 0036 * This property holds a value to indicate currently applied color temperature. 0037 */ 0038 Q_PROPERTY(int currentTemperature READ currentTemperature NOTIFY currentTemperatureChanged) 0039 0040 /** 0041 * This property holds a value to indicate currently applied color temperature. 0042 */ 0043 Q_PROPERTY(int targetTemperature READ targetTemperature NOTIFY targetTemperatureChanged) 0044 0045 public: 0046 explicit Monitor(QObject *parent = nullptr); 0047 ~Monitor() override; 0048 0049 /** 0050 * Returns @c true if Night Color is available; otherwise @c false. 0051 */ 0052 bool isAvailable() const; 0053 0054 /** 0055 * Returns @c true if Night Color is enabled; otherwise @c false. 0056 */ 0057 bool isEnabled() const; 0058 0059 /** 0060 * Returns @c true if Night Color is running; otherwise @c false. 0061 */ 0062 bool isRunning() const; 0063 0064 /** 0065 * Returns currently applied screen color temperature. 0066 */ 0067 int currentTemperature() const; 0068 0069 /** 0070 * Returns currently applied screen color temperature. 0071 */ 0072 int targetTemperature() const; 0073 0074 Q_SIGNALS: 0075 /** 0076 * This signal is emitted when Night Color becomes (un)available. 0077 */ 0078 void availableChanged(); 0079 0080 /** 0081 * Emitted whenever Night Color is enabled or disabled. 0082 */ 0083 void enabledChanged(); 0084 0085 /** 0086 * Emitted whenever Night Color starts or stops running. 0087 */ 0088 void runningChanged(); 0089 0090 /** 0091 * Emitted whenever the current screen color temperature has changed. 0092 */ 0093 void currentTemperatureChanged(); 0094 0095 /** 0096 * Emitted whenever the current screen color temperature has changed. 0097 */ 0098 void targetTemperatureChanged(); 0099 0100 private: 0101 MonitorPrivate *d; 0102 };