diff options
-rw-r--r-- | options/globals.cpp | 6 | ||||
-rw-r--r-- | options/group.cpp | 9 |
2 files changed, 9 insertions, 6 deletions
diff --git a/options/globals.cpp b/options/globals.cpp index 5f1bda67..0f0e536b 100644 --- a/options/globals.cpp +++ b/options/globals.cpp @@ -117,7 +117,7 @@ QString ini_pathname() const auto dir = ini_directory(); if (dir.isEmpty()) return {}; - return dir + "/" + ini_filename(); + return dir + QStringLiteral("/") + ini_filename(); } QString ini_combine(const QString& filename) @@ -129,9 +129,9 @@ QStringList ini_list() { const auto dirname = ini_directory(); if (dirname == "") - return QStringList(); + return {}; QDir settings_dir(dirname); - QStringList list = settings_dir.entryList( QStringList { "*.ini" } , QDir::Files, QDir::Name ); + QStringList list = settings_dir.entryList( QStringList { QStringLiteral("*.ini") } , QDir::Files, QDir::Name ); std::sort(list.begin(), list.end()); return list; } diff --git a/options/group.cpp b/options/group.cpp index 8a0eeb03..41655d5e 100644 --- a/options/group.cpp +++ b/options/group.cpp @@ -50,12 +50,15 @@ void group::save() const }); } -void group::put(const QString &s, const QVariant &d) +void group::put(const QString& s, const QVariant& d) { - kvs[s] = d; + if (d.isNull()) + kvs.erase(s); + else + kvs[s] = d; } -bool group::contains(const QString &s) const +bool group::contains(const QString& s) const { const auto it = kvs.find(s); return it != kvs.cend(); |