plugins/nightlight: Relax custom times constraints
Apparently the night light kcm allows to set the custom times so the evening is earlier than the morning to handle extreme cases close to the North and the South pole. NightLightManager::updateTransitionTimings() should require no changes. BUG: 489366
This commit is contained in:
parent
d3bb8ceaae
commit
2adf962467
1 changed files with 1 additions and 5 deletions
|
@ -264,12 +264,8 @@ void NightLightManager::readConfig()
|
|||
// fixed timings
|
||||
QTime morning = QTime::fromString(settings->morningBeginFixed(), "hhmm");
|
||||
QTime evening = QTime::fromString(settings->eveningBeginFixed(), "hhmm");
|
||||
if (morning >= evening) {
|
||||
morning = QTime(6, 0);
|
||||
evening = QTime(18, 0);
|
||||
}
|
||||
|
||||
const int dayDuration = morning.msecsTo(evening);
|
||||
const int dayDuration = morning < evening ? morning.msecsTo(evening) : (MSC_DAY - evening.msecsTo(morning));
|
||||
const int nightDuration = MSC_DAY - dayDuration;
|
||||
const int maximumTransitionDuration = std::min(dayDuration, nightDuration);
|
||||
|
||||
|
|
Loading…
Reference in a new issue