subsurface/qt-ui/printlayout.h
Lubomir I. Ivanov df8107830e Print: provide means for profile layouting
printlayout.cpp(h):

This patch cleans some test code and adds the function
printProfileDives() that accepts a number of dives
per rows and columns. It can technically fit any number
of dives on a page given the page size allows it. Both
landscape and portrait layouts are supported.

It now replaces the old methods:
printTwoDives()
printSixDives()

Space is reserved for data tables that will be placed
bellow profiles on a later stage.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2013-09-27 09:29:30 -07:00

42 lines
943 B
C++

#ifndef PRINTLAYOUT_H
#define PRINTLAYOUT_H
#include <QObject>
#include <QPrinter>
#include <QList>
class PrintDialog;
class TablePrintModel;
struct dive;
class PrintLayout : public QObject {
Q_OBJECT
public:
PrintLayout(PrintDialog *, QPrinter *, struct options *);
void print();
private:
PrintDialog *dialog;
QPrinter *printer;
QPainter *painter;
struct options *printOptions;
int screenDpiX, screenDpiY, printerDpi, scaledPageW, scaledPageH;
qreal scaleX, scaleY;
QRect pageRect;
QList<QString> tablePrintColumnNames;
QList<unsigned int> tablePrintColumnWidths;
unsigned int tablePrintHeadingBackground;
void setup();
void printProfileDives(int divesPerRow, int divesPerColumn);
void printTable();
void addTablePrintDataRow(TablePrintModel *model, int row, struct dive *dive) const;
void addTablePrintHeadingRow(TablePrintModel *model, int row) const;
QPixmap convertPixmapToGrayscale(QPixmap) const;
};
#endif