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:
@@ -63,13 +63,43 @@ void HyperionIManager::stopAll()
|
||||
}
|
||||
}
|
||||
|
||||
void HyperionIManager::toggleStateAllInstances(bool pause)
|
||||
void HyperionIManager::suspend()
|
||||
{
|
||||
Info(_log,"Suspend all instances and enabled components");
|
||||
QMap<quint8, Hyperion*> instCopy = _runningInstances;
|
||||
for(const auto instance : instCopy)
|
||||
{
|
||||
emit instance->suspendRequest(true);
|
||||
}
|
||||
}
|
||||
|
||||
void HyperionIManager::resume()
|
||||
{
|
||||
Info(_log,"Resume all instances and enabled components");
|
||||
QMap<quint8, Hyperion*> instCopy = _runningInstances;
|
||||
for(const auto instance : instCopy)
|
||||
{
|
||||
emit instance->suspendRequest(false);
|
||||
}
|
||||
}
|
||||
|
||||
void HyperionIManager::toggleIdle(bool isIdle)
|
||||
{
|
||||
Info(_log,"Put all instances in %s state", isIdle ? "idle" : "working");
|
||||
QMap<quint8, Hyperion*> instCopy = _runningInstances;
|
||||
for(const auto instance : instCopy)
|
||||
{
|
||||
emit instance->idleRequest(isIdle);
|
||||
}
|
||||
}
|
||||
|
||||
void HyperionIManager::toggleStateAllInstances(bool enable)
|
||||
{
|
||||
// copy the instances due to loop corruption, even with .erase() return next iter
|
||||
QMap<quint8, Hyperion*> instCopy = _runningInstances;
|
||||
for(const auto instance : instCopy)
|
||||
{
|
||||
emit instance->compStateChangeRequest(hyperion::COMP_ALL, pause);
|
||||
emit instance->compStateChangeRequest(hyperion::COMP_ALL, enable);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user