diff options
author | Robert C. Helling <helling@atdotde.de> | 2017-09-18 16:10:47 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-09-20 08:54:41 -0700 |
commit | a6f186279fcce9631623b94bfdc00fa3fd071b4c (patch) | |
tree | 22e907959336c94887f210da14f7fc5c54496b6d /core | |
parent | 5e9bdce195c1ec3ca077ce75cf2c0a221d6029de (diff) | |
download | subsurface-a6f186279fcce9631623b94bfdc00fa3fd071b4c.tar.gz |
Add a checkbox to turn off plan variations
... as those come with a performance penalty
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core')
-rw-r--r-- | core/plannernotes.c | 9 | ||||
-rw-r--r-- | core/pref.h | 1 | ||||
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.cpp | 19 | ||||
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.h | 4 | ||||
-rw-r--r-- | core/subsurfacestartup.c | 1 |
5 files changed, 32 insertions, 2 deletions
diff --git a/core/plannernotes.c b/core/plannernotes.c index 414236a1e..68c9bae25 100644 --- a/core/plannernotes.c +++ b/core/plannernotes.c @@ -101,8 +101,13 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d get_current_date()); } - len += snprintf(buffer + len, sz_buffer - len, translate("gettextFromC", "Runtime: %dmin VARIATIONS<br></div>"), - diveplan_duration(diveplan)); + if (prefs.display_variations) + len += snprintf(buffer + len, sz_buffer - len, translate("gettextFromC", "Runtime: %dmin VARIATIONS<br></div>"), + diveplan_duration(diveplan)); + else + len += snprintf(buffer + len, sz_buffer - len, translate("gettextFromC", "Runtime: %dmin<br></div>"), + diveplan_duration(diveplan)); + if (!plan_verbatim) { len += snprintf(buffer + len, sz_buffer - len, "<table><thead><tr><th></th><th>%s</th>", diff --git a/core/pref.h b/core/pref.h index f22999981..515225dd4 100644 --- a/core/pref.h +++ b/core/pref.h @@ -126,6 +126,7 @@ struct preferences { bool display_runtime; bool display_duration; bool display_transitions; + bool display_variations; bool safetystop; bool switch_at_req_stop; int reserve_gas; diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp index 25161a904..720a887d6 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/core/subsurface-qt/SettingsObjectWrapper.cpp @@ -1214,6 +1214,11 @@ bool DivePlannerSettings::displayTransitions() const return prefs.display_transitions; } +bool DivePlannerSettings::displayVariations() const +{ + return prefs.display_variations; +} + bool DivePlannerSettings::doo2breaks() const { return prefs.doo2breaks; @@ -1368,6 +1373,18 @@ void DivePlannerSettings::setDisplayTransitions(bool value) emit displayTransitionsChanged(value); } +void DivePlannerSettings::setDisplayVariations(bool value) +{ + if (value == prefs.display_variations) + return; + + QSettings s; + s.beginGroup(group); + s.setValue("display_variations", value); + prefs.display_variations = value; + emit displayVariationsChanged(value); +} + void DivePlannerSettings::setDoo2breaks(bool value) { if (value == prefs.doo2breaks) @@ -2339,6 +2356,7 @@ void SettingsObjectWrapper::load() GET_BOOL("display_duration", display_duration); GET_BOOL("display_runtime", display_runtime); GET_BOOL("display_transitions", display_transitions); + GET_BOOL("display_variations", display_variations); GET_BOOL("safetystop", safetystop); GET_BOOL("doo2breaks", doo2breaks); GET_BOOL("switch_at_req_stop",switch_at_req_stop); @@ -2397,6 +2415,7 @@ void SettingsObjectWrapper::sync() s.setValue("display_duration", prefs.display_duration); s.setValue("display_runtime", prefs.display_runtime); s.setValue("display_transitions", prefs.display_transitions); + s.setValue("display_variations", prefs.display_variations); s.setValue("safetystop", prefs.safetystop); s.setValue("reserve_gas", prefs.reserve_gas); s.setValue("ascrate75", prefs.ascrate75); diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h index 7116e682e..824d1023d 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.h +++ b/core/subsurface-qt/SettingsObjectWrapper.h @@ -398,6 +398,7 @@ class DivePlannerSettings : public QObject { Q_PROPERTY(bool display_runtime READ displayRuntime WRITE setDisplayRuntime NOTIFY displayRuntimeChanged) Q_PROPERTY(bool display_duration READ displayDuration WRITE setDisplayDuration NOTIFY displayDurationChanged) Q_PROPERTY(bool display_transitions READ displayTransitions WRITE setDisplayTransitions NOTIFY displayTransitionsChanged) + Q_PROPERTY(bool display_variations READ displayVariations WRITE setDisplayVariations NOTIFY displayVariationsChanged) Q_PROPERTY(bool doo2breaks READ doo2breaks WRITE setDoo2breaks NOTIFY doo2breaksChanged) Q_PROPERTY(bool drop_stone_mode READ dropStoneMode WRITE setDropStoneMode NOTIFY dropStoneModeChanged) Q_PROPERTY(bool safetystop READ safetyStop WRITE setSafetyStop NOTIFY safetyStopChanged) @@ -425,6 +426,7 @@ public: bool displayRuntime() const; bool displayDuration() const; bool displayTransitions() const; + bool displayVariations() const; bool doo2breaks() const; bool dropStoneMode() const; bool safetyStop() const; @@ -451,6 +453,7 @@ public slots: void setDisplayRuntime(bool value); void setDisplayDuration(bool value); void setDisplayTransitions(bool value); + void setDisplayVariations(bool value); void setDoo2breaks(bool value); void setDropStoneMode(bool value); void setSafetyStop(bool value); @@ -477,6 +480,7 @@ signals: void displayRuntimeChanged(bool value); void displayDurationChanged(bool value); void displayTransitionsChanged(bool value); + void displayVariationsChanged(bool value); void doo2breaksChanged(bool value); void dropStoneModeChanged(bool value); void safetyStopChanged(bool value); diff --git a/core/subsurfacestartup.c b/core/subsurfacestartup.c index b0d621b20..7bb3c2784 100644 --- a/core/subsurfacestartup.c +++ b/core/subsurfacestartup.c @@ -66,6 +66,7 @@ struct preferences default_prefs = { .display_runtime = true, .display_duration = true, .display_transitions = true, + .display_variations = false, .safetystop = true, .bottomsac = 20000, .decosac = 17000, |