StelIniParser.cpp   StelIniParser.cpp 
skipping to change at line 85 skipping to change at line 85
return true; return true;
} }
bool writeStelIniFile(QIODevice &device, const QSettings::SettingsMap &map) bool writeStelIniFile(QIODevice &device, const QSettings::SettingsMap &map)
{ {
int maxKeyWidth = 30; int maxKeyWidth = 30;
QRegExp reKeyXt("^([^/]+)/(.+)$"); // for extracting keys/values QRegExp reKeyXt("^([^/]+)/(.+)$"); // for extracting keys/values
// first go over map and find longest key length // first go over map and find longest key length
for(int i=0; i<map.keys().size(); i++) foreach(QString key, map.keys())
{ {
QString k = map.keys().at(i); if (reKeyXt.exactMatch(key))
QString key = k;
if (reKeyXt.exactMatch(k))
key = reKeyXt.cap(2); key = reKeyXt.cap(2);
if (key.size() > maxKeyWidth) maxKeyWidth = key.size(); if (key.size() > maxKeyWidth) maxKeyWidth = key.size();
} }
// OK, this time actually write to the file - first non-section valu es // OK, this time actually write to the file - first non-section valu es
QString outputLine; QString outputLine;
for(int i=0; i<map.keys().size(); i++) foreach(QString k, map.keys())
{ {
QString k = map.keys().at(i);
if (!reKeyXt.exactMatch(k)) if (!reKeyXt.exactMatch(k))
{ {
// this is for those keys without a section // this is for those keys without a section
outputLine = QString("%1").arg(k,0-maxKeyWidth) + " = " + map[k].toString() + stelEndl; outputLine = QString("%1").arg(k,0-maxKeyWidth) + " = " + map[k].toString() + stelEndl;
device.write(outputLine.toUtf8()); device.write(outputLine.toUtf8());
} }
} }
// Now those values with sections. // Now those values with sections.
QString currentSection(""); QString currentSection("");
for(int i=0; i<map.keys().size(); i++) foreach(QString k, map.keys())
{ {
QString k = map.keys().at(i);
if (reKeyXt.exactMatch(k)) if (reKeyXt.exactMatch(k))
{ {
QString sec = reKeyXt.cap(1); QString key = reKeyXt. cap(2); QString sec = reKeyXt.cap(1); QString key = reKeyXt. cap(2);
// detect new sections and write section headers in file // detect new sections and write section headers in file
if (sec != currentSection) if (sec != currentSection)
{ {
currentSection = sec; currentSection = sec;
outputLine = stelEndl + "[" + currentSection + "]" + stelEndl; outputLine = stelEndl + "[" + currentSection + "]" + stelEndl;
 End of changes. 6 change blocks. 
8 lines changed or deleted 4 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/