diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-07-08 23:29:49 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-07-08 23:29:49 +0200 |
commit | fa1801471c2708ed8266ec7b99bd4cec886ccc1b (patch) | |
tree | aa56218c2c7e4939aaf11a2046b0f12760326545 /options/bundle.cpp | |
parent | 90940a774eab876c38d5cef981b4be5bae67a462 (diff) |
options: fix 2 issues
1. Calling valueChanged didn't invoke machinery in
value<t>, only base_value aka value_.
There's a fast path in value<t>::type() despite the
pessimization.
2. Split global scope stuff into options::globals from
the options::globals stuff
3. Adjust usages
Diffstat (limited to 'options/bundle.cpp')
-rw-r--r-- | options/bundle.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/options/bundle.cpp b/options/bundle.cpp index b722338b..c426dd2e 100644 --- a/options/bundle.cpp +++ b/options/bundle.cpp @@ -8,11 +8,13 @@ #include "bundle.hpp" #include "value.hpp" +#include "globals.hpp" #include <QThread> #include <QApplication> -using options::value_; +using namespace options; +using namespace options::globals; namespace options::detail { @@ -24,9 +26,7 @@ bundle::bundle(const QString& group_name) { } -bundle::~bundle() -{ -} +bundle::~bundle() = default; void bundle::reload() { @@ -53,19 +53,23 @@ void bundle::set_all_to_default() forall([](const QString&, value_* val) { set_base_value_to_default(val); }); if (is_modified()) - group::mark_ini_modified(); + mark_ini_modified(); } -void bundle::store_kv(const QString& name, const QVariant& datum) +void bundle::store_kv(const QString& name, const QVariant& new_value) { QMutexLocker l(&mtx); - transient.put(name, datum); - - if (group_name.size()) - connector::notify_values(name); - - emit changed(); + if (!group_name.isEmpty()) + { + const QVariant old_value = transient.get_variant(name); + if (!connector::is_equal(name, old_value, new_value)) + { + transient.put(name, new_value); + connector::notify_values(name); + emit changed(); + } + } } bool bundle::contains(const QString &name) const @@ -152,14 +156,8 @@ void bundler::refresh_all_bundles() bundler_singleton().after_profile_changed_(); } -bundler::bundler() : implsgl_mtx(QMutex::Recursive) -{ -} - -bundler::~bundler() -{ - //qDebug() << "exit: bundle singleton"; -} +bundler::bundler() = default; +bundler::~bundler() = default; std::shared_ptr<bundler::v> bundler::make_bundle_(const bundler::k& key) { |