Hyperion Switcher + cleanup (#423)

* upd

* update

* update

* update schemachecker

* ...

* fix lowest priority

* zeroconf updates (#421) (#3)

* zeroconf:
add ip
make names more uniq

* tune dns name for webconfig

* update

* update

* update

* update ui

* ...

* min val for gamma

* lost somewhere this

* add status to hyperion object

* update ui
This commit is contained in:
brindosch
2017-03-24 10:17:36 +01:00
committed by GitHub
parent c6fa40fa87
commit 8e12d189b0
25 changed files with 253 additions and 109 deletions

View File

@@ -85,6 +85,10 @@ void QJsonSchemaChecker::validate(const QJsonValue & value, const QJsonObject &s
checkMinimum(value, attributeValue);
else if (attribute == "maximum")
checkMaximum(value, attributeValue);
else if (attribute == "minLength")
checkMinLength(value, attributeValue);
else if (attribute == "maxLength")
checkMaxLength(value, attributeValue);
else if (attribute == "items")
{
if (value.isArray())
@@ -250,6 +254,40 @@ void QJsonSchemaChecker::checkMaximum(const QJsonValue & value, const QJsonValue
}
}
void QJsonSchemaChecker::checkMinLength(const QJsonValue & value, const QJsonValue & schema)
{
if (!value.isString())
{
// only for Strings
_error = true;
setMessage("minLength check only for string fields");
return;
}
if (value.toString().size() < schema.toInt())
{
_error = true;
setMessage("value is too short (minLength=" + schema.toString() + ")");
}
}
void QJsonSchemaChecker::checkMaxLength(const QJsonValue & value, const QJsonValue & schema)
{
if (!value.isString())
{
// only for Strings
_error = true;
setMessage("maxLength check only for string fields");
return;
}
if (value.toString().size() > schema.toInt())
{
_error = true;
setMessage("value is too long (maxLength=" + schema.toString() + ")");
}
}
void QJsonSchemaChecker::checkItems(const QJsonValue & value, const QJsonObject & schema)
{
if (!value.isArray())