hyperion.ng/include/effectengine/EffectFileHandler.h

85 lines
2.1 KiB
C
Raw Normal View History

2018-12-31 15:48:29 +01:00
#pragma once
// util
#include <utils/Logger.h>
#include <effectengine/EffectDefinition.h>
#include <effectengine/EffectSchema.h>
#include <utils/settings.h>
class EffectFileHandler : public QObject
{
Q_OBJECT
private:
friend class HyperionDaemon;
EffectFileHandler(const QString& rootPath, const QJsonDocument& effectConfig, QObject* parent = nullptr);
public:
static EffectFileHandler* efhInstance;
Various Cleanups (#1075) * LedDevice - Address clang findings * Fix Windows Warnings * Ensure newInput is initialised * Clean-up unused elements for Plaform Capture * Fix initialization problem and spellings * Address clang findings and spelling corrections * LedDevice clean-ups * Cleanups * Align that getLedCount is int * Have "display" as default for Grabbers * Fix config during start-up for missing elements * Framegrabber Clean-up - Remove non supported grabbers from selection, filter valid options * Typo * Framegrabber.json - Fix property numbering * Preselect active Grabbertype * Sort Grabbernames * Align options with selected element * Fix deletion of pointer to incomplete type 'BonjourBrowserWrapper' * Address macOS compile warnings * Have default layout = 1 LED only to avoid errors as in #673 * Address lgtm findings * Address finding that params passed to LedDevice discovery were not considered * Cleanups after merging with latest master * Update Changelog * Address lgtm findings * Fix comment * Test Fix * Fix Python Warning * Handle Dummy Device assignment correctly * Address delete called on non-final 'commandline::Option' that has virtual functions but non-virtual destructor * Correct that QTimer.start accepts only int * Have Release Python GIL & reset threat state chnage downward compatible * Correct format specifier * LedDevice - add assertions * Readonly DB - Fix merge issue * Smoothing - Fix wrong defaults * LedDevice - correct assertion * Show smoothing config set# in debug and related values. * Suppress error on windows, if default file is "/dev/null" * CMAKE - Allow to define QT_BASE_DIR dynamically via environment-variable * Ignore Visual Studio specific files Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
2020-11-14 17:58:56 +01:00
static EffectFileHandler* getInstance() { return efhInstance; }
2018-12-31 15:48:29 +01:00
///
/// @brief Get all available effects
///
std::list<EffectDefinition> getEffects() const { return _availableEffects; }
2018-12-31 15:48:29 +01:00
///
/// @brief Get all available schemas
///
std::list<EffectSchema> getEffectSchemas() const { return _effectSchemas; }
2018-12-31 15:48:29 +01:00
///
/// @brief Save an effect
/// @param obj The effect args
/// @return If not empty, it contains the error
2018-12-31 15:48:29 +01:00
///
QString saveEffect(const QJsonObject& obj);
2018-12-31 15:48:29 +01:00
///
/// @brief Delete an effect by name.
/// @param effectName The effect name to delete
/// @return If not empty, it contains the error
2018-12-31 15:48:29 +01:00
///
QString deleteEffect(const QString& effectName);
2018-12-31 15:48:29 +01:00
public slots:
///
/// @brief Handle settings update from Hyperion Settingsmanager emit
/// @param type settingyType from enum
/// @param config configuration object
///
2020-08-08 13:09:15 +02:00
void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
2018-12-31 15:48:29 +01:00
signals:
///
/// @brief Emits whenever the data changes for an effect
///
void effectListChanged();
private:
///
/// @brief refresh available schemas and effects
///
void updateEffects();
///
/// @brief Load the effect definition, called by updateEffects()
///
bool loadEffectDefinition(const QString& path, const QString& effectConfigFile, EffectDefinition& effectDefinition);
2018-12-31 15:48:29 +01:00
///
/// @brief load effect schemas, called by updateEffects()
///
bool loadEffectSchema(const QString& path, const QString& effectSchemaFile, EffectSchema& effectSchema);
2018-12-31 15:48:29 +01:00
private:
QJsonObject _effectConfig;
Logger* _log;
const QString _rootPath;
// available effects
std::list<EffectDefinition> _availableEffects;
// all schemas
std::list<EffectSchema> _effectSchemas;
};