Index: sources/storage/Settings.cpp =================================================================== diff -u -r98581b325c24eb5ef0ce0ce475ad15320d659140 -r2216ac6ac7f77437a7c29ac8b4043be01bc4609e --- sources/storage/Settings.cpp (.../Settings.cpp) (revision 98581b325c24eb5ef0ce0ce475ad15320d659140) +++ sources/storage/Settings.cpp (.../Settings.cpp) (revision 2216ac6ac7f77437a7c29ac8b4043be01bc4609e) @@ -58,7 +58,7 @@ settingFiles += FileHandler::find(folder, fileFilter); } - if ( ! settingFolders.count() ) { + if ( ! settingFiles.count() ) { LOG_DEBUG(QObject::tr("No setting files in the %1").arg(Storage::Settings_Path_Name)); return 2; // TODO : Define an error enum when completed } @@ -69,24 +69,32 @@ QFile file(settingFile.absoluteFilePath()); if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { QString group = ""; - while (!file.atEnd()) { - QString line = file.readLine().replace('\n',""); + while ( ! file.atEnd() ) { + QString line = file.readLine().replace('\n',"").trimmed(); if (line.contains("[")) { line.replace("[","").replace("]", ""); - group = line.trimmed(); + group = line; } else { - if (group.isEmpty()) { + if ( group.isEmpty() ) { continue; } else { - if (line.contains('=')) { - QStringList keyValue = line.split('='); - QString key = keyValue[0].trimmed(); - QString value = keyValue[1].trimmed(); + if ( ! line.isEmpty() ) { + QString key = ""; + QString value = ""; + if ( line.contains('=') ) { + QStringList keyValue = line.split('='); + key = keyValue[0].trimmed(); + value = keyValue[1].trimmed(); + } + else { + key = line; + } QString location= settingFile.absolutePath() + "/"; - _SettingModel.add(group, key, QVariant(value), location); - // DEBUG: qDebug() << group << key << value; + QString category= QString(location + settingFile.baseName()).remove(Storage::Settings_Path_Name); + _Settings.add(group, key, QVariant(value), location, category); + // DEBUG: qDebug() << group << key << value << location << category; } } }