diff options
-rw-r--r-- | core/planner.c | 2 | ||||
-rw-r--r-- | core/pref.h | 1 | ||||
-rw-r--r-- | core/settings/qPrefDivePlanner.cpp | 2 | ||||
-rw-r--r-- | core/settings/qPrefDivePlanner.h | 4 | ||||
-rw-r--r-- | core/subsurfacestartup.c | 1 | ||||
-rw-r--r-- | desktop-widgets/diveplanner.cpp | 5 | ||||
-rw-r--r-- | desktop-widgets/plannerSettings.ui | 14 | ||||
-rw-r--r-- | qt-models/diveplannermodel.cpp | 6 | ||||
-rw-r--r-- | qt-models/diveplannermodel.h | 1 |
9 files changed, 35 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, diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index c5467aa08..4988389c5 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -321,6 +321,7 @@ void PlannerSettingsWidget::disableDecoElements(int mode) ui.vpmb_conservatism->setDisabled(true); ui.switch_at_req_stop->setDisabled(true); ui.min_switch_duration->setDisabled(true); + ui.surface_segment->setDisabled(true); ui.label_min_switch_duration->setDisabled(true); ui.sacfactor->setDisabled(true); ui.problemsolvingtime->setDisabled(true); @@ -359,6 +360,7 @@ void PlannerSettingsWidget::disableDecoElements(int mode) ui.vpmb_conservatism->setDisabled(false); ui.switch_at_req_stop->setDisabled(false); ui.min_switch_duration->setDisabled(false); + ui.surface_segment->setDisabled(false); ui.label_min_switch_duration->setDisabled(false); ui.sacfactor->setDisabled(false); ui.problemsolvingtime->setDisabled(false); @@ -393,6 +395,7 @@ void PlannerSettingsWidget::disableDecoElements(int mode) ui.vpmb_conservatism->setDisabled(true); ui.switch_at_req_stop->setDisabled(false); ui.min_switch_duration->setDisabled(false); + ui.surface_segment->setDisabled(false); ui.label_min_switch_duration->setDisabled(false); ui.sacfactor->setDisabled(false); ui.problemsolvingtime->setDisabled(false); @@ -450,6 +453,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) ui.drop_stone_mode->setChecked(prefs.drop_stone_mode); ui.switch_at_req_stop->setChecked(prefs.switch_at_req_stop); ui.min_switch_duration->setValue(prefs.min_switch_duration / 60); + ui.surface_segment->setValue(prefs.surface_segment / 60); ui.recreational_deco->setChecked(prefs.planner_deco_mode == RECREATIONAL); ui.buehlmann_deco->setChecked(prefs.planner_deco_mode == BUEHLMANN); ui.vpmb_deco->setChecked(prefs.planner_deco_mode == VPMB); @@ -493,6 +497,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) connect(ui.bailout, SIGNAL(toggled(bool)), this, SLOT(setBailout(bool))); connect(ui.switch_at_req_stop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSwitchAtReqStop(bool))); connect(ui.min_switch_duration, SIGNAL(valueChanged(int)), plannerModel, SLOT(setMinSwitchDuration(int))); + connect(ui.surface_segment, SIGNAL(valueChanged(int)), plannerModel, SLOT(setSurfaceSegment(int))); connect(ui.rebreathermode, SIGNAL(currentIndexChanged(int)), plannerModel, SLOT(setRebreatherMode(int))); connect(ui.rebreathermode, SIGNAL(currentIndexChanged(int)), this, SLOT(setBailoutVisibility(int))); diff --git a/desktop-widgets/plannerSettings.ui b/desktop-widgets/plannerSettings.ui index 72aec7c55..6335b9b1c 100644 --- a/desktop-widgets/plannerSettings.ui +++ b/desktop-widgets/plannerSettings.ui @@ -523,6 +523,20 @@ </property> </widget> </item> + <item row="24" column="1"> + <widget class="QLabel" name="label_surface_segment"> + <property name="text"> + <string>Surface segment</string> + </property> + </widget> + </item> + <item row="24" column="2"> + <widget class="QSpinBox" name="surface_segment"> + <property name="suffix"> + <string>min</string> + </property> + </widget> + </item> </layout> </widget> </item> diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index bab57e0df..2dfeff7eb 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -625,6 +625,12 @@ void DivePlannerPointsModel::setMinSwitchDuration(int duration) emitDataChanged(); } +void DivePlannerPointsModel::setSurfaceSegment(int duration) +{ + qPrefDivePlanner::set_surface_segment(duration * 60); + emitDataChanged(); +} + void DivePlannerPointsModel::setStartDate(const QDate &date) { startTime.setDate(date); diff --git a/qt-models/diveplannermodel.h b/qt-models/diveplannermodel.h index 3ac5009fe..d3b2c9274 100644 --- a/qt-models/diveplannermodel.h +++ b/qt-models/diveplannermodel.h @@ -93,6 +93,7 @@ slots: void setReserveGas(int reserve); void setSwitchAtReqStop(bool value); void setMinSwitchDuration(int duration); + void setSurfaceSegment(int duration); void setSacFactor(double factor); void setProblemSolvingTime(int minutes); void setAscrate75(int rate); |