summaryrefslogtreecommitdiffhomepage
path: root/options/bundle.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-02-03 15:13:24 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-02-09 12:13:32 +0100
commit5d554656d7f2392a0c98a4474641f997c7b47543 (patch)
tree2dcec940f648d8c9cd20d89d6fd06f06a04840f4 /options/bundle.hpp
parent7dd05e0be7a1243d7f3026fadd3492eb054006fb (diff)
options, opentrack: fix migrations with tie_setting
Migrations only ran after `tie_setting()' handlers were done, clobbering the settings that were about to be migrated. Applying QSignalBlocker to few comboboxes isn't enough as it affects everything touched by `tie_setting()'. Split reload and notify phases in the options system.
Diffstat (limited to 'options/bundle.hpp')
-rw-r--r--options/bundle.hpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/options/bundle.hpp b/options/bundle.hpp
index 4c2b9781..c1bb716d 100644
--- a/options/bundle.hpp
+++ b/options/bundle.hpp
@@ -30,6 +30,7 @@
namespace options::detail {
class bundle;
+ struct bundler;
} // ns options::detail
namespace options {
@@ -44,11 +45,15 @@ class OTR_OPTIONS_EXPORT bundle final : public QObject, public connector
{
Q_OBJECT
+ friend struct bundler;
+
mutable QMutex mtx { QMutex::Recursive };
const QString group_name;
group saved;
group transient;
+ void reload_no_notify();
+
signals:
void reloading();
void saving() const;
@@ -68,6 +73,7 @@ public:
bool contains(const QString& name) const;
QVariant get_variant(const QString& name) const;
+ void notify();
public slots:
void save();
@@ -82,19 +88,25 @@ struct OTR_OPTIONS_EXPORT bundler final
using weak = std::weak_ptr<v>;
using shared = std::shared_ptr<v>;
- static void refresh_all_bundles();
+ static void notify();
+ static void reload_no_notify();
+
+ void reload();
private:
QMutex implsgl_mtx { QMutex::Recursive };
std::unordered_map<k, weak> implsgl_data {};
- void after_profile_changed_();
+ void notify_();
+ void reload_no_notify_();
+
+ void reload_();
- friend OTR_OPTIONS_EXPORT
+ friend
std::shared_ptr<v> options::make_bundle(const QString& name);
std::shared_ptr<v> make_bundle_(const k& key);
- static bundler& bundler_singleton();
+ static bundler& singleton();
bundler();
~bundler();