summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2019-03-25 22:40:59 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-03-29 06:51:12 -0700
commit178eaa9a67f73195aac0ad195a428e899973a2df (patch)
tree91f20a2882961184513fea59866aaa34c08e823d /core
parent5e494ce76106fe16f614e163c2bc6b8bf6903c86 (diff)
downloadsubsurface-178eaa9a67f73195aac0ad195a428e899973a2df.tar.gz
Add UI element for final surface segment in planner
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core')
-rw-r--r--core/planner.c2
-rw-r--r--core/pref.h1
-rw-r--r--core/settings/qPrefDivePlanner.cpp2
-rw-r--r--core/settings/qPrefDivePlanner.h4
-rw-r--r--core/subsurfacestartup.c1
5 files changed, 9 insertions, 1 deletions
diff --git a/core/planner.c b/core/planner.c
index 0177b9691..ff483a0ac 100644
--- a/core/planner.c
+++ b/core/planner.c
@@ -1087,7 +1087,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
current_cylinder = i;
break;
}
- plan_add_segment(diveplan, 600, 0, current_cylinder, 0, false, OC);
+ plan_add_segment(diveplan, prefs.surface_segment, 0, current_cylinder, 0, false, OC);
create_dive_from_plan(diveplan, dive, is_planner);
add_plan_to_notes(diveplan, dive, show_disclaimer, error);
fixup_dc_duration(&dive->dc);
diff --git a/core/pref.h b/core/pref.h
index 6acbc8f6a..50e13a117 100644
--- a/core/pref.h
+++ b/core/pref.h
@@ -163,6 +163,7 @@ struct preferences {
bool drop_stone_mode;
bool last_stop; // At 6m?
int min_switch_duration; // seconds
+ int surface_segment; // seconds at the surface after planned dive
enum deco_mode planner_deco_mode;
int problemsolvingtime;
int reserve_gas;
diff --git a/core/settings/qPrefDivePlanner.cpp b/core/settings/qPrefDivePlanner.cpp
index 04a2ba7e7..f33b390cf 100644
--- a/core/settings/qPrefDivePlanner.cpp
+++ b/core/settings/qPrefDivePlanner.cpp
@@ -83,6 +83,8 @@ HANDLE_PREFERENCE_BOOL(DivePlanner, "last_stop", last_stop);
HANDLE_PREFERENCE_INT(DivePlanner, "min_switch_duration", min_switch_duration);
+HANDLE_PREFERENCE_INT(DivePlanner, "surface_segment", surface_segment);
+
HANDLE_PREFERENCE_ENUM(DivePlanner, deco_mode, "deco_mode", planner_deco_mode);
HANDLE_PREFERENCE_INT(DivePlanner, "problemsolvingtime", problemsolvingtime);
diff --git a/core/settings/qPrefDivePlanner.h b/core/settings/qPrefDivePlanner.h
index b6ec1a0f7..09d8fabae 100644
--- a/core/settings/qPrefDivePlanner.h
+++ b/core/settings/qPrefDivePlanner.h
@@ -63,6 +63,7 @@ public:
static bool drop_stone_mode() { return prefs.drop_stone_mode; }
static bool last_stop() { return prefs.last_stop; }
static int min_switch_duration() { return prefs.min_switch_duration; }
+ static int surface_segment() { return prefs.surface_segment; }
static deco_mode planner_deco_mode() { return prefs.planner_deco_mode; }
static int problemsolvingtime() { return prefs.problemsolvingtime; }
static int reserve_gas() { return prefs.reserve_gas; }
@@ -91,6 +92,7 @@ public slots:
static void set_drop_stone_mode(bool value);
static void set_last_stop(bool value);
static void set_min_switch_duration(int value);
+ static void set_surface_segment(int vallue);
static void set_planner_deco_mode(deco_mode value);
static void set_problemsolvingtime(int value);
static void set_reserve_gas(int value);
@@ -119,6 +121,7 @@ signals:
void drop_stone_modeChanged(bool value);
void last_stopChanged(bool value);
void min_switch_durationChanged(int value);
+ void surface_segmentChanged(int value);
void planner_deco_modeChanged(deco_mode value);
void problemsolvingtimeChanged(int value);
void reserve_gasChanged(int value);
@@ -148,6 +151,7 @@ private:
static void disk_drop_stone_mode(bool doSync);
static void disk_last_stop(bool doSync);
static void disk_min_switch_duration(bool doSync);
+ static void disk_surface_segment(bool doSync);
static void disk_planner_deco_mode(bool doSync);
static void disk_problemsolvingtime(bool doSync);
static void disk_reserve_gas(bool doSync);
diff --git a/core/subsurfacestartup.c b/core/subsurfacestartup.c
index 4acf86a17..2ac900c36 100644
--- a/core/subsurfacestartup.c
+++ b/core/subsurfacestartup.c
@@ -64,6 +64,7 @@ struct preferences default_prefs = {
.drop_stone_mode = false,
.switch_at_req_stop = false,
.min_switch_duration = 60,
+ .surface_segment = 0,
.last_stop = false,
.verbatim_plan = false,
.display_runtime = true,