diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-04-13 18:30:03 +0200 |
---|---|---|
committer | Robert C. Helling <helling@atdotde.de> | 2020-05-04 10:42:07 +0200 |
commit | 4d0a200cfd20d97f668250e46d5af745d53f6a41 (patch) | |
tree | b22a528788bfb6c67ac2b938a6e7ad77e0f4f203 /desktop-widgets/mainwindow.cpp | |
parent | acfcd866bdc76a727a3ff10c6d71727379881a64 (diff) | |
download | subsurface-4d0a200cfd20d97f668250e46d5af745d53f6a41.tar.gz |
planner: on printing, restore textual plan using a saved string
When printing, the dive plan was prepended with a logo, a disclaimer
and the profile. Then it was restored by setting the plan of
displayed_dive.
Instead, simply save the original plan in a QString and restore that.
This removes a further dependency on displayed_dive, which I'd like
to make local to the planner.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/mainwindow.cpp')
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 116e19c95..8a8981a46 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -808,8 +808,11 @@ void MainWindow::printPlan() { #ifndef NO_PRINTING char *disclaimer = get_planner_disclaimer_formatted(); + // Prepend a logo and a disclaimer to the plan. + // Save the old plan so that it can be restored at the end of the function. + QString origPlan = plannerDetails->divePlanOutput()->toHtml(); QString diveplan = QStringLiteral("<img height=50 src=\":subsurface-icon\"> ") + - QString(disclaimer) + plannerDetails->divePlanOutput()->toHtml(); + QString(disclaimer) + origPlan; free(disclaimer); QPrinter printer; @@ -848,7 +851,7 @@ void MainWindow::printPlan() plannerDetails->divePlanOutput()->setHtml(diveplan); plannerDetails->divePlanOutput()->print(&printer); - plannerDetails->divePlanOutput()->setHtml(displayed_dive.notes); + plannerDetails->divePlanOutput()->setHtml(origPlan); // restore original plan #endif } |