mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
JsonCpp to QTJson (Part 4) (#266)
* Update ActiveEffectDefinition.h * Update EffectDefinition.h * Update EffectEngine.h * Update Hyperion.h * Update LedDevice.h * Update QJsonFactory.h * Update QJsonSchemaChecker.h * Update Effect.cpp * Update Effect.h * Update EffectEngine.cpp * Update Hyperion.cpp * Update JsonClientConnection.cpp * Update JsonClientConnection.h * Update schema-config.json * Update LedDevice.cpp * Update QJsonSchemaChecker.cpp * Update hyperion-remote.cpp * Update JsonConnection.cpp * Update JsonConnection.h * Update hyperiond.cpp
This commit is contained in:
committed by
redPanther
parent
0a142b0e7d
commit
d9c2a2d91a
@@ -266,15 +266,13 @@ QString JsonConnection::getConfig(std::string type)
|
||||
return QString();
|
||||
}
|
||||
|
||||
void JsonConnection::setConfig(const QString &jsonString, bool create, bool overwrite)
|
||||
void JsonConnection::setConfig(const QString &jsonString)
|
||||
{
|
||||
// create command
|
||||
Json::Value command;
|
||||
command["command"] = "config";
|
||||
command["subcommand"] = "setconfig";
|
||||
|
||||
command["create"] = create;
|
||||
command["overwrite"] = overwrite;
|
||||
Json::Value & config = command["config"];
|
||||
if (jsonString.size() > 0)
|
||||
{
|
||||
|
@@ -111,7 +111,7 @@ public:
|
||||
/// @param jsonString The JSON String(s) to write
|
||||
/// @param create Specifies whether the nonexistent json string to be created
|
||||
///
|
||||
void setConfig(const QString &jsonString, bool create, bool overwrite);
|
||||
void setConfig(const QString &jsonString);
|
||||
|
||||
///
|
||||
/// Set the color transform of the leds
|
||||
|
@@ -91,10 +91,8 @@ int main(int argc, char * argv[])
|
||||
BooleanOption & argSourceAuto = parser.add<BooleanOption>(0x0, "sourceAutoSelect", "Enables auto source, if disabled prio by manual selecting input source");
|
||||
BooleanOption & argSourceOff = parser.add<BooleanOption>(0x0, "sourceOff", "select no source, this results in leds activly set to black (=off)");
|
||||
BooleanOption & argConfigGet = parser.add<BooleanOption>(0x0, "configGet" , "Print the current loaded Hyperion configuration file");
|
||||
Option & argSchemaGet = parser.add<Option> (0x0, "schemaGet" , "Print the json schema for Hyperion configuration");
|
||||
BooleanOption & argSchemaGet = parser.add<BooleanOption>(0x0, "schemaGet" , "Print the json schema for Hyperion configuration");
|
||||
Option & argConfigSet = parser.add<Option> ('W', "configSet", "Write to the actual loaded configuration file. Should be a Json object string.");
|
||||
Option & argCreate = parser.add<Option> (0x0, "createkeys", "Create non exist Json Entry(s) in the actual loaded configuration file. Argument to use in combination with configSet.");
|
||||
Option & argOverwriteConfig = parser.add<Option> (0x0, "overwrite", "Overwrite the actual loaded configuration file with the Json object string from configSet. Argument to use in combination with configSet.");
|
||||
|
||||
// parse all _options
|
||||
parser.process(app);
|
||||
@@ -111,7 +109,7 @@ int main(int argc, char * argv[])
|
||||
bool colorModding = colorTransform || colorAdjust || parser.isSet(argCorrection) || parser.isSet(argTemperature);
|
||||
|
||||
// check that exactly one command was given
|
||||
int commandCount = count({parser.isSet(argColor), parser.isSet(argImage), parser.isSet(argEffect), parser.isSet(argServerInfo), parser.isSet(argClear), parser.isSet(argClearAll), parser.isSet(argEnableComponent), parser.isSet(argDisableComponent), colorModding, parser.isSet(argSource), parser.isSet(argSourceAuto), parser.isSet(argSourceOff), parser.isSet(argConfigGet)});
|
||||
int commandCount = count({parser.isSet(argColor), parser.isSet(argImage), parser.isSet(argEffect), parser.isSet(argServerInfo), parser.isSet(argClear), parser.isSet(argClearAll), parser.isSet(argEnableComponent), parser.isSet(argDisableComponent), colorModding, parser.isSet(argSource), parser.isSet(argSourceAuto), parser.isSet(argSourceOff), parser.isSet(argConfigGet), parser.isSet(argSchemaGet), parser.isSet(argConfigSet)});
|
||||
if (commandCount != 1)
|
||||
{
|
||||
qWarning() << (commandCount == 0 ? "No command found." : "Multiple commands found.") << " Provide exactly one of the following options:";
|
||||
@@ -210,7 +208,7 @@ int main(int argc, char * argv[])
|
||||
}
|
||||
else if (parser.isSet(argConfigSet))
|
||||
{
|
||||
connection.setConfig(argConfigSet.value(parser), parser.isSet(argCreate), parser.isSet(argOverwriteConfig));
|
||||
connection.setConfig(argConfigSet.value(parser));
|
||||
}
|
||||
else if (colorModding)
|
||||
{
|
||||
|
Reference in New Issue
Block a user