* Do not validate values for options without value

* Clean-up

* ws281x include files workaround

* Revert "ws281x include files workaround"

This reverts commit 1b98308718.

* Use https://github.com/hyperion-project/rpi_ws281x while fix is applied in original repository
This commit is contained in:
LordGrey
2023-10-29 21:12:59 +01:00
committed by GitHub
parent a5625cf984
commit b73e9f4996
3 changed files with 21 additions and 19 deletions

View File

@@ -14,19 +14,22 @@ bool Parser::parse(const QStringList &arguments)
return false;
}
for(Option * option : _options)
for(Option * option : std::as_const(_options))
{
QString value = this->value(*option);
if (!option->validate(*this, value)) {
const QString error = option->getError();
if (!error.isEmpty()) {
_errorText = tr("\"%1\" is not a valid option for %2, %3").arg(value, option->name(), error);
if (!option->valueName().isEmpty())
{
QString value = this->value(*option);
if (!option->validate(*this, value)) {
const QString error = option->getError();
if (!error.isEmpty()) {
_errorText = tr("\"%1\" is not a valid option for %2, %3").arg(value, option->name(), error);
}
else
{
_errorText = tr("\"%1\" is not a valid option for %2").arg(value, option->name());
}
return false;
}
else
{
_errorText = tr("\"%1\" is not a valid option for %2").arg(value, option->name());
}
return false;
}
}
return true;