subsurface/printer.h
Gehad elrobey d4382c7c4b Printing: add preview to TemplateEdit dialog
Show QPixmap in QLabel, Use Printer class to render the Preview on
the QPixmap.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2015-07-20 15:28:03 +03:00

47 lines
934 B
C++

#ifndef PRINTER_H
#define PRINTER_H
#include <QPrinter>
#include <QWebView>
#include <QRect>
#include <QPainter>
#include "profile/profilewidget2.h"
#include "printoptions.h"
#include "templateedit.h"
class Printer : public QObject {
Q_OBJECT
public:
enum PrintMode {
PRINT,
PREVIEW
};
private:
QPaintDevice *paintDevice;
QWebView *webView;
print_options *printOptions;
template_options *templateOptions;
QSize pageSize;
PrintMode printMode;
int done;
int dpi;
void render(int Pages);
void putProfileImage(QRect box, QRect viewPort, QPainter *painter, struct dive *dive, QPointer<ProfileWidget2> profile);
private slots:
void templateProgessUpdated(int value);
public:
Printer(QPaintDevice *paintDevice, print_options *printOptions, template_options *templateOptions, PrintMode printMode);
~Printer();
void print();
void previewOnePage();
signals:
void progessUpdated(int value);
};
#endif //PRINTER_H