Hyperion Light 2 (#1428)

* Hyperion Light - Have EffectEngine as component

* Hyperion light - Build switches for LED Devices (Serial, Network)

* Fix file uri generation

* Fix missing guard for Windows

* Fix file uri generation

* Update jsonschema and checkschema

* Allow to provide cmake build args to docker build
This commit is contained in:
LordGrey
2022-02-11 20:36:15 +01:00
committed by GitHub
parent 9e4b58d5c6
commit 5078688dc8
47 changed files with 1920 additions and 938 deletions

View File

@@ -4,13 +4,15 @@ else()
project(hyperiond)
endif()
if (NOT CMAKE_VERSION VERSION_LESS "3.12")
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
include_directories(${Python3_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}/..)
else()
find_package (PythonLibs ${PYTHON_VERSION_STRING} EXACT) # Maps PythonLibs to the PythonInterp version of the main cmake
include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}/..)
endif()
if(ENABLE_EFFECTENGINE)
if (NOT CMAKE_VERSION VERSION_LESS "3.12")
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
include_directories(${Python3_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}/..)
else()
find_package (PythonLibs ${PYTHON_VERSION_STRING} EXACT) # Maps PythonLibs to the PythonInterp version of the main cmake
include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}/..)
endif()
endif ()
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Network Gui Widgets REQUIRED)
@@ -47,12 +49,10 @@ endif(WIN32)
target_link_libraries(${PROJECT_NAME}
commandline
hyperion
effectengine
jsonserver
webserver
ssdp
database
python
resources
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Gui
@@ -60,12 +60,15 @@ target_link_libraries(${PROJECT_NAME}
Qt${QT_VERSION_MAJOR}::Widgets
)
if (NOT CMAKE_VERSION VERSION_LESS "3.12")
target_link_libraries( ${PROJECT_NAME} ${Python3_LIBRARIES} )
else()
target_link_libraries( ${PROJECT_NAME} ${PYTHON_LIBRARIES} )
endif()
if(ENABLE_EFFECTENGINE)
target_link_libraries(${PROJECT_NAME} effectengine python)
if (NOT CMAKE_VERSION VERSION_LESS "3.12")
target_link_libraries( ${PROJECT_NAME} ${Python3_LIBRARIES} )
else()
target_link_libraries( ${PROJECT_NAME} ${PYTHON_LIBRARIES} )
endif()
endif ()
if(ENABLE_FLATBUF_SERVER)
target_link_libraries(${PROJECT_NAME} flatbufserver)

View File

@@ -53,11 +53,13 @@
// NetOrigin checks
#include <utils/NetOrigin.h>
#if defined(ENABLE_EFFECTENGINE)
// Init Python
#include <python/PythonInit.h>
// EffectFileHandler
#include <effectengine/EffectFileHandler.h>
#endif
#ifdef ENABLE_CEC
#include <cec/CECHandler.h>
@@ -73,7 +75,9 @@ HyperionDaemon::HyperionDaemon(const QString& rootPath, QObject* parent, bool lo
, _bonjourBrowserWrapper(new BonjourBrowserWrapper())
#endif
, _netOrigin(new NetOrigin(this))
#if defined(ENABLE_EFFECTENGINE)
, _pyInit(new PythonInit())
#endif
, _webserver(nullptr)
, _sslWebserver(nullptr)
, _jsonServer(nullptr)
@@ -113,9 +117,11 @@ HyperionDaemon::HyperionDaemon(const QString& rootPath, QObject* parent, bool lo
createCecHandler();
#if defined(ENABLE_EFFECTENGINE)
// init EffectFileHandler
EffectFileHandler* efh = new EffectFileHandler(rootPath, getSetting(settings::EFFECTS), this);
connect(this, &HyperionDaemon::settingsChanged, efh, &EffectFileHandler::handleSettingsUpdate);
#endif
// connect and apply settings for AuthManager
connect(this, &HyperionDaemon::settingsChanged, _authManager, &AuthManager::handleSettingsUpdate);
@@ -160,7 +166,9 @@ HyperionDaemon::HyperionDaemon(const QString& rootPath, QObject* parent, bool lo
HyperionDaemon::~HyperionDaemon()
{
delete _settingsManager;
#if defined(ENABLE_EFFECTENGINE)
delete _pyInit;
#endif
}
void HyperionDaemon::setVideoMode(VideoMode mode)

View File

@@ -73,7 +73,9 @@ class JsonServer;
class BonjourBrowserWrapper;
class WebServer;
class SettingsManager;
#if defined(ENABLE_EFFECTENGINE)
class PythonInit;
#endif
class SSDPHandler;
class FlatBufferServer;
class ProtoServer;
@@ -168,7 +170,9 @@ private:
AuthManager* _authManager;
BonjourBrowserWrapper* _bonjourBrowserWrapper;
NetOrigin* _netOrigin;
#if defined(ENABLE_EFFECTENGINE)
PythonInit* _pyInit;
#endif
WebServer* _webserver;
WebServer* _sslWebserver;
JsonServer* _jsonServer;

View File

@@ -192,7 +192,9 @@ int main(int argc, char** argv)
#endif
parser.add<BooleanOption> (0x0, "desktop", "Show systray on desktop");
parser.add<BooleanOption> (0x0, "service", "Force hyperion to start as console service");
#if defined(ENABLE_EFFECTENGINE)
Option & exportEfxOption = parser.add<Option> (0x0, "export-effects", "Export effects to given path");
#endif
/* Internal options, invisible to help */
BooleanOption & waitOption = parser.addHidden<BooleanOption> (0x0, "wait-hyperion", "Do not exit if other Hyperion instances are running, wait them to finish");
@@ -275,6 +277,7 @@ int main(int argc, char** argv)
return 0;
}
#if defined(ENABLE_EFFECTENGINE)
if (parser.isSet(exportEfxOption))
{
Q_INIT_RESOURCE(EffectEngine);
@@ -311,6 +314,7 @@ int main(int argc, char** argv)
Error(log, "Can not export to %s",exportEfxOption.getCString(parser));
return 1;
}
#endif
int rc = 1;
bool readonlyMode = false;

View File

@@ -15,8 +15,10 @@
#include <utils/ColorRgb.h>
#include <utils/Process.h>
#if defined(ENABLE_EFFECTENGINE)
#include <effectengine/EffectDefinition.h>
#include <effectengine/Effect.h>
#endif
#include <webserver/WebServer.h>
#include <hyperion/PriorityMuxer.h>
@@ -91,8 +93,10 @@ void SysTray::createTrayIcon()
clearAction->setIcon(QPixmap(":/clear.svg"));
connect(clearAction, &QAction::triggered, this, &SysTray::clearEfxColor);
const std::list<EffectDefinition> efxs = _hyperion->getEffects();
_trayIconMenu = new QMenu(this);
#if defined(ENABLE_EFFECTENGINE)
const std::list<EffectDefinition> efxs = _hyperion->getEffects();
_trayIconEfxMenu = new QMenu(_trayIconMenu);
_trayIconEfxMenu->setTitle(tr("Effects"));
_trayIconEfxMenu->setIcon(QPixmap(":/effects.svg"));
@@ -122,6 +126,7 @@ void SysTray::createTrayIcon()
_trayIconEfxMenu->addAction(efxAction);
}
}
#endif
#ifdef _WIN32
autorunAction = new QAction(tr("&Disable autostart"), this);
@@ -135,7 +140,9 @@ void SysTray::createTrayIcon()
_trayIconMenu->addAction(settingsAction);
_trayIconMenu->addSeparator();
_trayIconMenu->addAction(colorAction);
#if defined(ENABLE_EFFECTENGINE)
_trayIconMenu->addMenu(_trayIconEfxMenu);
#endif
_trayIconMenu->addAction(clearAction);
_trayIconMenu->addSeparator();
_trayIconMenu->addAction(restartAction);
@@ -175,7 +182,7 @@ void SysTray::setColor(const QColor & color)
{
std::vector<ColorRgb> rgbColor{ ColorRgb{ (uint8_t)color.red(), (uint8_t)color.green(), (uint8_t)color.blue() } };
_hyperion->setColor(PriorityMuxer::FG_PRIORITY,rgbColor, Effect::ENDLESS);
_hyperion->setColor(PriorityMuxer::FG_PRIORITY,rgbColor, PriorityMuxer::ENDLESS);
}
void SysTray::showColorDialog()
@@ -228,11 +235,13 @@ void SysTray::settings() const
#endif
}
#if defined(ENABLE_EFFECTENGINE)
void SysTray::setEffect()
{
QString efxName = qobject_cast<QAction*>(sender())->text();
_hyperion->setEffect(efxName, PriorityMuxer::FG_PRIORITY, Effect::ENDLESS);
_hyperion->setEffect(efxName, PriorityMuxer::FG_PRIORITY, PriorityMuxer::ENDLESS);
}
#endif
void SysTray::clearEfxColor()
{

View File

@@ -25,7 +25,9 @@ public slots:
void setColor(const QColor & color);
void closeEvent(QCloseEvent *event);
void settings() const;
#if defined(ENABLE_EFFECTENGINE)
void setEffect();
#endif
void clearEfxColor();
void setAutorunState();
@@ -66,7 +68,9 @@ private:
QSystemTrayIcon *_trayIcon;
QMenu *_trayIconMenu;
#if defined(ENABLE_EFFECTENGINE)
QMenu *_trayIconEfxMenu;
#endif
QColorDialog _colorDlg;
HyperionDaemon *_hyperiond;
Hyperion *_hyperion;