Plan: introduce function that returns disclaimer

The setting of the disclaimer variable was removed inadvertently
some time ago, which removed the disclaimer from the printed plan.
Instead, introduce a function that returns the disclaimer with
the current deco mode. Use that function to generate the dive
notes and for printing.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-09-10 15:29:03 +02:00 committed by Robert C. Helling
parent 4706b0f11a
commit ee365b7341
3 changed files with 21 additions and 12 deletions

View file

@ -850,8 +850,10 @@ void MainWindow::updateVariations(QString variations)
void MainWindow::printPlan()
{
#ifndef NO_PRINTING
QString diveplan = plannerDetails->divePlanOutput()->toHtml();
QString withDisclaimer = QString("<img height=50 src=\":subsurface-icon\"> ") + diveplan + QString(disclaimer);
char *disclaimer = get_planner_disclaimer_formatted();
QString diveplan = QStringLiteral("<img height=50 src=\":subsurface-icon\"> ") +
QString(disclaimer) + plannerDetails->divePlanOutput()->toHtml();
free(disclaimer);
QPrinter printer;
QPrintDialog *dialog = new QPrintDialog(&printer, this);
@ -885,9 +887,9 @@ void MainWindow::printPlan()
QBuffer buffer(&byteArray);
pixmap.save(&buffer, "PNG");
QString profileImage = QString("<img src=\"data:image/png;base64,") + byteArray.toBase64() + "\"/><br><br>";
withDisclaimer = profileImage + withDisclaimer;
diveplan = profileImage + diveplan;
plannerDetails->divePlanOutput()->setHtml(withDisclaimer);
plannerDetails->divePlanOutput()->setHtml(diveplan);
plannerDetails->divePlanOutput()->print(&printer);
plannerDetails->divePlanOutput()->setHtml(displayed_dive.notes);
#endif