Merge branch 'master' into mediafoundation

# Conflicts:
#	assets/webconfig/content/dashboard.html
#	assets/webconfig/i18n/en.json
#	assets/webconfig/js/content_dashboard.js
#	assets/webconfig/js/content_logging.js
#	assets/webconfig/js/hyperion.js
#	assets/webconfig/js/ui_utils.js
This commit is contained in:
LordGrey
2021-05-02 21:12:00 +02:00
139 changed files with 9391 additions and 4785 deletions

View File

@@ -4,6 +4,7 @@
#include <hyperion/Hyperion.h>
#include <utils/settings.h>
#include <effectengine/Effect.h>
#include <hyperion/PriorityMuxer.h>
///
/// @brief Handle the background Effect settings, reacts on runtime to settings changes
@@ -14,11 +15,19 @@ class BGEffectHandler : public QObject
public:
BGEffectHandler(Hyperion* hyperion)
: QObject(hyperion)
, _hyperion(hyperion)
: QObject(hyperion)
, _hyperion(hyperion)
, _prioMuxer(_hyperion->getMuxerInstance())
, _isBgEffectConfigured(false)
{
// listen for config changes
connect(_hyperion, &Hyperion::settingsChanged, this, &BGEffectHandler::handleSettingsUpdate);
connect(_hyperion, &Hyperion::settingsChanged,
[=](settings::type type, const QJsonDocument& config) { this->handleSettingsUpdate(type, config); }
);
connect(_prioMuxer, &PriorityMuxer::prioritiesChanged,
[=]() { this->handlePriorityUpdate(); }
);
// initialization
handleSettingsUpdate(settings::BGEFFECT, _hyperion->getSetting(settings::BGEFFECT));
@@ -34,14 +43,18 @@ private slots:
{
if(type == settings::BGEFFECT)
{
const QJsonObject& BGEffectConfig = config.object();
_isBgEffectConfigured = false;
_bgEffectConfig = config;
const QJsonObject& BGEffectConfig = _bgEffectConfig.object();
#define BGCONFIG_ARRAY bgColorConfig.toArray()
// clear background priority
_hyperion->clear(PriorityMuxer::BG_PRIORITY);
// initial background effect/color
if (BGEffectConfig["enable"].toBool(true))
{
_isBgEffectConfigured = true;
const QString bgTypeConfig = BGEffectConfig["type"].toString("effect");
const QString bgEffectConfig = BGEffectConfig["effect"].toString("Warm mood blobs");
const QJsonValue bgColorConfig = BGEffectConfig["color"];
@@ -63,12 +76,33 @@ private slots:
Info(Logger::getInstance("HYPERION"),"Initial background effect '%s' %s", QSTRING_CSTR(bgEffectConfig), ((result == 0) ? "started" : "failed"));
}
}
#undef BGCONFIG_ARRAY
}
}
///
/// @brief Handle priority updates.
/// In case the background effect is not current priority, stop BG-effect to save resources; otherwise start effect again.
///
void handlePriorityUpdate()
{
if (_prioMuxer->getCurrentPriority() != PriorityMuxer::BG_PRIORITY && _prioMuxer->hasPriority(PriorityMuxer::BG_PRIORITY))
{
Debug(Logger::getInstance("HYPERION"),"Stop background (color-) effect as it moved out of scope");
_hyperion->clear(PriorityMuxer::BG_PRIORITY);
}
else if (_prioMuxer->getCurrentPriority() == PriorityMuxer::LOWEST_PRIORITY && _isBgEffectConfigured)
{
emit handleSettingsUpdate (settings::BGEFFECT, _bgEffectConfig);
}
}
private:
/// Hyperion instance pointer
Hyperion* _hyperion;
/// priority muxer instance
PriorityMuxer* _prioMuxer;
QJsonDocument _bgEffectConfig;
bool _isBgEffectConfigured;
};

View File

@@ -3,9 +3,14 @@
#include <utils/Logger.h>
#include <utils/settings.h>
#include <utils/version.hpp>
using namespace semver;
// qt includes
#include <QJsonObject>
const int GLOABL_INSTANCE_ID = 255;
class Hyperion;
class SettingsTable;
@@ -61,12 +66,17 @@ private:
bool handleConfigUpgrade(QJsonObject& config);
/// Hyperion instance
Hyperion* _hyperion;
bool resolveConfigVersion(QJsonObject& config);
/// Logger instance
Logger* _log;
/// Hyperion instance
Hyperion* _hyperion;
/// Instance number
quint8 _instance;
/// instance of database table interface
SettingsTable* _sTable;
@@ -76,5 +86,8 @@ private:
/// the current configuration of this instance
QJsonObject _qconfig;
semver::version _configVersion;
semver::version _previousVersion;
bool _readonlyMode;
};