diff options
-rw-r--r-- | compat/options.cpp | 23 | ||||
-rw-r--r-- | compat/options.hpp | 2 |
2 files changed, 25 insertions, 0 deletions
diff --git a/compat/options.cpp b/compat/options.cpp index 8c6e6c65..9ff696ac 100644 --- a/compat/options.cpp +++ b/compat/options.cpp @@ -204,6 +204,29 @@ void opt_singleton::bundle_decf(const opt_singleton::k& key) } } +void opt_singleton::after_profile_changed_() +{ + QMutexLocker l(&implsgl_mtx); + + for (auto& kv : implsgl_data) + { + tt& tuple = kv.second; + std::weak_ptr<v>& bundle = std::get<1>(tuple); + + mem<v> bundle_ = bundle.lock(); + if (bundle_) + { + qDebug() << "bundle: reverting" << kv.first << "due to profile change"; + bundle_->reload(); + } + } +} + +void opt_singleton::refresh_all_bundles() +{ + singleton().after_profile_changed_(); +} + opt_singleton::opt_singleton() : implsgl_mtx(QMutex::Recursive) { } diff --git a/compat/options.hpp b/compat/options.hpp index 40aca2de..432ed52a 100644 --- a/compat/options.hpp +++ b/compat/options.hpp @@ -139,10 +139,12 @@ namespace options { private: QMutex implsgl_mtx; map<k, tt> implsgl_data; + void after_profile_changed_(); public: opt_singleton(); pbundle bundle(const k& key); void bundle_decf(const k& key); + static void refresh_all_bundles(); }; OPENTRACK_COMPAT_EXPORT opt_singleton& singleton(); |