plugins/nightlight: Rename FALLBACK_SLOW_UPDATE_TIME
This commit is contained in:
parent
55dc891190
commit
d595b8f8aa
3 changed files with 7 additions and 6 deletions
|
@ -3,6 +3,7 @@
|
|||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2017 Roman Gilg <subdiff@gmail.com>
|
||||
SPDX-FileCopyrightText: 2024 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
@ -15,7 +16,7 @@ static const int MSC_DAY = 86400000;
|
|||
static const int MIN_TEMPERATURE = 1000;
|
||||
static const int DEFAULT_DAY_TEMPERATURE = 6500;
|
||||
static const int DEFAULT_NIGHT_TEMPERATURE = 4500;
|
||||
static const int FALLBACK_SLOW_UPDATE_TIME = 1800000; /* 30 minutes */
|
||||
static const int DEFAULT_TRANSITION_DURATION = 1800000; /* 30 minutes */
|
||||
static const int MIN_TRANSITION_DURATION = 60000;
|
||||
|
||||
}
|
||||
|
|
|
@ -288,7 +288,7 @@ void NightLightManager::readConfig()
|
|||
if (maximumTransitionDuration <= transitionDuration) {
|
||||
morning = QTime(6, 0);
|
||||
evening = QTime(18, 0);
|
||||
transitionDuration = FALLBACK_SLOW_UPDATE_TIME;
|
||||
transitionDuration = DEFAULT_TRANSITION_DURATION;
|
||||
}
|
||||
|
||||
m_morning = morning;
|
||||
|
@ -562,16 +562,16 @@ DateTimes NightLightManager::getSunTimings(const QDateTime &dateTime, double lat
|
|||
const bool endDefined = !dateTimes.second.isNull();
|
||||
if (!beginDefined || !endDefined) {
|
||||
if (beginDefined) {
|
||||
dateTimes.second = dateTimes.first.addMSecs(FALLBACK_SLOW_UPDATE_TIME);
|
||||
dateTimes.second = dateTimes.first.addMSecs(DEFAULT_TRANSITION_DURATION);
|
||||
} else if (endDefined) {
|
||||
dateTimes.first = dateTimes.second.addMSecs(-FALLBACK_SLOW_UPDATE_TIME);
|
||||
dateTimes.first = dateTimes.second.addMSecs(-DEFAULT_TRANSITION_DURATION);
|
||||
} else {
|
||||
// Just use default values for morning and evening, but the user
|
||||
// will probably deactivate Night Light anyway if he is living
|
||||
// in a region without clear sun rise and set.
|
||||
const QTime referenceTime = morning ? QTime(6, 0) : QTime(18, 0);
|
||||
dateTimes.first = QDateTime(dateTime.date(), referenceTime);
|
||||
dateTimes.second = dateTimes.first.addMSecs(FALLBACK_SLOW_UPDATE_TIME);
|
||||
dateTimes.second = dateTimes.first.addMSecs(DEFAULT_TRANSITION_DURATION);
|
||||
}
|
||||
}
|
||||
return dateTimes;
|
||||
|
|
|
@ -289,7 +289,7 @@ private:
|
|||
// manual times from config
|
||||
QTime m_morning = QTime(6, 0);
|
||||
QTime m_evening = QTime(18, 0);
|
||||
int m_transitionDuration = FALLBACK_SLOW_UPDATE_TIME; // in milliseconds
|
||||
int m_transitionDuration = DEFAULT_TRANSITION_DURATION; // in milliseconds
|
||||
|
||||
// auto location provided by work space
|
||||
double m_latitudeAuto;
|
||||
|
|
Loading…
Reference in a new issue