summaryrefslogtreecommitdiffstats
path: root/core/settings
diff options
context:
space:
mode:
authorGravatar Jan Mulder <jlmulder@xs4all.nl>2018-10-16 19:35:01 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-19 06:25:32 -0400
commit66c4397efd2d825a61e0dab534cb590c8fea4440 (patch)
treeefe171463666e3f0c057e17d95c7b0a77692b0ce /core/settings
parent0416e54049da87d834c5102c63c4a9f377c55586 (diff)
downloadsubsurface-66c4397efd2d825a61e0dab534cb590c8fea4440.tar.gz
Preferences: wire-up the deco parameters
The deco parameters need special treatment to wire them up to the underlying deco model code. And with the new preferences setup this is a lot of boilerplate. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'core/settings')
-rw-r--r--core/settings/qPrefTechnicalDetails.cpp60
1 files changed, 57 insertions, 3 deletions
diff --git a/core/settings/qPrefTechnicalDetails.cpp b/core/settings/qPrefTechnicalDetails.cpp
index d0c00cd24..fcc77863a 100644
--- a/core/settings/qPrefTechnicalDetails.cpp
+++ b/core/settings/qPrefTechnicalDetails.cpp
@@ -64,9 +64,45 @@ HANDLE_PREFERENCE_BOOL(TechnicalDetails, "display_unused_tanks", display_unused_
HANDLE_PREFERENCE_BOOL(TechnicalDetails, "ead", ead);
-HANDLE_PREFERENCE_INT(TechnicalDetails, "gfhigh", gfhigh);
+void qPrefTechnicalDetails::set_gfhigh(int value)
+{
+ if (value != prefs.gfhigh) {
+ prefs.gfhigh = value;
+ disk_gfhigh(true);
+ emit instance()->gfhighChanged(value);
+ }
+}
+
+void qPrefTechnicalDetails::disk_gfhigh(bool doSync)
+{
+ if (doSync) {
+ if (prefs.gfhigh)
+ qPrefPrivate::propSetValue(keyFromGroupAndName(group, "gfhigh"), prefs.gfhigh, default_prefs.gfhigh);
+ } else {
+ prefs.gfhigh = qPrefPrivate::propValue(keyFromGroupAndName(group, "gfhigh"), default_prefs.gfhigh).toInt();
+ set_gf(-1, prefs.gfhigh);
+ }
+}
-HANDLE_PREFERENCE_INT(TechnicalDetails, "gflow", gflow);
+void qPrefTechnicalDetails::set_gflow(int value)
+{
+ if (value != prefs.gflow) {
+ prefs.gflow = value;
+ disk_gflow(true);
+ emit instance()->gflowChanged(value);
+ }
+}
+
+void qPrefTechnicalDetails::disk_gflow(bool doSync)
+{
+ if (doSync) {
+ if (prefs.gflow)
+ qPrefPrivate::propSetValue(keyFromGroupAndName(group, "gflow"), prefs.gflow, default_prefs.gflow);
+ } else {
+ prefs.gflow = qPrefPrivate::propValue(keyFromGroupAndName(group, "gflow"), default_prefs.gflow).toInt();
+ set_gf(prefs.gflow, -1);
+ }
+}
HANDLE_PREFERENCE_BOOL(TechnicalDetails, "gf_low_at_maxdepth", gf_low_at_maxdepth);
@@ -98,6 +134,24 @@ HANDLE_PREFERENCE_BOOL(TechnicalDetails, "show_scr_ocpo2", show_scr_ocpo2);
HANDLE_PREFERENCE_BOOL(TechnicalDetails, "tankbar", tankbar);
-HANDLE_PREFERENCE_INT(TechnicalDetails, "vpmb_conservatism", vpmb_conservatism);
+void qPrefTechnicalDetails::set_vpmb_conservatism(int value)
+{
+ if (value != prefs.vpmb_conservatism) {
+ prefs.vpmb_conservatism = value;
+ disk_vpmb_conservatism(true);
+ emit instance()->vpmb_conservatismChanged(value);
+ }
+}
+
+void qPrefTechnicalDetails::disk_vpmb_conservatism(bool doSync)
+{
+ if (doSync) {
+ if (prefs.vpmb_conservatism)
+ qPrefPrivate::propSetValue(keyFromGroupAndName(group, "vpmb_conservatism"), prefs.vpmb_conservatism, default_prefs.vpmb_conservatism);
+ } else {
+ prefs.vpmb_conservatism = qPrefPrivate::propValue(keyFromGroupAndName(group, "vpmb_conservatism"), default_prefs.vpmb_conservatism).toInt();
+ set_vpmb_conservatism(prefs.vpmb_conservatism);
+ }
+}
HANDLE_PREFERENCE_BOOL(TechnicalDetails, "zoomed_plot", zoomed_plot);