summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-31 21:24:27 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-31 21:25:03 -0700
commited26dfdd6bd095f117d4f43a638688d19bb9be5b (patch)
treeb21aa2efbb64add781488657b011ea3093386b57
parent6333f3aa35d12d7e9f1c02389df0f6129adb93b3 (diff)
downloadsubsurface-ed26dfdd6bd095f117d4f43a638688d19bb9be5b.tar.gz
Planner: don't include the disclaimer in the dive plan detail widget
We want the disclaimer in the final dive that can be printed, but it's distracting when shown while planning the dive. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--dive.h2
-rw-r--r--planner.c18
-rw-r--r--qt-ui/diveplanner.cpp4
3 files changed, 13 insertions, 11 deletions
diff --git a/dive.h b/dive.h
index f1570d31e..2b1da2073 100644
--- a/dive.h
+++ b/dive.h
@@ -654,7 +654,7 @@ struct divedatapoint *create_dp(int time_incr, int depth, int o2, int he, int po
#if DEBUG_PLAN
void dump_plan(struct diveplan *diveplan);
#endif
-void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, struct dive *master_dive, bool add_deco);
+void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, struct dive *master_dive, bool add_deco, bool show_disclaimer);
void delete_single_dive(int idx);
struct event *get_next_event(struct event *event, char *name);
diff --git a/planner.c b/planner.c
index 1feb8467d..f062ee699 100644
--- a/planner.c
+++ b/planner.c
@@ -517,24 +517,26 @@ static unsigned int *sort_stops(int *dstops, int dnr, struct gaschanges *gstops,
return stoplevels;
}
-static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive)
+static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_disclaimer)
{
char buffer[20000];
int consumption[MAX_CYLINDERS] = { 0, };
int len, gasidx, lastdepth = 0, lasttime = 0;
struct divedatapoint *dp = diveplan->dp;
int o2, he;
+ const char *disclaimer = "";
if (!dp)
return;
+ if (show_disclaimer)
+ disclaimer = translate("gettextFromC", "DISCLAIMER / WARNING: THIS IS A NEW IMPLEMENTATION OF THE BUHLMANN "
+ "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"),
- translate("gettextFromC", "DISCLAIMER / WARNING: THIS IS A NEW IMPLEMENTATION OF THE BUHLMANN "
- "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."),
- diveplan->gflow, diveplan->gfhigh);
+ disclaimer, diveplan->gflow, diveplan->gfhigh);
/* we start with gas 0, then check if that was changed */
o2 = get_o2(&dive->cylinder[0].gasmix);
he = get_he(&dive->cylinder[0].gasmix);
@@ -627,7 +629,7 @@ int ascend_velocity(int depth, int avg_depth, int bottom_time)
return 6000 / 60;
}
-void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, struct dive *master_dive, bool add_deco)
+void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, struct dive *master_dive, bool add_deco, bool show_disclaimer)
{
struct dive *dive;
struct sample *sample;
@@ -812,7 +814,7 @@ void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, s
*divep = dive = create_dive_from_plan(diveplan, master_dive);
if (!dive)
goto error_exit;
- add_plan_to_notes(diveplan, dive);
+ add_plan_to_notes(diveplan, dive, show_disclaimer);
error_exit:
free(stoplevels);
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index dd72ce9c5..a74a780c3 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -841,7 +841,7 @@ void DivePlannerPointsModel::createTemporaryPlan()
dump_plan(&diveplan);
#endif
if (plannerModel->recalcQ() && !diveplan_empty(&diveplan)) {
- plan(&diveplan, &cache, &tempDive, stagingDive, isPlanner());
+ plan(&diveplan, &cache, &tempDive, stagingDive, isPlanner(), false);
MainWindow::instance()->setPlanNotes(tempDive->notes);
addDecoToModel();
if (mode == ADD || mode == PLAN) {
@@ -889,7 +889,7 @@ void DivePlannerPointsModel::createPlan()
plannerModel->setRecalc(oldRecalc);
//TODO: C-based function here?
- plan(&diveplan, &cache, &tempDive, stagingDive, isPlanner());
+ plan(&diveplan, &cache, &tempDive, stagingDive, isPlanner(), true);
record_dive(tempDive);
mark_divelist_changed(true);