2013-07-10 15:34:57 +03:00
|
|
|
#ifndef PRINTLAYOUT_H
|
|
|
|
#define PRINTLAYOUT_H
|
|
|
|
|
2013-07-25 12:52:20 +03:00
|
|
|
#include <QObject>
|
|
|
|
#include <QList>
|
2013-12-24 10:18:56 -02:00
|
|
|
#include <QVector>
|
2014-06-26 14:01:31 -03:00
|
|
|
#include <QRect>
|
2013-07-10 15:34:57 +03:00
|
|
|
|
2014-06-26 14:01:31 -03:00
|
|
|
class QPrinter;
|
2013-10-03 17:50:40 +03:00
|
|
|
class QTableView;
|
2013-07-10 15:34:57 +03:00
|
|
|
class PrintDialog;
|
2013-07-25 12:52:20 +03:00
|
|
|
class TablePrintModel;
|
2013-10-03 17:50:40 +03:00
|
|
|
class ProfilePrintModel;
|
2013-07-25 12:52:20 +03:00
|
|
|
struct dive;
|
2013-07-10 15:34:57 +03:00
|
|
|
|
|
|
|
class PrintLayout : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2014-11-14 00:57:42 +02:00
|
|
|
PrintLayout(PrintDialog *, QPrinter *, struct print_options *);
|
2013-07-10 15:34:57 +03:00
|
|
|
void print();
|
|
|
|
|
|
|
|
private:
|
|
|
|
PrintDialog *dialog;
|
|
|
|
QPrinter *printer;
|
2014-11-14 00:57:42 +02:00
|
|
|
struct print_options *printOptions;
|
2013-07-10 15:34:57 +03:00
|
|
|
|
2014-07-25 03:50:40 +03:00
|
|
|
int screenDpiX, screenDpiY, printerDpi, pageW, pageH;
|
2013-07-10 16:04:00 +03:00
|
|
|
QRect pageRect;
|
2013-07-10 15:34:57 +03:00
|
|
|
|
2013-12-24 10:18:56 -02:00
|
|
|
QVector<QString> tablePrintColumnNames;
|
2013-07-25 12:52:20 +03:00
|
|
|
unsigned int tablePrintHeadingBackground;
|
2013-10-03 17:50:40 +03:00
|
|
|
QList<unsigned int> tablePrintColumnWidths;
|
|
|
|
unsigned int profilePrintTableMaxH;
|
|
|
|
QList<unsigned int> profilePrintColumnWidths, profilePrintRowHeights;
|
2013-07-11 00:48:38 +03:00
|
|
|
|
2013-07-10 16:04:00 +03:00
|
|
|
void setup();
|
2013-12-05 00:48:38 +01:00
|
|
|
int estimateTotalDives() const;
|
2013-09-27 19:06:45 +03:00
|
|
|
void printProfileDives(int divesPerRow, int divesPerColumn);
|
2014-07-24 10:56:39 -07:00
|
|
|
QTableView *createProfileTable(ProfilePrintModel *model, const int tableW, const qreal fitNotesToHeight = 0.0);
|
2013-07-25 12:52:20 +03:00
|
|
|
void printTable();
|
|
|
|
void addTablePrintDataRow(TablePrintModel *model, int row, struct dive *dive) const;
|
|
|
|
void addTablePrintHeadingRow(TablePrintModel *model, int row) const;
|
2013-12-04 15:13:40 +02:00
|
|
|
|
|
|
|
signals:
|
2014-02-27 20:09:57 -08:00
|
|
|
void signalProgress(int);
|
2013-07-10 15:34:57 +03:00
|
|
|
};
|
|
|
|
|
2014-02-11 19:14:46 +01:00
|
|
|
#endif // PRINTLAYOUT_H
|