From 6b4ef4170c51aa5e6bb9041f1e985dfdabb84f22 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 15 Jun 2024 11:37:26 +0300 Subject: [PATCH] plugins/nightlight: Shuffle some code Keep things that are related spatially close, in this case, the initialization of the timer that will start the next transition. --- src/plugins/nightlight/nightlightmanager.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/plugins/nightlight/nightlightmanager.cpp b/src/plugins/nightlight/nightlightmanager.cpp index e207590dbc..f4480cab0b 100644 --- a/src/plugins/nightlight/nightlightmanager.cpp +++ b/src/plugins/nightlight/nightlightmanager.cpp @@ -372,13 +372,6 @@ void NightLightManager::resetSlowUpdateTimers() } const QDateTime dateTime = QDateTime::currentDateTime(); - - // set up the next slow update - m_slowUpdateStartTimer = std::make_unique(); - m_slowUpdateStartTimer->setSingleShot(true); - connect(m_slowUpdateStartTimer.get(), &QTimer::timeout, this, [this]() { - resetSlowUpdateTimers(); - }); updateTransitionTimings(dateTime); updateTargetTemperature(); @@ -387,6 +380,9 @@ void NightLightManager::resetSlowUpdateTimers() qCCritical(KWIN_NIGHTLIGHT) << "Error in time calculation. Deactivating Night Light."; return; } + m_slowUpdateStartTimer = std::make_unique(); + m_slowUpdateStartTimer->setSingleShot(true); + connect(m_slowUpdateStartTimer.get(), &QTimer::timeout, this, &NightLightManager::resetSlowUpdateTimers); m_slowUpdateStartTimer->start(diff); // start the current slow update