diff options
-rw-r--r-- | options/bundle.cpp | 20 | ||||
-rw-r--r-- | options/bundle.hpp | 5 | ||||
-rw-r--r-- | options/connector.cpp | 6 |
3 files changed, 23 insertions, 8 deletions
diff --git a/options/bundle.cpp b/options/bundle.cpp index a080bb77..83981ddf 100644 --- a/options/bundle.cpp +++ b/options/bundle.cpp @@ -19,14 +19,15 @@ bundle::bundle(const QString& group_name) void bundle::reload() { + if (group_name.size()) { QMutexLocker l(&mtx); saved = group(group_name); transient = saved; connector::notify_all_values(); + emit reloading(); } - emit reloading(); } void bundle::store_kv(const QString& name, const QVariant& datum) @@ -35,7 +36,8 @@ void bundle::store_kv(const QString& name, const QVariant& datum) transient.put(name, datum); - connector::notify_values(name); + if (group_name.size()) + connector::notify_values(name); } bool bundle::contains(const QString &name) const @@ -46,7 +48,7 @@ bool bundle::contains(const QString &name) const void bundle::save_deferred(QSettings& s) { - if (group_name == "") + if (group_name.size() == 0) return; bool modified_ = false; @@ -146,7 +148,17 @@ OPENTRACK_OPTIONS_EXPORT bundler& singleton() return ret; } -} // end options::detail +} + +// end options::detail + +OPENTRACK_OPTIONS_EXPORT bundle make_bundle(const QString& name) +{ + if (name.size()) + return detail::singleton().make_bundle(name); + else + return std::make_shared<bundle_type>(QStringLiteral("")); +} } // end options diff --git a/options/bundle.hpp b/options/bundle.hpp index 841df273..a948ac44 100644 --- a/options/bundle.hpp +++ b/options/bundle.hpp @@ -84,9 +84,6 @@ OPENTRACK_OPTIONS_EXPORT bundler& singleton(); using bundle_type = detail::bundle; using bundle = std::shared_ptr<bundle_type>; -inline bundle make_bundle(const QString& name) -{ - return detail::singleton().make_bundle(name); -} +OPENTRACK_OPTIONS_EXPORT bundle make_bundle(const QString& name); } diff --git a/options/connector.cpp b/options/connector.cpp index c1bbce39..680283cf 100644 --- a/options/connector.cpp +++ b/options/connector.cpp @@ -36,6 +36,9 @@ bool connector::on_value_destructed_impl(const QString& name, const base_value* void connector::on_value_destructed(const QString& name, const base_value* val) { + if (!name.size()) + return; + const bool ok = on_value_destructed_impl(name, val); if (!ok) @@ -48,6 +51,9 @@ void connector::on_value_destructed(const QString& name, const base_value* val) void connector::on_value_created(const QString& name, const base_value* val) { + if (!name.size()) + return; + QMutexLocker l(get_mtx()); if (on_value_destructed_impl(name, val)) |