summaryrefslogtreecommitdiffstats
path: root/data/inifile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'data/inifile.cpp')
-rw-r--r--data/inifile.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/data/inifile.cpp b/data/inifile.cpp
index df94e43e..2d68caf6 100644
--- a/data/inifile.cpp
+++ b/data/inifile.cpp
@@ -49,12 +49,23 @@ bool INIFile::loadFile(QString fileName)
QStringList lines = in.readAll().split('\n');
for (int i = 0; i < lines.count(); i++)
{
+ QString & lineRaw = lines[i];
// Ignore comments.
- QString line = lines[i].left('#').trimmed();
+ QString line = lineRaw.left(lineRaw.indexOf('#')).trimmed();
- QString key = line.section('=', 0).trimmed();
- QVariant value(line.section('=', 1).trimmed());
+ int eqPos = line.indexOf('=');
+ if(eqPos == -1)
+ continue;
+ QString key = line.left(eqPos).trimmed();
+ QString valueStr = line.right(line.length() - eqPos - 1).trimmed();
+ QVariant value(valueStr);
+ /*
+ QString dbg = key;
+ dbg += " = ";
+ dbg += valueStr;
+ qDebug(dbg.toLocal8Bit());
+ */
this->operator [](key) = value;
}