Changeset View
Changeset View
Standalone View
Standalone View
colorcorrection/manager.h
Show First 20 Lines • Show All 120 Lines • ▼ Show 20 Line(s) | 93 | public: | |||
---|---|---|---|---|---|
121 | * If the filter becomes active after calling this method, the target screen | 121 | * If the filter becomes active after calling this method, the target screen | ||
122 | * color temperature is defined by the current operation mode. | 122 | * color temperature is defined by the current operation mode. | ||
123 | * | 123 | * | ||
124 | * Note that this method is a no-op if the underlying platform doesn't support | 124 | * Note that this method is a no-op if the underlying platform doesn't support | ||
125 | * adjusting gamma ramps. | 125 | * adjusting gamma ramps. | ||
126 | */ | 126 | */ | ||
127 | void toggle(); | 127 | void toggle(); | ||
128 | 128 | | |||
129 | /** | ||||
130 | * Returns @c true if the night color manager is blocked; otherwise @c false. | ||||
131 | */ | ||||
132 | bool isInhibited() const; | ||||
133 | | ||||
134 | /** | ||||
135 | * Temporarily blocks the night color manager. | ||||
136 | * | ||||
137 | * After calling this method, the screen color temperature will be reverted | ||||
138 | * back to 6500C. When you're done, call uninhibit() method. | ||||
139 | */ | ||||
140 | void inhibit(); | ||||
141 | | ||||
142 | /** | ||||
143 | * Attempts to unblock the night color manager. | ||||
144 | */ | ||||
145 | void uninhibit(); | ||||
146 | | ||||
129 | // for auto tests | 147 | // for auto tests | ||
130 | void reparseConfigAndReset(); | 148 | void reparseConfigAndReset(); | ||
131 | 149 | | |||
132 | public Q_SLOTS: | 150 | public Q_SLOTS: | ||
133 | void resetSlowUpdateStartTimer(); | 151 | void resetSlowUpdateStartTimer(); | ||
134 | void quickAdjust(); | 152 | void quickAdjust(); | ||
135 | 153 | | |||
136 | Q_SIGNALS: | 154 | Q_SIGNALS: | ||
137 | void configChange(QHash<QString, QVariant> data); | 155 | void configChange(QHash<QString, QVariant> data); | ||
138 | 156 | | |||
157 | /** | ||||
158 | * Emitted whenever the night color manager is blocked or unblocked. | ||||
159 | */ | ||||
160 | void inhibitedChanged(); | ||||
161 | | ||||
139 | private: | 162 | private: | ||
140 | void initShortcuts(); | 163 | void initShortcuts(); | ||
141 | void readConfig(); | 164 | void readConfig(); | ||
142 | void hardReset(); | 165 | void hardReset(); | ||
143 | void slowUpdate(int targetTemp); | 166 | void slowUpdate(int targetTemp); | ||
144 | void resetAllTimers(); | 167 | void resetAllTimers(); | ||
145 | int currentTargetTemp() const; | 168 | int currentTargetTemp() const; | ||
146 | void cancelAllTimers(); | 169 | void cancelAllTimers(); | ||
Show All 10 Lines | |||||
157 | DateTimes getSunTimings(const QDateTime &dateTime, double latitude, double longitude, bool morning) const; | 180 | DateTimes getSunTimings(const QDateTime &dateTime, double latitude, double longitude, bool morning) const; | ||
158 | bool checkAutomaticSunTimings() const; | 181 | bool checkAutomaticSunTimings() const; | ||
159 | bool daylight() const; | 182 | bool daylight() const; | ||
160 | 183 | | |||
161 | void commitGammaRamps(int temperature); | 184 | void commitGammaRamps(int temperature); | ||
162 | 185 | | |||
163 | ColorCorrectDBusInterface *m_iface; | 186 | ColorCorrectDBusInterface *m_iface; | ||
164 | 187 | | |||
188 | // Specifies whether Night Color is enabled. | ||||
165 | bool m_active; | 189 | bool m_active; | ||
190 | | ||||
191 | // Specifies whether Night Color is currently running. | ||||
166 | bool m_running = false; | 192 | bool m_running = false; | ||
167 | 193 | | |||
194 | // Specifies whether Night Color is inhibited globally. | ||||
195 | bool m_isGloballyInhibited = false; | ||||
196 | | ||||
168 | NightColorMode m_mode = NightColorMode::Automatic; | 197 | NightColorMode m_mode = NightColorMode::Automatic; | ||
169 | 198 | | |||
170 | // the previous and next sunrise/sunset intervals - in UTC time | 199 | // the previous and next sunrise/sunset intervals - in UTC time | ||
171 | DateTimes m_prev = DateTimes(); | 200 | DateTimes m_prev = DateTimes(); | ||
172 | DateTimes m_next = DateTimes(); | 201 | DateTimes m_next = DateTimes(); | ||
173 | 202 | | |||
174 | // manual times from config | 203 | // manual times from config | ||
175 | QTime m_morning = QTime(6,0); | 204 | QTime m_morning = QTime(6,0); | ||
Show All 11 Lines | |||||
187 | QTimer *m_slowUpdateTimer = nullptr; | 216 | QTimer *m_slowUpdateTimer = nullptr; | ||
188 | QTimer *m_quickAdjustTimer = nullptr; | 217 | QTimer *m_quickAdjustTimer = nullptr; | ||
189 | 218 | | |||
190 | int m_currentTemp = NEUTRAL_TEMPERATURE; | 219 | int m_currentTemp = NEUTRAL_TEMPERATURE; | ||
191 | int m_dayTargetTemp = NEUTRAL_TEMPERATURE; | 220 | int m_dayTargetTemp = NEUTRAL_TEMPERATURE; | ||
192 | int m_nightTargetTemp = DEFAULT_NIGHT_TEMPERATURE; | 221 | int m_nightTargetTemp = DEFAULT_NIGHT_TEMPERATURE; | ||
193 | 222 | | |||
194 | int m_failedCommitAttempts = 0; | 223 | int m_failedCommitAttempts = 0; | ||
224 | int m_inhibitReferenceCount = 0; | ||||
195 | 225 | | |||
196 | // The Workspace class needs to call initShortcuts during initialization. | 226 | // The Workspace class needs to call initShortcuts during initialization. | ||
197 | friend class KWin::Workspace; | 227 | friend class KWin::Workspace; | ||
198 | }; | 228 | }; | ||
199 | 229 | | |||
200 | } | 230 | } | ||
201 | } | 231 | } | ||
202 | 232 | | |||
203 | #endif // KWIN_COLORCORRECT_MANAGER_H | 233 | #endif // KWIN_COLORCORRECT_MANAGER_H |