summaryrefslogtreecommitdiffhomepage
path: root/opentrack-compat/options.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-06-12 19:31:44 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-06-14 18:14:46 +0200
commit785e37b6164a6516a90b12aaa80c7c58fc6b9d21 (patch)
treeb55f5ab16726384336400d074e99c2e89e0c5f2d /opentrack-compat/options.hpp
parent04f78571de7e1138a9a3423bbb2d8d4ade1cd712 (diff)
compat/options: always do a full check of changes
Get rid of state variable and compare transient/saved state exactly. Marking the "modified" bit caused IO when changing and then changing back to the original value, then saving.
Diffstat (limited to 'opentrack-compat/options.hpp')
-rw-r--r--opentrack-compat/options.hpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/opentrack-compat/options.hpp b/opentrack-compat/options.hpp
index 40a4b0a6..76f36146 100644
--- a/opentrack-compat/options.hpp
+++ b/opentrack-compat/options.hpp
@@ -106,6 +106,8 @@ namespace options {
static QString ini_pathname();
static const QStringList ini_list();
static const mem<QSettings> ini_file();
+ bool operator==(const group& other) const;
+ bool operator!=(const group& other) const { return !(*this == other); }
template<typename t>
t get(const QString& k) const
@@ -125,7 +127,6 @@ namespace options {
const QString group_name;
group saved;
group transient;
- bool modified;
impl_bundle(const impl_bundle&) = delete;
impl_bundle& operator=(const impl_bundle&) = delete;
signals:
@@ -148,10 +149,15 @@ namespace options {
}
};
- class opt_bundle;
-
namespace detail
{
+ class OPENTRACK_COMPAT_EXPORT opt_bundle final : public impl_bundle
+ {
+ public:
+ opt_bundle(const QString& group_name);
+ ~opt_bundle();
+ };
+
struct OPENTRACK_COMPAT_EXPORT opt_singleton
{
public:
@@ -172,18 +178,10 @@ namespace options {
OPENTRACK_COMPAT_EXPORT opt_singleton& singleton();
}
- using pbundle = std::shared_ptr<opt_bundle>;
+ using pbundle = std::shared_ptr<detail::opt_bundle>;
pbundle bundle(const QString& name);
- class OPENTRACK_COMPAT_EXPORT opt_bundle final : public impl_bundle
- {
- public:
- opt_bundle() : impl_bundle("i-have-no-name") {}
- opt_bundle(const QString& group_name);
- ~opt_bundle();
- };
-
#define DEFINE_SLOT(t) void setValue(t datum) { store(datum); }
#define DEFINE_SIGNAL(t) void valueChanged(t)