diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-05-31 21:24:27 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-05-31 21:25:03 -0700 |
commit | ed26dfdd6bd095f117d4f43a638688d19bb9be5b (patch) | |
tree | b21aa2efbb64add781488657b011ea3093386b57 | |
parent | 6333f3aa35d12d7e9f1c02389df0f6129adb93b3 (diff) | |
download | subsurface-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.h | 2 | ||||
-rw-r--r-- | planner.c | 18 | ||||
-rw-r--r-- | qt-ui/diveplanner.cpp | 4 |
3 files changed, 13 insertions, 11 deletions
@@ -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); @@ -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); |