mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-29 21:50:26 +00:00
7ea728e95f
All the print options will be stored after the user closes or "cancels" the print dialog. There seems to be no good way to store the last selected page size, because print dialogs are different and some just list them as strings - A4, A3, etc. The patch also applies the following changes: - renames display.h's 'struct options' to 'struct print_options' as these were really just for the print dialog - the print_options dialog now stores more options as 'bool' - demote PrintDialog's 'printOptions' to 'private' Fixes #653 Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
#ifndef PRINTLAYOUT_H
|
|
#define PRINTLAYOUT_H
|
|
|
|
#include <QObject>
|
|
#include <QList>
|
|
#include <QVector>
|
|
#include <QRect>
|
|
|
|
class QPrinter;
|
|
class QTableView;
|
|
class PrintDialog;
|
|
class TablePrintModel;
|
|
class ProfilePrintModel;
|
|
struct dive;
|
|
|
|
class PrintLayout : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
PrintLayout(PrintDialog *, QPrinter *, struct print_options *);
|
|
void print();
|
|
|
|
private:
|
|
PrintDialog *dialog;
|
|
QPrinter *printer;
|
|
struct print_options *printOptions;
|
|
|
|
int screenDpiX, screenDpiY, printerDpi, pageW, pageH;
|
|
QRect pageRect;
|
|
|
|
QVector<QString> tablePrintColumnNames;
|
|
unsigned int tablePrintHeadingBackground;
|
|
QList<unsigned int> tablePrintColumnWidths;
|
|
unsigned int profilePrintTableMaxH;
|
|
QList<unsigned int> profilePrintColumnWidths, profilePrintRowHeights;
|
|
|
|
void setup();
|
|
int estimateTotalDives() const;
|
|
void printProfileDives(int divesPerRow, int divesPerColumn);
|
|
QTableView *createProfileTable(ProfilePrintModel *model, const int tableW, const qreal fitNotesToHeight = 0.0);
|
|
void printTable();
|
|
void addTablePrintDataRow(TablePrintModel *model, int row, struct dive *dive) const;
|
|
void addTablePrintHeadingRow(TablePrintModel *model, int row) const;
|
|
|
|
signals:
|
|
void signalProgress(int);
|
|
};
|
|
|
|
#endif // PRINTLAYOUT_H
|