mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Disclaimer included in the printed diveplan
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
714fdc7ced
commit
40dd6f4c39
3 changed files with 16 additions and 8 deletions
16
planner.c
16
planner.c
|
|
@ -26,6 +26,8 @@ int decostoplevels[] = { 0, 3000, 6000, 9000, 12000, 15000, 18000, 21000, 24000,
|
||||||
double plangflow, plangfhigh;
|
double plangflow, plangfhigh;
|
||||||
bool plan_verbatim = false, plan_display_runtime = true, plan_display_duration = false, plan_display_transitions = false;
|
bool plan_verbatim = false, plan_display_runtime = true, plan_display_duration = false, plan_display_transitions = false;
|
||||||
|
|
||||||
|
const char *disclaimer;
|
||||||
|
|
||||||
#if DEBUG_PLAN
|
#if DEBUG_PLAN
|
||||||
void dump_plan(struct diveplan *diveplan)
|
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];
|
char buffer[20000];
|
||||||
int len, gasidx, lastdepth = 0, lasttime = 0;
|
int len, gasidx, lastdepth = 0, lasttime = 0;
|
||||||
struct divedatapoint *dp = diveplan->dp;
|
struct divedatapoint *dp = diveplan->dp;
|
||||||
const char *disclaimer = "";
|
const char *empty = "";
|
||||||
bool gaschange = !plan_verbatim;
|
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)
|
if (!dp)
|
||||||
return;
|
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),
|
len = snprintf(buffer, sizeof(buffer),
|
||||||
translate("gettextFromC", "%s<br>Subsurface dive plan<br>based on GFlow = %d and GFhigh = %d<br><br>"),
|
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) {
|
if (!plan_verbatim) {
|
||||||
len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "<table cellspacing=5%><thead><tr><th>depth</th>"));
|
len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "<table cellspacing=5%><thead><tr><th>depth</th>"));
|
||||||
if (plan_display_runtime)
|
if (plan_display_runtime)
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ extern bool diveplan_empty(struct diveplan *diveplan);
|
||||||
|
|
||||||
extern struct dive *planned_dive;
|
extern struct dive *planned_dive;
|
||||||
extern char *cache_data;
|
extern char *cache_data;
|
||||||
extern char *disclaimer;
|
extern const char *disclaimer;
|
||||||
extern double plangflow, plangfhigh;
|
extern double plangflow, plangfhigh;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@
|
||||||
#include "about.h"
|
#include "about.h"
|
||||||
#include "worldmap-save.h"
|
#include "worldmap-save.h"
|
||||||
#include "updatemanager.h"
|
#include "updatemanager.h"
|
||||||
|
#include "planner.h"
|
||||||
#ifndef NO_PRINTING
|
#ifndef NO_PRINTING
|
||||||
#include "printdialog.h"
|
#include "printdialog.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -424,13 +425,18 @@ void MainWindow::setPlanNotes(const char *notes)
|
||||||
|
|
||||||
void MainWindow::printPlan()
|
void MainWindow::printPlan()
|
||||||
{
|
{
|
||||||
|
QString diveplan = ui.divePlanOutput->toHtml();
|
||||||
|
QString withDisclaimer = diveplan + QString(disclaimer);
|
||||||
|
|
||||||
QPrinter printer;
|
QPrinter printer;
|
||||||
QPrintDialog *dialog = new QPrintDialog(&printer, this);
|
QPrintDialog *dialog = new QPrintDialog(&printer, this);
|
||||||
dialog->setWindowTitle(tr("Print runtime table"));
|
dialog->setWindowTitle(tr("Print runtime table"));
|
||||||
if (dialog->exec() != QDialog::Accepted)
|
if (dialog->exec() != QDialog::Accepted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ui.divePlanOutput->setHtml(withDisclaimer);
|
||||||
ui.divePlanOutput->print(&printer);
|
ui.divePlanOutput->print(&printer);
|
||||||
|
ui.divePlanOutput->setHtml(diveplan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionDivePlanner_triggered()
|
void MainWindow::on_actionDivePlanner_triggered()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue