mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
dc37ba7758
QPointer is a strange "smart" pointer class, which resets itself when the pointed-to QObject is deleted. It does this by listening to the corresponding signal and therefore is surprisingly heavy for a plain pointer. A cynic would say that the existence of QPointer is an expression of Qt's broken ownership model. In any case, QPointer was only used at two places, were it was 100% useless: As a parameter to a function and as a locally scoped pointer. It only makes sense if a) there is a chance that the object disappears during the pointer's lifetime and b) it is actually checked for null before use None of which was the case here. Remove. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
51 lines
1 KiB
C++
51 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;
|
|
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);
|
|
~Printer();
|
|
void print();
|
|
void previewOnePage();
|
|
QString exportHtml();
|
|
|
|
signals:
|
|
void progessUpdated(int value);
|
|
};
|
|
|
|
#endif //PRINTER_H
|