|
|
|
@ -14,7 +14,7 @@ class SettingsBase
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
SettingsBase() {}
|
|
|
|
|
SettingsBase() { mMultiValue = false; }
|
|
|
|
|
~SettingsBase() {}
|
|
|
|
|
|
|
|
|
|
inline QString value(const QString &key, const QString &defaultValue = QString())
|
|
|
|
@ -36,6 +36,11 @@ public:
|
|
|
|
|
mSettings.insertMulti(key, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void setMultiValueEnabled(bool enable)
|
|
|
|
|
{
|
|
|
|
|
mMultiValue = enable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void remove(const QString &key)
|
|
|
|
|
{
|
|
|
|
|
mSettings.remove(key);
|
|
|
|
@ -66,8 +71,8 @@ public:
|
|
|
|
|
|
|
|
|
|
if (keyRe.indexIn(line) != -1) {
|
|
|
|
|
|
|
|
|
|
QString key = keyRe.cap(1);
|
|
|
|
|
QString value = keyRe.cap(2);
|
|
|
|
|
QString key = keyRe.cap(1).trimmed();
|
|
|
|
|
QString value = keyRe.cap(2).trimmed();
|
|
|
|
|
|
|
|
|
|
if (!sectionPrefix.isEmpty())
|
|
|
|
|
key.prepend(sectionPrefix);
|
|
|
|
@ -75,8 +80,13 @@ public:
|
|
|
|
|
mSettings.remove(key);
|
|
|
|
|
|
|
|
|
|
QStringList values = mCache.values(key);
|
|
|
|
|
|
|
|
|
|
if (!values.contains(value)) {
|
|
|
|
|
mCache.insertMulti(key, value);
|
|
|
|
|
if (mMultiValue) {
|
|
|
|
|
mCache.insertMulti(key, value);
|
|
|
|
|
} else {
|
|
|
|
|
mCache.insert(key, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -94,6 +104,8 @@ public:
|
|
|
|
|
private:
|
|
|
|
|
Map mSettings;
|
|
|
|
|
Map mCache;
|
|
|
|
|
|
|
|
|
|
bool mMultiValue;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // SETTINGSBASE_HPP
|
|
|
|
|