diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-10-05 15:54:01 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-10-05 14:35:29 +0000 |
commit | f0216a3c53d43918295f1bd81975b391f4e5ed3b (patch) | |
tree | b6311d48559bbdb4b657beed1bd8164d9157b03f /options/globals.hpp | |
parent | 39ea3871c1b3f594df846bc0b9a627c9880ecea4 (diff) |
options: don't use typeindex w/ lambdas
Rename traits' functions to be more explicit.
Most of the changes are pretty old and I can't read
them at this time, sorry.
Adjust usages.
Issue: #825
Reported-by: @DanielKinsman
Diffstat (limited to 'options/globals.hpp')
-rw-r--r-- | options/globals.hpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/options/globals.hpp b/options/globals.hpp index 4d74cbf0..8032e5d8 100644 --- a/options/globals.hpp +++ b/options/globals.hpp @@ -11,20 +11,18 @@ namespace options::globals::detail { -struct ini_ctx; struct saver_; -OTR_OPTIONS_EXPORT ini_ctx& cur_settings(); -OTR_OPTIONS_EXPORT ini_ctx& global_settings(); -OTR_OPTIONS_EXPORT bool is_portable_installation(); - -struct ini_ctx +struct OTR_OPTIONS_EXPORT ini_ctx { std::optional<QSettings> qsettings { std::in_place }; + QString pathname; + QMutex mtx { QMutex::Recursive }; + int refcount = 0; bool modifiedp = false; - QMutex mtx { QMutex::Recursive }; - QString pathname; + + ini_ctx(); }; struct OTR_OPTIONS_EXPORT saver_ final @@ -44,11 +42,16 @@ auto with_settings_object_(ini_ctx& ini, F&& fun) return fun(*ini.qsettings); } +OTR_OPTIONS_EXPORT ini_ctx& cur_settings(); +OTR_OPTIONS_EXPORT ini_ctx& global_settings(); +OTR_OPTIONS_EXPORT bool is_portable_installation(); + } // ns options::globals::detail namespace options::globals { - OTR_OPTIONS_EXPORT void mark_ini_modified(); + OTR_OPTIONS_EXPORT void mark_ini_modified(bool value = true); + OTR_OPTIONS_EXPORT bool is_ini_modified(); OTR_OPTIONS_EXPORT QString ini_directory(); OTR_OPTIONS_EXPORT QString ini_filename(); OTR_OPTIONS_EXPORT QString ini_pathname(); |