mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
acfcd866bd
commit
4d0a200cfd
1 changed files with 5 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue