summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-06-04 23:34:09 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-04 14:45:54 -0700
commit40dd6f4c3931e58ca18754ecfe9c8da5f2c6f542 (patch)
tree8ffb4d591cda0edb86deaeeae95afda43d14c644
parent714fdc7ced770c16126fadec2b0bf314e9b4a622 (diff)
downloadsubsurface-40dd6f4c3931e58ca18754ecfe9c8da5f2c6f542.tar.gz
Disclaimer included in the printed diveplan
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--planner.c16
-rw-r--r--planner.h2
-rw-r--r--qt-ui/mainwindow.cpp6
3 files changed, 16 insertions, 8 deletions
diff --git a/planner.c b/planner.c
index 2306294b0..438b84c73 100644
--- a/planner.c
+++ b/planner.c
@@ -26,6 +26,8 @@ int decostoplevels[] = { 0, 3000, 6000, 9000, 12000, 15000, 18000, 21000, 24000,
double plangflow, plangfhigh;
bool plan_verbatim = false, plan_display_runtime = true, plan_display_duration = false, plan_display_transitions = false;
+const char *disclaimer;
+
#if DEBUG_PLAN
void dump_plan(struct diveplan *diveplan)
{
@@ -514,20 +516,20 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
char buffer[20000];
int len, gasidx, lastdepth = 0, lasttime = 0;
struct divedatapoint *dp = diveplan->dp;
- const char *disclaimer = "";
+ const char *empty = "";
bool gaschange = !plan_verbatim;
+ disclaimer = translate("gettextFromC", "<b>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.</b><br>");
+
if (!dp)
return;
- if (show_disclaimer)
- disclaimer = translate("gettextFromC", "<b>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.</b>");
len = snprintf(buffer, sizeof(buffer),
translate("gettextFromC", "%s<br>Subsurface dive plan<br>based on GFlow = %d and GFhigh = %d<br><br>"),
- disclaimer, diveplan->gflow, diveplan->gfhigh);
+ show_disclaimer ? disclaimer : empty, diveplan->gflow, diveplan->gfhigh);
if (!plan_verbatim) {
len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "<table cellspacing=5%><thead><tr><th>depth</th>"));
if (plan_display_runtime)
diff --git a/planner.h b/planner.h
index 32419d073..12ea3d9d0 100644
--- a/planner.h
+++ b/planner.h
@@ -21,7 +21,7 @@ extern bool diveplan_empty(struct diveplan *diveplan);
extern struct dive *planned_dive;
extern char *cache_data;
-extern char *disclaimer;
+extern const char *disclaimer;
extern double plangflow, plangfhigh;
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index ee0e6f090..99539a0a4 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -41,6 +41,7 @@
#include "about.h"
#include "worldmap-save.h"
#include "updatemanager.h"
+#include "planner.h"
#ifndef NO_PRINTING
#include "printdialog.h"
#endif
@@ -424,13 +425,18 @@ void MainWindow::setPlanNotes(const char *notes)
void MainWindow::printPlan()
{
+ QString diveplan = ui.divePlanOutput->toHtml();
+ QString withDisclaimer = diveplan + QString(disclaimer);
+
QPrinter printer;
QPrintDialog *dialog = new QPrintDialog(&printer, this);
dialog->setWindowTitle(tr("Print runtime table"));
if (dialog->exec() != QDialog::Accepted)
return;
+ ui.divePlanOutput->setHtml(withDisclaimer);
ui.divePlanOutput->print(&printer);
+ ui.divePlanOutput->setHtml(diveplan);
}
void MainWindow::on_actionDivePlanner_triggered()