mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Add UI element for final surface segment in planner
Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
5e494ce761
commit
178eaa9a67
9 changed files with 35 additions and 1 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)));
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue