Robert C. Helling 9583173425 desktop: implement template previewing for WebEngine
This allows the template editor to preview in a QWebEngineView. It also
improves the logic of the buttons (Apply updates the preview but does not force
a save first).

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2021-11-26 12:35:34 -08:00

52 lines
1.0 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;
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, QWidget *parent);
~Printer();
void print();
void previewOnePage();
QString exportHtml();
signals:
void progessUpdated(int value);
};
#endif //PRINTER_H