2017-04-27 18:26:05 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2015-04-21 16:05:20 +00:00
|
|
|
#ifndef PRINTER_H
|
|
|
|
#define PRINTER_H
|
|
|
|
|
2015-06-14 04:25:35 +00:00
|
|
|
#include "printoptions.h"
|
2015-07-02 20:26:31 +00:00
|
|
|
#include "templateedit.h"
|
2015-04-21 16:05:20 +00:00
|
|
|
|
2022-11-06 19:37:53 +00:00
|
|
|
struct dive;
|
2021-08-04 05:27:41 +00:00
|
|
|
class ProfileScene;
|
2020-12-13 12:32:40 +00:00
|
|
|
class QPainter;
|
|
|
|
class QPaintDevice;
|
|
|
|
class QRect;
|
|
|
|
class QWebView;
|
|
|
|
|
2015-04-21 16:05:20 +00:00
|
|
|
class Printer : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
2015-07-10 19:30:18 +00:00
|
|
|
public:
|
|
|
|
enum PrintMode {
|
|
|
|
PRINT,
|
|
|
|
PREVIEW
|
|
|
|
};
|
|
|
|
|
2015-04-21 16:05:20 +00:00
|
|
|
private:
|
2015-07-10 18:34:25 +00:00
|
|
|
QPaintDevice *paintDevice;
|
2015-04-21 16:05:20 +00:00
|
|
|
QWebView *webView;
|
2020-12-12 12:28:36 +00:00
|
|
|
const print_options &printOptions;
|
|
|
|
const template_options &templateOptions;
|
2015-06-17 15:05:14 +00:00
|
|
|
QSize pageSize;
|
2015-07-10 19:30:18 +00:00
|
|
|
PrintMode printMode;
|
2022-11-06 19:37:53 +00:00
|
|
|
struct dive *singleDive;
|
2015-06-17 15:05:14 +00:00
|
|
|
int done;
|
2015-07-10 14:20:14 +00:00
|
|
|
void render(int Pages);
|
2015-08-13 21:23:07 +00:00
|
|
|
void flowRender();
|
2022-11-06 19:37:53 +00:00
|
|
|
std::vector<dive *> getDives() const;
|
2020-12-13 12:32:40 +00:00
|
|
|
void putProfileImage(const QRect &box, const QRect &viewPort, QPainter *painter,
|
2021-08-04 05:27:41 +00:00
|
|
|
struct dive *dive, ProfileScene *profile);
|
2015-05-30 13:32:15 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void templateProgessUpdated(int value);
|
2015-04-21 16:05:20 +00:00
|
|
|
|
|
|
|
public:
|
2022-11-06 19:37:53 +00:00
|
|
|
// If singleDive is non-null, then only print this particular dive.
|
|
|
|
Printer(QPaintDevice *paintDevice, const print_options &printOptions, const template_options &templateOptions,
|
|
|
|
PrintMode printMode, dive *singleDive);
|
2015-07-10 12:59:56 +00:00
|
|
|
~Printer();
|
2015-04-21 16:05:20 +00:00
|
|
|
void print();
|
2015-07-10 19:45:27 +00:00
|
|
|
void previewOnePage();
|
2019-09-06 21:17:49 +00:00
|
|
|
QString exportHtml();
|
2015-05-30 13:32:15 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void progessUpdated(int value);
|
2015-04-21 16:05:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif //PRINTER_H
|