From 42cff9b3a506d2b52739d8714d5698e1a3b2e3f9 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 13 Feb 2021 22:43:55 +0100 Subject: planner: pass in_planner down to TemplateLayout The TemplateLayout prints different dives depending on whether the planner is active. Instead of accessing a global variable, pass the status down from the MainWindow. That's all quite convoluted, since there are multiple layers involved. On the positive side, the in_planner() function has now no users an can be removed. Signed-off-by: Berthold Stoeger --- desktop-widgets/printer.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'desktop-widgets/printer.cpp') diff --git a/desktop-widgets/printer.cpp b/desktop-widgets/printer.cpp index b3af96a75..ff5a65b93 100644 --- a/desktop-widgets/printer.cpp +++ b/desktop-widgets/printer.cpp @@ -14,12 +14,13 @@ #include #include "profile-widget/profilewidget2.h" -Printer::Printer(QPaintDevice *paintDevice, const print_options &printOptions, const template_options &templateOptions, PrintMode printMode) : +Printer::Printer(QPaintDevice *paintDevice, const print_options &printOptions, const template_options &templateOptions, PrintMode printMode, bool inPlanner) : paintDevice(paintDevice), webView(new QWebView), printOptions(printOptions), templateOptions(templateOptions), printMode(printMode), + inPlanner(inPlanner), done(0), dpi(0) { @@ -205,7 +206,7 @@ QString Printer::exportHtml() QString html; if (printOptions.type == print_options::DIVELIST) - html = t.generate(); + html = t.generate(inPlanner); else if (printOptions.type == print_options::STATISTICS ) html = t.generateStatistics(); @@ -235,7 +236,7 @@ void Printer::print() // export border width with at least 1 pixel // templateOptions.borderwidth = std::max(1, pageSize.width() / 1000); if (printOptions.type == print_options::DIVELIST) - webView->setHtml(t.generate()); + webView->setHtml(t.generate(inPlanner)); else if (printOptions.type == print_options::STATISTICS ) webView->setHtml(t.generateStatistics()); if (printOptions.color_selected && printerPtr->colorMode()) @@ -269,7 +270,7 @@ void Printer::previewOnePage() // initialize the border settings // templateOptions.border_width = std::max(1, pageSize.width() / 1000); if (printOptions.type == print_options::DIVELIST) - webView->setHtml(t.generate()); + webView->setHtml(t.generate(inPlanner)); else if (printOptions.type == print_options::STATISTICS ) webView->setHtml(t.generateStatistics()); bool ok; -- cgit v1.2.3-70-g09d2