diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-10-05 15:54:01 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-10-05 14:35:29 +0000 |
commit | f0216a3c53d43918295f1bd81975b391f4e5ed3b (patch) | |
tree | b6311d48559bbdb4b657beed1bd8164d9157b03f /options/group.cpp | |
parent | 39ea3871c1b3f594df846bc0b9a627c9880ecea4 (diff) |
options: don't use typeindex w/ lambdas
Rename traits' functions to be more explicit.
Most of the changes are pretty old and I can't read
them at this time, sorry.
Adjust usages.
Issue: #825
Reported-by: @DanielKinsman
Diffstat (limited to 'options/group.cpp')
-rw-r--r-- | options/group.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/options/group.cpp b/options/group.cpp index 5f6c3232..af66aaf2 100644 --- a/options/group.cpp +++ b/options/group.cpp @@ -14,9 +14,7 @@ #include <algorithm> #include <QFile> - #include <QDir> -#include <QDebug> namespace options::detail { @@ -29,14 +27,8 @@ group::group(const QString& name) : name(name) with_settings_object([&](QSettings& conf) { conf.beginGroup(name); - for (auto& k_ : conf.childKeys()) - { - auto tmp = k_.toUtf8(); - QString k(tmp); - QVariant val = conf.value(k_); - if (val.type() != QVariant::Invalid) - kvs[k] = std::move(val); - } + for (auto const& k : conf.childKeys()) + kvs[k] = conf.value(k); conf.endGroup(); }); } @@ -48,11 +40,9 @@ void group::save() const with_settings_object([&](QSettings& s) { s.beginGroup(name); - for (auto& i : kvs) + for (auto const& i : kvs) s.setValue(i.first, i.second); s.endGroup(); - - mark_ini_modified(); }); } @@ -64,7 +54,7 @@ void group::put(const QString &s, const QVariant &d) bool group::contains(const QString &s) const { const auto it = kvs.find(s); - return it != kvs.cend() && it->second != QVariant::Invalid; + return it != kvs.cend(); } QVariant group::get_variant(const QString& name) const @@ -73,7 +63,7 @@ QVariant group::get_variant(const QString& name) const if (it != kvs.cend()) return it->second; - return {}; + return QVariant(); } } // ns options::detail |