| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- #include "appconfigparser.h"
- #include "loghelper.h"
- AppConfigParser::AppConfigParser()
- {
- }
- bool AppConfigParser::readConfig(QString content)
- {
- QString errorStr;
- int errorLine;
- int errorColumn;
- QDomDocument doc;
- if(!doc.setContent(content,false,&errorStr,&errorLine,&errorColumn))
- {
- LogHelper::writeLog(errorStr + " " +\
- QString::number(errorLine) + " " +QString::number(errorColumn));
- return false;
- }
- QDomElement root = doc.documentElement();
- if (root.tagName()!="SpeedNumCube")
- {
- return false;
- }
- parseConfigElement(root);
- return true;
- }
- void AppConfigParser::parseConfigElement(const QDomElement &element)
- {
- QDomNode child = element.firstChild();
- if (!child.isNull())
- {
- if(child.toElement().tagName()=="versioninfo")
- {
- minVer = child.toElement().attribute("minver");
- maxVer = child.toElement().attribute("maxver");
- }
- }
- }
|