UI fixes/updates (#468)

* fix logging display

* hue wizard add usrname

* fix restartAction sometimes not executed

* remove configRevision

* remove v4l2 grabMode(2d/3d)

* remove latchTime from configs

not in main led device schema

* config comment: all grabbers can crop

* remove smoothing delay&pause for effects

* finalize disable effects ui

* fix empty effect selects

* remote page add 2D/3D videoMode

* add blackborder texts

* Update EffectEngine.cpp
This commit is contained in:
brindosch
2017-09-04 23:12:59 +02:00
committed by GitHub
parent cb7b5fa588
commit 81f5f51257
26 changed files with 503 additions and 453 deletions

View File

@@ -57,7 +57,7 @@ EffectEngine::~EffectEngine()
const std::list<ActiveEffectDefinition> &EffectEngine::getActiveEffects()
{
_availableActiveEffects.clear();
for (Effect * effect : _activeEffects)
{
ActiveEffectDefinition activeEffectDefinition;
@@ -68,19 +68,19 @@ const std::list<ActiveEffectDefinition> &EffectEngine::getActiveEffects()
activeEffectDefinition.args = effect->getArgs();
_availableActiveEffects.push_back(activeEffectDefinition);
}
return _availableActiveEffects;
}
bool EffectEngine::loadEffectDefinition(const QString &path, const QString &effectConfigFile, EffectDefinition & effectDefinition)
{
Logger * log = Logger::getInstance("EFFECTENGINE");
QString fileName = path + QDir::separator() + effectConfigFile;
QJsonParseError error;
// ---------- Read the effect json config file ----------
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly))
{
@@ -90,12 +90,12 @@ bool EffectEngine::loadEffectDefinition(const QString &path, const QString &effe
QByteArray fileContent = file.readAll();
QJsonDocument configEffect = QJsonDocument::fromJson(fileContent, &error);
if (error.error != QJsonParseError::NoError)
{
// report to the user the failure and their locations in the document.
int errorLine(0), errorColumn(0);
for( int i=0, count=qMin( error.offset,fileContent.size()); i<count; ++i )
{
++errorColumn;
@@ -105,31 +105,31 @@ bool EffectEngine::loadEffectDefinition(const QString &path, const QString &effe
++errorLine;
}
}
Error( log, "Error while reading effect: '%s' at Line: '%i' , Column: %i",QSTRING_CSTR( error.errorString()), errorLine, errorColumn);
}
file.close();
file.close();
// ---------- Read the effect json schema file ----------
Q_INIT_RESOURCE(EffectEngine);
QFile schema(":effect-schema");
if (!schema.open(QIODevice::ReadOnly))
{
Error( log, "Schema not found: %s", QSTRING_CSTR(schema.errorString()));
return false;
}
QByteArray schemaContent = schema.readAll();
QJsonDocument configSchema = QJsonDocument::fromJson(schemaContent, &error);
if (error.error != QJsonParseError::NoError)
{
// report to the user the failure and their locations in the document.
int errorLine(0), errorColumn(0);
for( int i=0, count=qMin( error.offset,schemaContent.size()); i<count; ++i )
{
++errorColumn;
@@ -139,14 +139,14 @@ bool EffectEngine::loadEffectDefinition(const QString &path, const QString &effe
++errorLine;
}
}
Error( log, "ERROR: Json schema wrong: '%s' at Line: '%i' , Column: %i", QSTRING_CSTR(error.errorString()), errorLine, errorColumn);
}
schema.close();
// ---------- validate effect config with effect schema ----------
QJsonSchemaChecker schemaChecker;
schemaChecker.setSchema(configSchema.object());
if (!schemaChecker.validate(configEffect.object()).first)
@@ -160,14 +160,14 @@ bool EffectEngine::loadEffectDefinition(const QString &path, const QString &effe
}
// ---------- setup the definition ----------
effectDefinition.file = fileName;
QJsonObject config = configEffect.object();
QString scriptName = config["script"].toString();
effectDefinition.name = config["name"].toString();
if (scriptName.isEmpty())
return false;
QFile fileInfo(scriptName);
if (scriptName.mid(0, 1) == ":" )
@@ -181,23 +181,19 @@ bool EffectEngine::loadEffectDefinition(const QString &path, const QString &effe
? effectDefinition.script = path + QDir::separator() + scriptName
: effectDefinition.script = scriptName;
}
effectDefinition.args = config["args"].toObject();
effectDefinition.smoothCfg = SMOOTHING_MODE_PAUSE;
if (effectDefinition.args["smoothing-custom-settings"].toBool())
{
bool pause = effectDefinition.args["smoothing-pause"].toBool();
if (pause)
{
effectDefinition.smoothCfg = _hyperion->addSmoothingConfig(pause);
}
else
{
effectDefinition.smoothCfg = _hyperion->addSmoothingConfig(
effectDefinition.args["smoothing-time_ms"].toInt(),
effectDefinition.args["smoothing-updateFrequency"].toDouble(),
effectDefinition.args["smoothing-updateDelay"].toInt() );
}
effectDefinition.smoothCfg = _hyperion->addSmoothingConfig(
effectDefinition.args["smoothing-time_ms"].toInt(),
effectDefinition.args["smoothing-updateFrequency"].toDouble(),
0 );
}
else
{
effectDefinition.smoothCfg = _hyperion->addSmoothingConfig(true);
}
return true;
}
@@ -205,12 +201,12 @@ bool EffectEngine::loadEffectDefinition(const QString &path, const QString &effe
bool EffectEngine::loadEffectSchema(const QString &path, const QString &effectSchemaFile, EffectSchema & effectSchema)
{
Logger * log = Logger::getInstance("EFFECTENGINE");
QString fileName = path + "schema/" + QDir::separator() + effectSchemaFile;
QJsonParseError error;
// ---------- Read the effect schema file ----------
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly))
{
@@ -220,12 +216,12 @@ bool EffectEngine::loadEffectSchema(const QString &path, const QString &effectSc
QByteArray fileContent = file.readAll();
QJsonDocument schemaEffect = QJsonDocument::fromJson(fileContent, &error);
if (error.error != QJsonParseError::NoError)
{
// report to the user the failure and their locations in the document.
int errorLine(0), errorColumn(0);
for( int i=0, count=qMin( error.offset,fileContent.size()); i<count; ++i )
{
++errorColumn;
@@ -235,28 +231,28 @@ bool EffectEngine::loadEffectSchema(const QString &path, const QString &effectSc
++errorLine;
}
}
Error( log, "Error while reading effect schema: '%s' at Line: '%i' , Column: %i", QSTRING_CSTR(error.errorString()), errorLine, errorColumn);
return false;
}
file.close();
// ---------- setup the definition ----------
QJsonObject tempSchemaEffect = schemaEffect.object();
QString scriptName = tempSchemaEffect["script"].toString();
effectSchema.schemaFile = fileName;
fileName = path + QDir::separator() + scriptName;
QFile pyFile(fileName);
if (scriptName.isEmpty() || !pyFile.open(QIODevice::ReadOnly))
{
fileName = path + "schema/" + QDir::separator() + effectSchemaFile;
Error( log, "Python script '%s' in effect schema '%s' could not be loaded", QSTRING_CSTR(scriptName), QSTRING_CSTR(fileName));
return false;
}
pyFile.close();
effectSchema.pyFile = (scriptName.mid(0, 1) == ":" ) ? ":/effects/"+scriptName.mid(1) : path + QDir::separator() + scriptName;
@@ -270,11 +266,11 @@ void EffectEngine::readEffects()
// clear all lists
_availableEffects.clear();
_effectSchemas.clear();
// read all effects
const QJsonArray & paths = _effectConfig["paths"].toArray();
const QJsonArray & disabledEfx = _effectConfig["disable"].toArray();
QStringList efxPathList;
efxPathList << ":/effects/";
QStringList disableList;
@@ -327,7 +323,7 @@ void EffectEngine::readEffects()
}
}
Info(_log, "%d effects loaded from directory %s", efxCount, QSTRING_CSTR(path));
// collect effect schemas
efxCount = 0;
directory = path + "schema/";
@@ -349,7 +345,7 @@ void EffectEngine::readEffects()
{
_availableEffects.push_back(item);
}
ErrorIf(_availableEffects.size()==0, _log, "no effects found, check your effect directories");
}

