diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-07-05 10:20:26 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-07-05 10:24:19 +0200 |
commit | 6e86249bd8cc6d707756ef79ac9d02c429a2db06 (patch) | |
tree | 04e73d5c9506747dee6156abddf83c245d9a35a6 | |
parent | efe55a71f80c9abdf9087620b6d195b85870e92c (diff) |
options: fix global ini not saving on Linux
-rw-r--r-- | gui/process_detector.cpp | 2 | ||||
-rw-r--r-- | gui/settings.cpp | 1 | ||||
-rw-r--r-- | migration/20180102_00-process-detector-separator.cpp | 1 | ||||
-rw-r--r-- | migration/migration.cpp | 2 | ||||
-rw-r--r-- | opentrack/main-window.cpp | 1 | ||||
-rw-r--r-- | options/bundle.cpp | 2 | ||||
-rw-r--r-- | options/globals.cpp | 11 | ||||
-rw-r--r-- | options/globals.hpp | 5 |
8 files changed, 19 insertions, 6 deletions
diff --git a/gui/process_detector.cpp b/gui/process_detector.cpp index b17d5dd0..85333849 100644 --- a/gui/process_detector.cpp +++ b/gui/process_detector.cpp @@ -30,6 +30,7 @@ void proc_detector_settings::set_game_list(const QString &game_list) { with_global_settings_object([&](QSettings& settings) { settings.setValue("executable-list", game_list); + mark_global_ini_modified(); }); } @@ -51,6 +52,7 @@ void proc_detector_settings::set_is_enabled(bool enabled) { with_global_settings_object([&](QSettings& settings) { settings.setValue("executable-detector-enabled", enabled); + mark_global_ini_modified(); }); } diff --git a/gui/settings.cpp b/gui/settings.cpp index 79a8dbfb..230c4410 100644 --- a/gui/settings.cpp +++ b/gui/settings.cpp @@ -42,6 +42,7 @@ void options_dialog::set_disable_translation_state(bool value) with_global_settings_object([&](QSettings& s) { s.setValue("disable-translation", value); + mark_global_ini_modified(); }); } diff --git a/migration/20180102_00-process-detector-separator.cpp b/migration/20180102_00-process-detector-separator.cpp index 8d0fa280..3656bf73 100644 --- a/migration/20180102_00-process-detector-separator.cpp +++ b/migration/20180102_00-process-detector-separator.cpp @@ -42,6 +42,7 @@ struct process_detector_record_separator : migration value.replace(OLD_UNIT_SEPARATOR, NEW_UNIT_SEPARATOR); value.replace(OLD_RECORD_SEPARATOR, NEW_RECORD_SEPARATOR); s.setValue(KEY_NAME, value); + mark_global_ini_modified(); }); } }; diff --git a/migration/migration.cpp b/migration/migration.cpp index 34882390..4ddb2c8c 100644 --- a/migration/migration.cpp +++ b/migration/migration.cpp @@ -133,7 +133,7 @@ void migrator::set_last_migration_time(const QString& val) if (val != old_value) { s.setValue("last-migration-at", val); - mark_ini_modified(); + options::globals::detail::mark_ini_modified(); } s.endGroup(); }); diff --git a/opentrack/main-window.cpp b/opentrack/main-window.cpp index 6d2267b0..14f0e1ab 100644 --- a/opentrack/main-window.cpp +++ b/opentrack/main-window.cpp @@ -852,6 +852,7 @@ void main_window::set_profile_in_registry(const QString &profile) { with_global_settings_object([&](QSettings& s) { s.setValue(OPENTRACK_PROFILE_FILENAME_KEY, profile); + mark_global_ini_modified(); }); } diff --git a/options/bundle.cpp b/options/bundle.cpp index 20cc5d90..517005f0 100644 --- a/options/bundle.cpp +++ b/options/bundle.cpp @@ -73,7 +73,7 @@ void bundle::store_kv(const QString& name, QVariant&& value) return; { - mark_ini_modified(); + options::globals::detail::mark_ini_modified(); QMutexLocker l{&mtx}; transient.put(name, value); connector::notify_values(name); diff --git a/options/globals.cpp b/options/globals.cpp index 21aa4b4c..52e198db 100644 --- a/options/globals.cpp +++ b/options/globals.cpp @@ -76,6 +76,13 @@ ini_ctx& global_settings() return ret; } +void mark_ini_modified(bool value) +{ + auto& ini = cur_settings(); + ini.modifiedp = value; + ini.mtx.unlock(); +} + } // ns options::globals::detail namespace options::globals @@ -124,9 +131,9 @@ QStringList ini_list() return list; } -void mark_ini_modified(bool value) +void mark_global_ini_modified(bool value) { - auto& ini = cur_settings(); + auto& ini = global_settings(); ini.modifiedp = value; ini.mtx.unlock(); } diff --git a/options/globals.hpp b/options/globals.hpp index 9eb5777f..7af6533d 100644 --- a/options/globals.hpp +++ b/options/globals.hpp @@ -45,12 +45,13 @@ auto with_settings_object_(ini_ctx& ini, F&& fun) OTR_OPTIONS_EXPORT ini_ctx& cur_settings(); OTR_OPTIONS_EXPORT ini_ctx& global_settings(); +OTR_OPTIONS_EXPORT void mark_ini_modified(bool value = true); + } // ns options::globals::detail namespace options::globals { - OTR_OPTIONS_EXPORT void mark_ini_modified(bool value = true); - OTR_OPTIONS_EXPORT bool is_ini_modified(); + OTR_OPTIONS_EXPORT void mark_global_ini_modified(bool value = true); OTR_OPTIONS_EXPORT QString ini_directory(); OTR_OPTIONS_EXPORT QString ini_filename(); OTR_OPTIONS_EXPORT QString ini_pathname(); |