mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Add Suspend/Resume support (#1535)
* Add Suspend/Resume support * Support Suspend/Resume/Restart via API, UI and Systray * Support screen lock/unlock scenario * Handle idle scenario * Align with fix for #1368 * Update Windows build * Refactor SuspendHandler to maintain state * Do not start BG-Effect, if system goes into suspend mode * Correct Idle and Resume interaction
This commit is contained in:
@@ -20,6 +20,7 @@ public:
|
||||
, _hyperion(hyperion)
|
||||
, _prioMuxer(_hyperion->getMuxerInstance())
|
||||
, _isBgEffectEnabled(false)
|
||||
, _isSuspended(false)
|
||||
{
|
||||
QString subComponent = parent()->property("instance").toString();
|
||||
_log = Logger::getInstance("HYPERION", subComponent);
|
||||
@@ -33,6 +34,11 @@ public:
|
||||
this->handlePriorityUpdate();
|
||||
});
|
||||
|
||||
// listen for suspend/resume requests, to not start a background effect when system goes into suspend mode
|
||||
connect(_hyperion, &Hyperion::suspendRequest, this, [=] (bool isSuspended) {
|
||||
_isSuspended = isSuspended;
|
||||
});
|
||||
|
||||
// initialization
|
||||
handleSettingsUpdate(settings::BGEFFECT, _hyperion->getSetting(settings::BGEFFECT));
|
||||
}
|
||||
@@ -109,7 +115,7 @@ private slots:
|
||||
Debug(_log,"Stop background (color-) effect as it moved out of scope");
|
||||
_hyperion->clear(PriorityMuxer::BG_PRIORITY);
|
||||
}
|
||||
else if (_prioMuxer->getCurrentPriority() == PriorityMuxer::LOWEST_PRIORITY && _isBgEffectEnabled)
|
||||
else if (!_isSuspended && _prioMuxer->getCurrentPriority() == PriorityMuxer::LOWEST_PRIORITY && _isBgEffectEnabled)
|
||||
{
|
||||
Debug(_log,"Start background (color-) effect as it moved in scope");
|
||||
emit handleSettingsUpdate (settings::BGEFFECT, _bgEffectConfig);
|
||||
@@ -126,6 +132,8 @@ private:
|
||||
|
||||
QJsonDocument _bgEffectConfig;
|
||||
bool _isBgEffectEnabled;
|
||||
|
||||
bool _isSuspended;
|
||||
};
|
||||
|
||||
#endif // BGEFFECTHANDLER_H
|
||||
|
Reference in New Issue
Block a user