subsurface/desktop-widgets/printer.h
Berthold Stoeger 42cff9b3a5 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 <bstoeger@mail.tuwien.ac.at>
2021-02-17 07:26:55 -08:00

52 lines
1 KiB
C++

// SPDX-License-Identifier: GPL-2.0
#ifndef PRINTER_H
#define PRINTER_H
#include "printoptions.h"
#include "templateedit.h"
class ProfileWidget2;
class QPainter;
class QPaintDevice;
class QRect;
class QWebView;
class Printer : public QObject {
Q_OBJECT
public:
enum PrintMode {
PRINT,
PREVIEW
};
private:
QPaintDevice *paintDevice;
QWebView *webView;
const print_options &printOptions;
const template_options &templateOptions;
QSize pageSize;
PrintMode printMode;
bool inPlanner;
int done;
int dpi;
void render(int Pages);
void flowRender();
void putProfileImage(const QRect &box, const QRect &viewPort, QPainter *painter,
struct dive *dive, ProfileWidget2 *profile);
private slots:
void templateProgessUpdated(int value);
public:
Printer(QPaintDevice *paintDevice, const print_options &printOptions, const template_options &templateOptions, PrintMode printMode, bool inPlanner);
~Printer();
void print();
void previewOnePage();
QString exportHtml();
signals:
void progessUpdated(int value);
};
#endif //PRINTER_H