userapps.cpp: Write 'None' if no required feature found

This commit is contained in:
Nicolas Mailloux 2022-06-23 00:56:07 -04:00
parent 9e7edc8d53
commit 74f1d58f0b

View file

@ -233,7 +233,12 @@ QString userapps::parseJsonShow(QJsonObject json)
else if(value.isArray()) { else if(value.isArray()) {
QJsonArray array = value.toArray(); QJsonArray array = value.toArray();
if(key == "RequiredFeatures") { if(key == "RequiredFeatures") {
bool foundRequiredFeature = false;
appendString.append("None");
for(QJsonValueRef ref: array) { for(QJsonValueRef ref: array) {
foundRequiredFeature = true;
appendString.remove(appendString.size() - 4, 4);
int id = ref.toInt(); int id = ref.toInt();
if(id == 0) { if(id == 0) {
appendString.append("Wi-Fi connection"); appendString.append("Wi-Fi connection");
@ -246,8 +251,11 @@ QString userapps::parseJsonShow(QJsonObject json)
} }
appendString.append(", "); appendString.append(", ");
} }
if(foundRequiredFeature == true) {
appendString.remove(appendString.size() - 2, 2); appendString.remove(appendString.size() - 2, 2);
} }
}
else if(key == "SupportedDevices") { else if(key == "SupportedDevices") {
for(QJsonValueRef ref: array) { for(QJsonValueRef ref: array) {
QString name = ref.toString(); QString name = ref.toString();