summaryrefslogtreecommitdiffstats
path: root/qt-ui/printlayout.h
blob: 7a1922e4aa435a17d9cd2bb819d1fed7ca88c615 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef PRINTLAYOUT_H
#define PRINTLAYOUT_H

#include <QPrinter>
#include <QStringList>

class PrintDialog;

class PrintLayout : public QObject {
	Q_OBJECT

public:
	PrintLayout(PrintDialog *, QPrinter *, struct options *);
	void print();

private:
	PrintDialog *dialog;
	QPrinter *printer;
	struct options *printOptions;

	QPainter *painter;
	int screenDpiX, screenDpiY, printerDpi;
	qreal scaleX, scaleY;
	QRect pageRect;

	QStringList tableColumnNames;
	QStringList tableColumnWidths;

	void setup();
	void printSixDives() const;
	void printTwoDives() const;
	void printTable() const;
	QString insertTableHeadingRow() const;
	QString insertTableHeadingCol(int) const;
	QString insertTableDataRow(struct dive *) const;
	QString insertTableDataCol(QString) const;
	QPixmap convertPixmapToGrayscale(QPixmap) const;
};

#endif