View File

@@ -12,16 +12,19 @@
"type": "string",
"title" : "edt_conf_effp_paths_itemtitle"
},
"minItems" : 1,
"propertyOrder" : 1
},
"disable" :
{
"type" : "array",
"title" : "edt_conf_effp_disable_title",
"default" : [""],
"items" : {
"type": "string",
"title" : "edt_conf_effp_disable_itemtitle"
},
"required" : true,
"propertyOrder" : 2
}
},

View File

@@ -21,14 +21,7 @@
"default" : true,
"required" : true,
"propertyOrder" : 2
},
"configVersion" :
{
"type" : "integer",
"default" : 2,
"minimum" : 1,
"access" : "system",
"required" : true
}
}
},
"additionalProperties" : false
}

View File

@@ -1,11 +1,13 @@
{
"type":"array",
"required" : true,
"title" : "edt_conf_v4l2_heading_title",
"minItems": 1,
"maxItems": 2,
"items":
{
"type" : "object",
"required" : true,
"title" : "edt_conf_v4l2_heading_title",
"properties" :
{
@@ -14,6 +16,7 @@
"type" : "boolean",
"title" : "edt_conf_general_enable_title",
"default" : false,
"required" : true,
"propertyOrder" : 1
},
"device" :
@@ -21,6 +24,7 @@
"type" : "string",
"title" : "edt_conf_v4l2_device_title",
"default" : "auto",
"required" : true,
"propertyOrder" : 2
},
"input" :
@@ -29,6 +33,7 @@
"title" : "edt_conf_v4l2_input_title",
"minimum" : 0,
"default" : 0,
"required" : true,
"propertyOrder" : 3
},
"standard" :
@@ -40,6 +45,7 @@
"options" : {
"enum_titles" : ["edt_conf_enum_PAL", "edt_conf_enum_NTSC"]
},
"required" : true,
"propertyOrder" : 4
},
"width" :
@@ -49,6 +55,7 @@
"minimum" : 0,
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 5
},
"height" :
@@ -58,6 +65,7 @@
"minimum" : 0,
"default" : 0,
"append" : "edt_append_pixel",
"required" : true,
"propertyOrder" : 6
},
"frameDecimation" :
@@ -66,6 +74,7 @@
"title" : "edt_conf_v4l2_frameDecimation_title",
"minimum" : 0,
"default" : 2,
"required" : true,
"propertyOrder" : 7
},
"sizeDecimation" :
@@ -74,6 +83,7 @@
"title" : "Size decimation",
"minimum" : 0,
"default" : 6,
"required" : true,
"propertyOrder" : 8
},
"priority" :
@@ -83,22 +93,16 @@
"maximum" : 253,
"title" : "edt_conf_general_priority_title",
"default" : 240,
"required" : true,
"propertyOrder" : 9
},
"mode" :
{
"type" : "string",
"title" : "edt_conf_v4l2_mode_title",
"enum" : ["2D","3DSBS","3DTAB"],
"default" : "2D",
"propertyOrder" : 10
},
"useKodiChecker" :
{
"type" : "boolean",
"title" : "edt_conf_v4l2_useKodiChecker_title",
"default" : false,
"propertyOrder" : 11
"required" : true,
"propertyOrder" : 10
},
"cropLeft" :
{
@@ -107,7 +111,8 @@
"minimum" : 0,
"default" : 0,
"append" : "edt_append_pixel",
"propertyOrder" : 12
"required" : true,
"propertyOrder" : 11
},
"cropRight" :
{
@@ -116,7 +121,8 @@
"minimum" : 0,
"default" : 0,
"append" : "edt_append_pixel",
"propertyOrder" : 13
"required" : true,
"propertyOrder" : 12
},
"cropTop" :
{
@@ -125,7 +131,8 @@
"minimum" : 0,
"default" : 0,
"append" : "edt_append_pixel",
"propertyOrder" : 14
"required" : true,
"propertyOrder" : 13
},
"cropBottom" :
{
@@ -134,14 +141,16 @@
"minimum" : 0,
"default" : 0,
"append" : "edt_append_pixel",
"propertyOrder" : 15
"required" : true,
"propertyOrder" : 14
},
"signalDetection" :
{
"type" : "boolean",
"title" : "edt_conf_v4l2_signalDetection_title",
"default" : false,
"propertyOrder" : 16
"required" : true,
"propertyOrder" : 15
},
"redSignalThreshold" :
{
@@ -156,7 +165,8 @@
"signalDetection": true
}
},
"propertyOrder" : 17
"required" : true,
"propertyOrder" : 16
},
"greenSignalThreshold" :
{
@@ -171,7 +181,8 @@
"signalDetection": true
}
},
"propertyOrder" : 18
"required" : true,
"propertyOrder" : 17
},
"blueSignalThreshold" :
{
@@ -186,7 +197,8 @@
"signalDetection": true
}
},
"propertyOrder" : 19
"required" : true,
"propertyOrder" : 18
},
"sDVOffsetMin" :
{
@@ -201,7 +213,8 @@
"signalDetection": true
}
},
"propertyOrder" : 20
"required" : true,
"propertyOrder" : 19
},
"sDVOffsetMax" :
{
@@ -216,7 +229,8 @@
"signalDetection": true
}
},
"propertyOrder" : 21
"required" : true,
"propertyOrder" : 20
},
"sDHOffsetMin" :
{
@@ -231,7 +245,8 @@
"signalDetection": true
}
},
"propertyOrder" : 22
"required" : true,
"propertyOrder" : 21
},
"sDHOffsetMax" :
{
@@ -246,7 +261,8 @@
"signalDetection": true
}
},
"propertyOrder" : 23
"required" : true,
"propertyOrder" : 22
}
},
"additionalProperties" : false

View File

@@ -10,7 +10,7 @@
"username": {
"type": "string",
"title":"edt_dev_spec_username_title",
"default": "newdeveloper",
"default": "",
"propertyOrder" : 2
},
"transitiontime": {