mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Introduce Event Services (#1653)
* Allow to enable/disable suspend & lock event handling * Fix Windows * Refactor event handling incl.CEC * Revert "Auxiliary commit to revert individual files from 0d9a8b8a3a4a09609a339f54c7d8a9384c561282" This reverts commit 80737d926ad151a07b2493dd1685ed502975cb2e. * Support Events for Grabbers generically * Have CECEvent to actions configurable, further clean-ups * Remove handleEvent from V4L2grabber, as grabber will be stopped on suspend * Validate that one CEC Event can only trigger one action * MacOS lock/unlock added * fast windows fix * Corrections * Fix CodeQL findings * add macos lock/unlock handler * Migration of CEC-config and have default actions * Correct target_link_libraries * Include Foundation * macOS include AppKit * Support Scheduled Events, cleanups. * Fix destructing * Fix coredump during free * Consider additional error sceanrio * Fix missing code * install desktop icons * correct bash logic --------- Co-authored-by: Paulchen-Panther <16664240+Paulchen-Panther@users.noreply.github.com>
This commit is contained in:
50
include/events/EventEnum.h
Normal file
50
include/events/EventEnum.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#ifndef EVENTENUM_H
|
||||
#define EVENTENUM_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
enum class Event
|
||||
{
|
||||
Unknown,
|
||||
Suspend,
|
||||
Resume,
|
||||
ToggleSuspend,
|
||||
Idle,
|
||||
ResumeIdle,
|
||||
ToggleIdle,
|
||||
Reload,
|
||||
Restart
|
||||
};
|
||||
|
||||
inline const char* eventToString(Event event)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case Event::Suspend: return "Suspend";
|
||||
case Event::Resume: return "Resume";
|
||||
case Event::ToggleSuspend: return "ToggleSuspend";
|
||||
case Event::Idle: return "Idle";
|
||||
case Event::ResumeIdle: return "ResumeIdle";
|
||||
case Event::ToggleIdle: return "ToggleIdle";
|
||||
case Event::Reload: return "Reload";
|
||||
case Event::Restart: return "Restart";
|
||||
case Event::Unknown:
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
inline Event stringToEvent(const QString& event)
|
||||
{
|
||||
if (event.compare("Suspend")==0) return Event::Suspend;
|
||||
if (event.compare("Resume")==0) return Event::Resume;
|
||||
if (event.compare("ToggleSuspend")==0) return Event::ToggleSuspend;
|
||||
if (event.compare("Idle")==0) return Event::Idle;
|
||||
if (event.compare("ResumeIdle")==0) return Event::ResumeIdle;
|
||||
if (event.compare("ToggleIdle")==0) return Event::ToggleIdle;
|
||||
if (event.compare("Reload")==0) return Event::Reload;
|
||||
if (event.compare("Restart")==0) return Event::Restart;
|
||||
return Event::Unknown;
|
||||
}
|
||||
|
||||
|
||||
#endif // EVENTENUM_H
|
Reference in New Issue
Block a user