Refactor Hyperion JSON-API (#1727)

This commit is contained in:
LordGrey
2024-05-08 22:06:32 +02:00
committed by GitHub
parent 94850d890a
commit cf287f5adb
64 changed files with 4203 additions and 2962 deletions

View File

@@ -144,7 +144,7 @@ void EventHandler::handleEvent(Event event)
{
QObject *senderObj = QObject::sender();
QString senderObjectClass;
if (senderObj)
if (senderObj != nullptr)
{
senderObjectClass = senderObj->metaObject()->className();
} else
@@ -179,13 +179,19 @@ void EventHandler::handleEvent(Event event)
break;
case Event::Reload:
emit signalEvent(Event::Reload);
Process::restartHyperion(10);
break;
case Event::Restart:
emit signalEvent(Event::Restart);
Process::restartHyperion(11);
break;
case Event::Quit:
emit signalEvent(Event::Quit);
break;
default:
Error(_log,"Unkonwn Event '%d' received", event);
break;

View File

@@ -35,7 +35,7 @@ OsEventHandlerBase::OsEventHandlerBase()
_log = Logger::getInstance("EVENTS-OS");
QCoreApplication* app = QCoreApplication::instance();
if (!qobject_cast<QApplication*>(app))
if (qobject_cast<QApplication*>(app) == nullptr)
{
_isService = true;
}
@@ -46,6 +46,7 @@ OsEventHandlerBase::OsEventHandlerBase()
OsEventHandlerBase::~OsEventHandlerBase()
{
quit();
QObject::disconnect(this, &OsEventHandlerBase::signalEvent, EventHandler::getInstance().data(), &EventHandler::handleEvent);
OsEventHandlerBase::unregisterLockHandler();
@@ -130,6 +131,11 @@ void OsEventHandlerBase::lock(bool isLocked)
}
}
void OsEventHandlerBase::quit()
{
emit signalEvent(Event::Quit);
}
#if defined(_WIN32)
OsEventHandlerWindows* OsEventHandlerWindows::getInstance()