mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Refactor Hyperion JSON-API (#1727)
This commit is contained in:
@@ -125,7 +125,7 @@ void JsonConnection::setEffect(const QString &effectName, const QString & effect
|
||||
if (effectArgs.size() > 0)
|
||||
{
|
||||
QJsonObject effObj;
|
||||
if(!JsonUtils::parse("hyperion-remote-args", effectArgs, effObj, _log))
|
||||
if(!JsonUtils::parse("hyperion-remote-args", effectArgs, effObj, _log).first)
|
||||
{
|
||||
throw std::runtime_error("Error in effect arguments, abort");
|
||||
}
|
||||
@@ -160,7 +160,7 @@ void JsonConnection::createEffect(const QString &effectName, const QString &effe
|
||||
if (effectArgs.size() > 0)
|
||||
{
|
||||
QJsonObject effObj;
|
||||
if(!JsonUtils::parse("hyperion-remote-args", effectScript, effObj, _log))
|
||||
if(!JsonUtils::parse("hyperion-remote-args", effectScript, effObj, _log).first)
|
||||
{
|
||||
throw std::runtime_error("Error in effect arguments, abort");
|
||||
}
|
||||
@@ -440,7 +440,7 @@ void JsonConnection::setConfig(const QString &jsonString)
|
||||
if (jsonString.size() > 0)
|
||||
{
|
||||
QJsonObject configObj;
|
||||
if(!JsonUtils::parse("hyperion-remote-args", jsonString, configObj, _log))
|
||||
if(!JsonUtils::parse("hyperion-remote-args", jsonString, configObj, _log).first)
|
||||
{
|
||||
throw std::runtime_error("Error in configSet arguments, abort");
|
||||
}
|
||||
|
@@ -231,7 +231,7 @@ int main(int argc, char** argv)
|
||||
|
||||
ScreenshotHandler handler("screenshot.png", signalDetectionOffset);
|
||||
QObject::connect(&grabber, SIGNAL(newFrame(Image<ColorRgb>)), &handler, SLOT(receiveImage(Image<ColorRgb>)));
|
||||
grabber.prepare();
|
||||
grabber.prepare();
|
||||
grabber.start();
|
||||
QCoreApplication::exec();
|
||||
grabber.stop();
|
||||
|
@@ -84,10 +84,8 @@ void SysTray::createTrayIcon()
|
||||
|
||||
restartAction = new QAction(tr("&Restart"), this);
|
||||
restartAction->setIcon(QPixmap(":/restart.svg"));
|
||||
connect(restartAction, &QAction::triggered, this , [=](){ Process::restartHyperion(12); });
|
||||
connect(restartAction, &QAction::triggered, this , [=](){ emit signalEvent(Event::Restart); });
|
||||
|
||||
|
||||
// TODO: Check if can be done with SystemEvents
|
||||
suspendAction = new QAction(tr("&Suspend"), this);
|
||||
suspendAction->setIcon(QPixmap(":/suspend.svg"));
|
||||
connect(suspendAction, &QAction::triggered, this, [this]() { emit signalEvent(Event::Suspend); });
|
||||
@@ -129,7 +127,9 @@ void SysTray::createTrayIcon()
|
||||
|
||||
// add seperator if custom effects exists
|
||||
if (!_trayIconEfxMenu->isEmpty())
|
||||
{
|
||||
_trayIconEfxMenu->addSeparator();
|
||||
}
|
||||
|
||||
// build in effects
|
||||
for (const auto &efx : efxs)
|
||||
|
Reference in New Issue
Block a user