i18n corrected

libqt5sql5-sqlite appended to the dependency list
lgtm alerts fixed
added message forwarder to global settings
subscribe type leds-update appended (thanks @Brindosch)
Boblight server port check instead of error message
Race Condition of different priorities are prevented at startup

Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
Paulchen-Panther
2019-07-20 11:28:16 +02:00
parent 3a488e703c
commit af416ba5fc
18 changed files with 72 additions and 829 deletions

View File

@@ -72,11 +72,11 @@ JsonAPI::JsonAPI(QString peerAddress, Logger* log, const bool& localConnection,
// init Hyperion pointer
handleInstanceSwitch(0);
// // notify hyperion about a jsonMessageForward
// connect(this, &JsonAPI::forwardJsonMessage, _hyperion, &Hyperion::forwardJsonMessage);
// notify hyperion about a jsonMessageForward
connect(this, &JsonAPI::forwardJsonMessage, _hyperion, &Hyperion::forwardJsonMessage);
}
const bool JsonAPI::handleInstanceSwitch(const quint8& inst, const bool& forced)
bool JsonAPI::handleInstanceSwitch(const quint8& inst, const bool& forced)
{
// check if we are already on the requested instance
if(_hyperion != nullptr && _hyperion->getInstanceIndex() == inst)
@@ -1241,7 +1241,7 @@ void JsonAPI::handleAuthorizeCommand(const QJsonObject & message, const QString
}
}
const bool JsonAPI::handleHTTPAuth(const QString& command, const int& tan, const QString& token)
bool JsonAPI::handleHTTPAuth(const QString& command, const int& tan, const QString& token)
{
if(_authManager->isTokenAuthorized(token))
{

View File

@@ -35,7 +35,7 @@ JsonCB::JsonCB(Hyperion* hyperion, QObject* parent)
, _prioMuxer(_hyperion->getMuxerInstance())
{
_availableCommands << "components-update" << "sessions-update" << "priorities-update" << "imageToLedMapping-update"
<< "adjustment-update" << "videomode-update" << "effects-update" << "settings-update" << "instance-update";
<< "adjustment-update" << "videomode-update" << "effects-update" << "settings-update" << "leds-update" << "instance-update";
}
bool JsonCB::subscribeFor(const QString& type)
@@ -92,6 +92,13 @@ bool JsonCB::subscribeFor(const QString& type)
connect(_hyperion, &Hyperion::settingsChanged, this, &JsonCB::handleSettingsChange, Qt::UniqueConnection);
}
if(type == "leds-update")
{
_subscribedCommands << type;
connect(_hyperion, &Hyperion::settingsChanged, this, &JsonCB::handleLedsConfigChange, Qt::UniqueConnection);
}
if(type == "instance-update")
{
_subscribedCommands << type;
@@ -318,6 +325,16 @@ void JsonCB::handleSettingsChange(const settings::type& type, const QJsonDocumen
doCallback("settings-update", QVariant(dat));
}
void JsonCB::handleLedsConfigChange(const settings::type& type, const QJsonDocument& data)
{
if(type == settings::LEDS)
{
QJsonObject dat;
dat[typeToString(type)] = data.array();
doCallback("leds-update", QVariant(dat));
}
}
void JsonCB::handleInstanceChange()
{
QJsonArray arr;