Fix wrong logic that disables "prevent sleeping" timer

Also update power management state early so we don't need to wait for
the timer timeout to have the effect.
This commit is contained in:
Chocobo1 2020-04-04 11:59:25 +08:00 committed by sledgehammer999
parent a9f43bd5d2
commit 80016db781
No known key found for this signature in database
GPG key ID: 6E4A2D025B7CC9A2

View file

@ -1454,8 +1454,11 @@ void MainWindow::loadPreferences(const bool configureSession)
showStatusBar(pref->isStatusbarDisplayed());
if ((pref->preventFromSuspendWhenDownloading() || pref->preventFromSuspendWhenSeeding()) && !m_preventTimer->isActive()) {
m_preventTimer->start(PREVENT_SUSPEND_INTERVAL);
if (pref->preventFromSuspendWhenDownloading() || pref->preventFromSuspendWhenSeeding()) {
if (!m_preventTimer->isActive()) {
updatePowerManagementState();
m_preventTimer->start(PREVENT_SUSPEND_INTERVAL);
}
}
else {
m_preventTimer->stop();