summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/settings/qPrefPrivate.h84
1 files changed, 63 insertions, 21 deletions
diff --git a/core/settings/qPrefPrivate.h b/core/settings/qPrefPrivate.h
index d11e389d3..d4f60542c 100644
--- a/core/settings/qPrefPrivate.h
+++ b/core/settings/qPrefPrivate.h
@@ -29,10 +29,16 @@ extern QString keyFromGroupAndName(QString group, QString name);
#define DISK_LOADSYNC_BOOL_EXT(usegroup, name, field, usestruct) \
void qPref##usegroup::disk_##field(bool doSync) \
{ \
- if (doSync) \
- qPrefPrivate::propSetValue(keyFromGroupAndName(group, name), prefs.usestruct field, default_prefs.usestruct field); \
- else \
+ static bool current_state; \
+ if (doSync) { \
+ if (current_state != prefs.usestruct field) { \
+ current_state = prefs.usestruct field; \
+ qPrefPrivate::propSetValue(keyFromGroupAndName(group, name), prefs.usestruct field, default_prefs.usestruct field); \
+ } \
+ } else { \
prefs.usestruct field = qPrefPrivate::propValue(keyFromGroupAndName(group, name), default_prefs.usestruct field).toBool(); \
+ current_state = prefs.usestruct field; \
+ } \
}
#define DISK_LOADSYNC_BOOL(usegroup, name, field) \
DISK_LOADSYNC_BOOL_EXT(usegroup, name, field, )
@@ -40,10 +46,16 @@ extern QString keyFromGroupAndName(QString group, QString name);
#define DISK_LOADSYNC_DOUBLE_EXT(usegroup, name, field, usestruct) \
void qPref##usegroup::disk_##field(bool doSync) \
{ \
- if (doSync) \
- qPrefPrivate::propSetValue(keyFromGroupAndName(group, name), prefs.usestruct field, default_prefs.usestruct field); \
- else \
+ static double current_state; \
+ if (doSync) { \
+ if (current_state != prefs.usestruct field) { \
+ current_state = prefs.usestruct field; \
+ qPrefPrivate::propSetValue(keyFromGroupAndName(group, name), prefs.usestruct field, default_prefs.usestruct field); \
+ } \
+ } else { \
prefs.usestruct field = qPrefPrivate::propValue(keyFromGroupAndName(group, name), default_prefs.usestruct field).toDouble(); \
+ current_state = prefs.usestruct field; \
+ } \
}
#define DISK_LOADSYNC_DOUBLE(usegroup, name, field) \
DISK_LOADSYNC_DOUBLE_EXT(usegroup, name, field, )
@@ -51,10 +63,16 @@ extern QString keyFromGroupAndName(QString group, QString name);
#define DISK_LOADSYNC_ENUM_EXT(usegroup, name, type, field, usestruct) \
void qPref##usegroup::disk_##field(bool doSync) \
{ \
- if (doSync) \
- qPrefPrivate::propSetValue(keyFromGroupAndName(group, name), prefs.usestruct field, default_prefs.usestruct field); \
- else \
+ static enum type current_state; \
+ if (doSync) { \
+ if (current_state != prefs.usestruct field) { \
+ current_state = prefs.usestruct field; \
+ qPrefPrivate::propSetValue(keyFromGroupAndName(group, name), prefs.usestruct field, default_prefs.usestruct field); \
+ } \
+ } else { \
prefs.usestruct field = (enum type)qPrefPrivate::propValue(keyFromGroupAndName(group, name), default_prefs.usestruct field).toInt(); \
+ current_state = prefs.usestruct field; \
+ } \
}
#define DISK_LOADSYNC_ENUM(usegroup, name, type, field) \
DISK_LOADSYNC_ENUM_EXT(usegroup, name, type, field, )
@@ -62,10 +80,16 @@ extern QString keyFromGroupAndName(QString group, QString name);
#define DISK_LOADSYNC_INT_EXT(usegroup, name, field, usestruct) \
void qPref##usegroup::disk_##field(bool doSync) \
{ \
- if (doSync) \
- qPrefPrivate::propSetValue(keyFromGroupAndName(group, name), prefs.usestruct field, default_prefs.usestruct field); \
- else \
+ static int current_state; \
+ if (doSync) { \
+ if (current_state != prefs.usestruct field) { \
+ current_state = prefs.usestruct field; \
+ qPrefPrivate::propSetValue(keyFromGroupAndName(group, name), prefs.usestruct field, default_prefs.usestruct field); \
+ } \
+ } else { \
prefs.usestruct field = qPrefPrivate::propValue(keyFromGroupAndName(group, name), default_prefs.usestruct field).toInt(); \
+ current_state = prefs.usestruct field; \
+ } \
}
#define DISK_LOADSYNC_INT(usegroup, name, field) \
DISK_LOADSYNC_INT_EXT(usegroup, name, field, )
@@ -73,10 +97,16 @@ extern QString keyFromGroupAndName(QString group, QString name);
#define DISK_LOADSYNC_INT_DEF_EXT(usegroup, name, field, defval, usestruct) \
void qPref##usegroup::disk_##field(bool doSync) \
{ \
- if (doSync) \
- qPrefPrivate::propSetValue(keyFromGroupAndName(group, name), prefs.usestruct field, default_prefs.usestruct field); \
- else \
+ static int current_state; \
+ if (doSync) { \
+ if (current_state != prefs.usestruct field) { \
+ current_state = prefs.usestruct field; \
+ qPrefPrivate::propSetValue(keyFromGroupAndName(group, name), prefs.usestruct field, default_prefs.usestruct field); \
+ } \
+ } else { \
prefs.usestruct field = qPrefPrivate::propValue(keyFromGroupAndName(group, name), defval).toInt(); \
+ current_state = prefs.usestruct field; \
+ } \
}
#define DISK_LOADSYNC_INT_DEF(usegroup, name, field, defval) \
DISK_LOADSYNC_INT_DEF_EXT(usegroup, name, field, defval, )
@@ -84,10 +114,16 @@ extern QString keyFromGroupAndName(QString group, QString name);
#define DISK_LOADSYNC_STRUCT_EXT(usegroup, name, field, var, usestruct) \
void qPref##usegroup::disk_##field(bool doSync) \
{ \
- if (doSync) \
- qPrefPrivate::propSetValue(keyFromGroupAndName(group, name), prefs.usestruct field . var, default_prefs.usestruct field . var); \
- else \
+ static int current_state; \
+ if (doSync) { \
+ if (current_state != prefs.usestruct field . var) { \
+ current_state = prefs.usestruct field . var; \
+ qPrefPrivate::propSetValue(keyFromGroupAndName(group, name), prefs.usestruct field . var, default_prefs.usestruct field . var); \
+ } \
+ } else { \
prefs.usestruct field . var = qPrefPrivate::propValue(keyFromGroupAndName(group, name), default_prefs.usestruct field . var).toInt(); \
+ current_state = prefs.usestruct field . var; \
+ } \
}
#define DISK_LOADSYNC_STRUCT(usegroup, name, field, var) \
DISK_LOADSYNC_STRUCT_EXT(usegroup, name, field, var, )
@@ -95,10 +131,16 @@ extern QString keyFromGroupAndName(QString group, QString name);
#define DISK_LOADSYNC_TXT_EXT(usegroup, name, field, usestruct) \
void qPref##usegroup::disk_##field(bool doSync) \
{ \
- if (doSync) \
- qPrefPrivate::propSetValue(keyFromGroupAndName(group, name), prefs.usestruct field, default_prefs.usestruct field); \
- else \
+ static QString current_state; \
+ if (doSync) { \
+ if (current_state != QString(prefs.usestruct field)) { \
+ current_state = QString(prefs.usestruct field); \
+ qPrefPrivate::propSetValue(keyFromGroupAndName(group, name), prefs.usestruct field, default_prefs.usestruct field); \
+ } \
+ } else { \
prefs.usestruct field = copy_qstring(qPrefPrivate::propValue(keyFromGroupAndName(group, name), default_prefs.usestruct field).toString()); \
+ current_state = QString(prefs.usestruct field); \
+ } \
}
#define DISK_LOADSYNC_TXT(usegroup, name, field) \
DISK_LOADSYNC_TXT_EXT(usegroup, name, field, )