diff --git a/planner.c b/planner.c
index cc8e9d908..fa636bd5a 100644
--- a/planner.c
+++ b/planner.c
@@ -24,6 +24,7 @@ int decostoplevels[] = { 0, 3000, 6000, 9000, 12000, 15000, 18000, 21000, 24000,
180000, 190000, 200000, 220000, 240000, 260000, 280000, 300000,
320000, 340000, 360000, 380000 };
double plangflow, plangfhigh;
+bool plan_verbatim = false, plan_display_runtime = true, plan_display_duration = false, plan_display_transitions = false;
#if DEBUG_PLAN
void dump_plan(struct diveplan *diveplan)
@@ -71,6 +72,26 @@ void set_last_stop(bool last_stop_6m)
decostoplevels[1] = 3000;
}
+void set_verbatim(bool verbatim)
+{
+ plan_verbatim = verbatim;
+}
+
+void set_display_runtime(bool display)
+{
+ plan_display_runtime = display;
+}
+
+void set_display_duration(bool display)
+{
+ plan_display_duration = display;
+}
+
+void set_display_transitions(bool display)
+{
+ plan_display_transitions = display;
+}
+
void get_gas_from_events(struct divecomputer *dc, int time, struct gasmix *gas)
{
// we don't modify the values passed in if nothing is found
@@ -493,6 +514,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
int len, gasidx, lastdepth = 0, lasttime = 0;
struct divedatapoint *dp = diveplan->dp;
const char *disclaimer = "";
+ bool gaschange = true;
if (!dp)
return;
@@ -502,9 +524,14 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
"ALGORITHM AND A DIVE PLANNER IMPLEMENTION BASED ON THAT WHICH HAS "
"RECEIVED ONLY A LIMITED AMOUNT OF TESTING. WE STRONGLY RECOMMEND NOT TO "
"PLAN DIVES SIMPLY BASED ON THE RESULTS GIVEN HERE.");
- snprintf(buffer, sizeof(buffer),
- translate("gettextFromC", "%s\nSubsurface dive plan\nbased on GFlow = %d and GFhigh = %d\n\n"),
- disclaimer, diveplan->gflow, diveplan->gfhigh);
+ len = snprintf(buffer, sizeof(buffer),
+ translate("gettextFromC", "%s\nSubsurface dive plan\nbased on GFlow = %d and GFhigh = %d\n\ndepth"),
+ disclaimer, diveplan->gflow, diveplan->gfhigh);
+ if (plan_display_runtime)
+ len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " runtime"));
+ if (plan_display_duration)
+ len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " stop time"));
+ len += snprintf(buffer + len, sizeof(buffer) - len, " gas\n");
do {
struct gasmix gasmix, newgasmix;
const char *depth_unit;
@@ -534,28 +561,59 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
continue;
gasidx = get_gasidx(dive, &gasmix);
len = strlen(buffer);
- if (dp->depth != lastdepth)
- snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "Transition to %.*f %s in %d:%02d min - runtime %d:%02u on %s\n"),
- decimals, depthvalue, depth_unit,
- FRACTION(dp->time - lasttime, 60),
- FRACTION(dp->time, 60),
- gasname(&gasmix));
- else
- snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "Stay at %.*f %s for %d:%02d min - runtime %d:%02u on %s\n"),
- decimals, depthvalue, depth_unit,
- FRACTION(dp->time - lasttime, 60),
- FRACTION(dp->time, 60),
- gasname(&gasmix));
+ if (dp->depth != lastdepth) {
+ if (plan_display_transitions)
+ snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "Transition to %.*f %s in %d:%02d min - runtime %d:%02u on %s\n"),
+ decimals, depthvalue, depth_unit,
+ FRACTION(dp->time - lasttime, 60),
+ FRACTION(dp->time, 60),
+ gasname(&gasmix));
+ else
+ if (dp->entered) {
+ len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "%3.0f%s"), depthvalue, depth_unit);
+ if (plan_display_runtime)
+ len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " %3dmin "), (dp->time + 30) / 60);
+ if (plan_display_duration)
+ len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " %3dmin "), (dp->time - lasttime + 30) / 60);
+ if (gaschange) {
+ len += snprintf(buffer + len, sizeof(buffer) - len, " %s", gasname(&newgasmix));
+ gaschange = false;
+ }
+ len += snprintf(buffer + len, sizeof(buffer) - len, "\n");
+ }
+ } else {
+ if (plan_verbatim) {
+ snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "Stay at %.*f %s for %d:%02d min - runtime %d:%02u on %s\n"),
+ decimals, depthvalue, depth_unit,
+ FRACTION(dp->time - lasttime, 60),
+ FRACTION(dp->time, 60),
+ gasname(&gasmix));
+ } else {
+ len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "%3.0f%s"), depthvalue, depth_unit);
+ if (plan_display_runtime)
+ len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " %3dmin "), (dp->time + 30) / 60);
+ if (plan_display_duration)
+ len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " %3dmin "), (dp->time - lasttime + 30) / 60);
+ if (gaschange) {
+ len += snprintf(buffer + len, sizeof(buffer) - len, " %s", gasname(&newgasmix));
+ gaschange = false;
+ }
+ len += snprintf(buffer + len, sizeof(buffer) - len, "\n");
+ }
+ }
if (nextdp && gasmix_distance(&gasmix, &newgasmix)) {
// gas switch at this waypoint
- snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "Switch gas to %s\n"), gasname(&newgasmix));
+ if (plan_verbatim)
+ snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "Switch gas to %s\n"), gasname(&newgasmix));
+ else
+ gaschange = true;
gasmix = newgasmix;
}
lasttime = dp->time;
lastdepth = dp->depth;
} while ((dp = dp->next) != NULL);
len = strlen(buffer);
- snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "Gas consumption:\n"));
+ snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "\nGas consumption:\n"));
for (gasidx = 0; gasidx < MAX_CYLINDERS; gasidx++) {
double volume;
const char *unit;
diff --git a/planner.h b/planner.h
index 5542be14e..32419d073 100644
--- a/planner.h
+++ b/planner.h
@@ -11,6 +11,10 @@ extern int validate_po2(const char *text, int *mbar_po2);
extern timestamp_t current_time_notz(void);
extern void show_planned_dive(char **error_string_p);
extern void set_last_stop(bool last_stop_6m);
+extern void set_verbatim(bool verbatim);
+extern void set_display_runtime(bool display);
+extern void set_display_duration(bool display);
+extern void set_display_transitions(bool display);
extern void get_gas_from_events(struct divecomputer *dc, int time, struct gasmix *gas);
extern int get_gasidx(struct dive *dive, struct gasmix *mix);
extern bool diveplan_empty(struct diveplan *diveplan);
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index abe1c3a62..36c8538a1 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -273,6 +273,10 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
connect(ui.gfhigh, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFHigh(int)));
connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
connect(ui.lastStop, SIGNAL(toggled(bool)), plannerModel, SLOT(setLastStop6m(bool)));
+ connect(ui.verbatim_plan, SIGNAL(toggled(bool)), plannerModel, SLOT(setVerbatim(bool)));
+ connect(ui.display_duration, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayDuration(bool)));
+ connect(ui.display_runtime, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayRuntime(bool)));
+ connect(ui.display_transitions, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayTransitions(bool)));
// Creating (and canceling) the plan
connect(ui.buttonBox, SIGNAL(accepted()), plannerModel, SLOT(createPlan()));
@@ -505,6 +509,30 @@ void DivePlannerPointsModel::setLastStop6m(bool value)
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
}
+void DivePlannerPointsModel::setVerbatim(bool value)
+{
+ set_verbatim(value);
+ emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
+}
+
+void DivePlannerPointsModel::setDisplayRuntime(bool value)
+{
+ set_display_runtime(value);
+ emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
+}
+
+void DivePlannerPointsModel::setDisplayDuration(bool value)
+{
+ set_display_duration(value);
+ emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
+}
+
+void DivePlannerPointsModel::setDisplayTransitions(bool value)
+{
+ set_display_transitions(value);
+ emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
+}
+
void DivePlannerPointsModel::setStartTime(const QTime &t)
{
diveplan.when = (t.msec() + QDateTime::currentMSecsSinceEpoch()) / 1000 - gettimezoneoffset();
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
index a26038b2f..f96094059 100644
--- a/qt-ui/diveplanner.h
+++ b/qt-ui/diveplanner.h
@@ -73,6 +73,10 @@ slots:
void setDecoSac(int sac);
void setStartTime(const QTime &t);
void setLastStop6m(bool value);
+ void setVerbatim(bool value);
+ void setDisplayRuntime(bool value);
+ void setDisplayDuration(bool value);
+ void setDisplayTransitions(bool value);
void createPlan();
void remove(const QModelIndex &index);
void cancelPlan();
diff --git a/qt-ui/diveplanner.ui b/qt-ui/diveplanner.ui
index 558be069d..fe3f46086 100644
--- a/qt-ui/diveplanner.ui
+++ b/qt-ui/diveplanner.ui
@@ -62,87 +62,7 @@
2
- -
-
-
- -
-
-
- Bottom SAC
-
-
-
- -
-
-
- GFHigh
-
-
-
- -
-
-
- SAC on DECO Stop
-
-
-
- -
-
-
- -
-
-
- -
-
-
- GFLow
-
-
-
- -
-
-
- 1
-
-
- 150
-
-
-
- -
-
-
- 1
-
-
- 150
-
-
-
- -
-
-
- Last Stop at 6m
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 50
-
-
-
-
- -
+
-
@@ -159,14 +79,33 @@
-
-
-
- QDialogButtonBox::Abort|QDialogButtonBox::Save
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 50
+
- -
-
+
-
+
+
+ -
+
+
+ 1
+
+
+ 150
+
+
-
@@ -175,6 +114,71 @@
+ -
+
+
+ GFLow
+
+
+
+ -
+
+
+ -
+
+
+ QDialogButtonBox::Abort|QDialogButtonBox::Save
+
+
+
+ -
+
+
+ Last Stop at 6m
+
+
+
+ -
+
+
+ -
+
+
+ 1
+
+
+ 150
+
+
+
+ -
+
+
+ verbatim diveplan
+
+
+
+ -
+
+
+ SAC on DECO Stop
+
+
+
+ -
+
+
+ Bottom SAC
+
+
+
+ -
+
+
+ GFHigh
+
+
+
-
@@ -182,6 +186,42 @@
+ -
+
+
+ -
+
+
+ In dive plan, show duration (relative time) of stops
+
+
+ display stop duration
+
+
+
+ -
+
+
+ In dive plan, show runtime (absolute time) of stops
+
+
+ display runtime
+
+
+ true
+
+
+
+ -
+
+
+ In diveplan, list transitions or treat them as implicit
+
+
+ display transitions
+
+
+
diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui
index d73f19077..1dd6db59f 100644
--- a/qt-ui/mainwindow.ui
+++ b/qt-ui/mainwindow.ui
@@ -86,409 +86,409 @@
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 0
-
- -
-
-
- Enable the pO2 Graph
-
-
- ...
-
-
-
- :/icon_o2:/icon_o2
-
-
-
- 24
- 24
-
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Enable the pN2 Graph
-
-
- ...
-
-
-
- :/icon_n2:/icon_n2
-
-
-
- 24
- 24
-
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Enable the pHe graph
-
-
- ...
-
-
-
- :/icon_he:/icon_he
-
-
-
- 24
- 24
-
-
-
- true
-
-
- true
-
-
-
- -
-
-
- true
-
-
- Show the DC Reported Ceiling
-
-
- ...
-
-
-
- :/icon_ceiling_dc:/icon_ceiling_dc
-
-
-
- 24
- 24
-
-
-
- true
-
-
- true
-
-
-
- -
-
-
- true
-
-
- Show the Calculated Ceiling
-
-
- ...
-
-
-
- :/icon_ceiling_calculated:/icon_ceiling_calculated
-
-
-
- 24
- 24
-
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Calculate All Tissues
-
-
- ...
-
-
-
- :/icon_ceiling_alltissues:/icon_ceiling_alltissues
-
-
-
- 24
- 24
-
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Show Calculated Ceiling with 3m Increments
-
-
- ...
-
-
-
- :/icon_ceiling_3m:/icon_ceiling_3m
-
-
-
- 24
- 24
-
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Show/hide heart rate
-
-
- ...
-
-
-
- :/icon_HR:/icon_HR
-
-
-
- 24
- 24
-
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Enable MOD
-
-
- ...
-
-
-
- :/icon_mod:/icon_mod
-
-
-
- 24
- 24
-
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Enable EAD, END, and EADD
-
-
- ...
-
-
-
- :/icon_ead:/icon_ead
-
-
-
- 24
- 24
-
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Show NDL / TTS
-
-
- ...
-
-
-
- :/icon_NDLTTS:/icon_NDLTTS
-
-
-
- 24
- 24
-
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Show SAC Rate
-
-
- ...
-
-
-
- :/icon_lung:/icon_lung
-
-
-
- 24
- 24
-
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Enable / Disable the Ruler
-
-
- ...
-
-
-
- :/units:/units
-
-
-
- 24
- 24
-
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Rescale depth axis
-
-
- ...
-
-
-
- :/scale:/scale
-
-
-
- 24
- 24
-
-
-
- true
-
-
- true
-
-
-
- -
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
-
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+ Enable the pO2 Graph
+
+
+ ...
+
+
+
+ :/icon_o2:/icon_o2
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Enable the pN2 Graph
+
+
+ ...
+
+
+
+ :/icon_n2:/icon_n2
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Enable the pHe graph
+
+
+ ...
+
+
+
+ :/icon_he:/icon_he
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ true
+
+
+ Show the DC Reported Ceiling
+
+
+ ...
+
+
+
+ :/icon_ceiling_dc:/icon_ceiling_dc
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ true
+
+
+ Show the Calculated Ceiling
+
+
+ ...
+
+
+
+ :/icon_ceiling_calculated:/icon_ceiling_calculated
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Calculate All Tissues
+
+
+ ...
+
+
+
+ :/icon_ceiling_alltissues:/icon_ceiling_alltissues
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Show Calculated Ceiling with 3m Increments
+
+
+ ...
+
+
+
+ :/icon_ceiling_3m:/icon_ceiling_3m
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Show/hide heart rate
+
+
+ ...
+
+
+
+ :/icon_HR:/icon_HR
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Enable MOD
+
+
+ ...
+
+
+
+ :/icon_mod:/icon_mod
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Enable EAD, END, and EADD
+
+
+ ...
+
+
+
+ :/icon_ead:/icon_ead
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Show NDL / TTS
+
+
+ ...
+
+
+
+ :/icon_NDLTTS:/icon_NDLTTS
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Show SAC Rate
+
+
+ ...
+
+
+
+ :/icon_lung:/icon_lung
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Enable / Disable the Ruler
+
+
+ ...
+
+
+
+ :/units:/units
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Rescale depth axis
+
+
+ ...
+
+
+
+ :/scale:/scale
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
@@ -497,7 +497,7 @@
- 0
+ 1
@@ -536,15 +536,26 @@
0
- -
-
-
- Dive plan details
-
-
-
-
-
+
+
+ Dive plan details
+
+
+
+ -
+
+
+ font: 13pt "Courier";
+
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Courier'; font-size:13pt; font-weight:400; font-style:normal;">
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'.Curier New';"><br /></p></body></html>
+
+
@@ -570,7 +581,7 @@
0
0
1418
- 20
+ 22