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>
This commit is contained in:
Dirk Hohndel 2014-05-31 21:24:27 -07:00
parent 6333f3aa35
commit ed26dfdd6b
3 changed files with 13 additions and 11 deletions

2
dive.h
View file

@ -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);

View file

@ -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);

View file

@ -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);