diff options
-rw-r--r-- | options/bundle.cpp | 8 | ||||
-rw-r--r-- | options/bundle.hpp | 2 | ||||
-rw-r--r-- | options/group.cpp | 7 |
3 files changed, 11 insertions, 6 deletions
diff --git a/options/bundle.cpp b/options/bundle.cpp index 61be509a..876599ce 100644 --- a/options/bundle.cpp +++ b/options/bundle.cpp @@ -20,12 +20,12 @@ bundle::~bundle() { } -void bundle::reload() +void bundle::reload(std::shared_ptr<QSettings> settings) { if (group_name.size()) { QMutexLocker l(&mtx); - saved = group(group_name); + saved = group(group_name, settings); const bool has_changes = is_modified(false); transient = saved; @@ -128,6 +128,8 @@ void bundler::after_profile_changed_() { QMutexLocker l(&implsgl_mtx); + std::shared_ptr<QSettings> s = group::ini_file(); + for (auto& kv : implsgl_data) { tt& tuple = kv.second; @@ -137,7 +139,7 @@ void bundler::after_profile_changed_() if (bundle_) { //qDebug() << "bundle: reverting" << kv.first << "due to profile change"; - bundle_->reload(); + bundle_->reload(s); } } } diff --git a/options/bundle.hpp b/options/bundle.hpp index 3d75a8de..b1c93b3d 100644 --- a/options/bundle.hpp +++ b/options/bundle.hpp @@ -56,7 +56,7 @@ public: bundle(const QString& group_name); ~bundle() override; QString name() { return group_name; } - void reload(); + void reload(std::shared_ptr<QSettings> settings = group::ini_file()); void store_kv(const QString& name, const QVariant& datum); bool contains(const QString& name) const; void save(); diff --git a/options/group.cpp b/options/group.cpp index 69b79cef..94e111aa 100644 --- a/options/group.cpp +++ b/options/group.cpp @@ -6,12 +6,11 @@ namespace options { -group::group(const QString& name) : name(name) +group::group(const QString& name, std::shared_ptr<QSettings> conf) : name(name) { if (name == "") return; - auto conf = ini_file(); conf->beginGroup(name); for (auto& k_ : conf->childKeys()) { @@ -22,6 +21,10 @@ group::group(const QString& name) : name(name) conf->endGroup(); } +group::group(const QString& name) : group(name, ini_file()) +{ +} + void group::save() const { save_deferred(*ini_file()); |