Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions configparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,7 @@ bool ConfigParams::setParamsXML(QXmlStreamReader &stream)
}
}

bool ok = true;
if (nameFound) {
while (stream.readNextStartElement()) {
QString nameFirst = stream.name().toString();
Expand Down Expand Up @@ -1389,12 +1390,14 @@ bool ConfigParams::setParamsXML(QXmlStreamReader &stream)
p.vTxDoubleScale = stream.readElementText().toDouble();
} else {
qWarning() << "Parameter not found: " << name;
ok = false;
stream.skipCurrentElement();
}

if (stream.hasError()) {
qWarning() << "XML ERROR :" << stream.errorString();
qWarning() << stream.lineNumber() << stream.columnNumber();
ok = false;
}
}

Expand All @@ -1409,6 +1412,7 @@ bool ConfigParams::setParamsXML(QXmlStreamReader &stream)
mSerializeOrder.append(stream.readElementText());
} else {
qWarning() << "Parameter not found: " << name;
ok = false;
stream.skipCurrentElement();
}
}
Expand Down Expand Up @@ -1438,32 +1442,42 @@ bool ConfigParams::setParamsXML(QXmlStreamReader &stream)
addParamToSubgroup(group, subgroup, stream.readElementText());
} else {
qWarning() << "Parameter not found: " << name3;
ok = false;
stream.skipCurrentElement();
}
}
} else {
qWarning() << "Parameter not found: " << name2;
ok = false;
stream.skipCurrentElement();
}
}
} else {
qWarning() << "Parameter not found: " << name;
ok = false;
stream.skipCurrentElement();
}
}
} else {
qWarning() << "Parameter not found: " << name0;
ok = false;
stream.skipCurrentElement();
}
}
} else {
qWarning() << "Parameter not found: " << nameFirst;
ok = false;
stream.skipCurrentElement();
}
}

mXmlStatus = tr("OK");
return true;
if (ok && !stream.hasError()) {
mXmlStatus = tr("OK");
return true;
} else {
mXmlStatus = tr("Error");
return false;
}
} else {
mXmlStatus = tr("tag <b>%1</b> not found").arg(configName);
qWarning() << mXmlStatus;
Expand Down Expand Up @@ -1536,6 +1550,7 @@ bool ConfigParams::saveCDefines(const QString &fileName, bool wrapIfdef)
return false;
}

bool ok = true;
QTextStream out(&file);
QFileInfo info(file);
QString nameStr = info.fileName().toUpper().replace(".", "_") + "_";
Expand Down Expand Up @@ -1575,6 +1590,7 @@ bool ConfigParams::saveCDefines(const QString &fileName, bool wrapIfdef)

default:
qWarning() << name << ": type not supported.";
ok = false;
break;
}

Expand All @@ -1586,6 +1602,7 @@ bool ConfigParams::saveCDefines(const QString &fileName, bool wrapIfdef)
}
} else {
qWarning() << name << "not found.";
ok = false;
}
}

Expand All @@ -1595,7 +1612,7 @@ bool ConfigParams::saveCDefines(const QString &fileName, bool wrapIfdef)
out.flush();
file.close();

return true;
return ok;
}

/**
Expand Down
16 changes: 11 additions & 5 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -765,12 +765,18 @@ int main(int argc, char *argv[])
QString pathParser = xmlCodePath + "confparser.c";
QString pathCompressed = xmlCodePath + "confxml.c";

Utility::createCompressedConfigC(&conf, nameConfig, pathCompressed);
Utility::createParamParserC(&conf, nameConfig, pathParser);
conf.saveCDefines(pathDefines, true);
bool ok = true;
ok = Utility::createCompressedConfigC(&conf, nameConfig, pathCompressed) && ok;
ok = Utility::createParamParserC(&conf, nameConfig, pathParser) && ok;
ok = conf.saveCDefines(pathDefines, true) && ok;

qDebug() << "Done!";
return 0;
if (ok) {
qDebug() << "Done!";
return 0;
} else {
qCritical() << "Errors while generating files.";
return 2;
}
}

if (!fwPackIn.isEmpty()) {
Expand Down
Loading