diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/printdialog.cpp | 16 | ||||
-rw-r--r-- | qt-ui/printdialog.h | 4 |
2 files changed, 17 insertions, 3 deletions
diff --git a/qt-ui/printdialog.cpp b/qt-ui/printdialog.cpp index f0814666a..ae119cc3d 100644 --- a/qt-ui/printdialog.cpp +++ b/qt-ui/printdialog.cpp @@ -25,12 +25,15 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f printOptions.print_selected = s.value("print_selected").toBool(); printOptions.color_selected = s.value("color_selected").toBool(); printOptions.landscape = s.value("landscape").toBool(); - printer.setOrientation((QPrinter::Orientation)printOptions.landscape); + qprinter.setOrientation((QPrinter::Orientation)printOptions.landscape); } // create a print options object and pass our options struct optionsWidget = new PrintOptions(this, &printOptions); + // create a new printer object + printer = new Printer(&qprinter); + QVBoxLayout *layout = new QVBoxLayout(this); setLayout(layout); @@ -89,8 +92,17 @@ void PrintDialog::previewClicked(void) void PrintDialog::printClicked(void) { - QPrintDialog printDialog(&printer, this); + QPrintDialog printDialog(&qprinter, this); if (printDialog.exec() == QDialog::Accepted) { + switch (printOptions.type) { + case print_options::DIVELIST: + printer->print(); + break; + case print_options::TABLE: + break; + case print_options::STATISTICS: + break; + } close(); } } diff --git a/qt-ui/printdialog.h b/qt-ui/printdialog.h index bdcfbf733..1c6d30dfd 100644 --- a/qt-ui/printdialog.h +++ b/qt-ui/printdialog.h @@ -4,6 +4,7 @@ #include <QDialog> #include <QPrinter> #include "printoptions.h" +#include "printer.h" class QProgressBar; class PrintOptions; @@ -19,7 +20,8 @@ public: private: PrintOptions *optionsWidget; QProgressBar *progressBar; - QPrinter printer; + Printer *printer; + QPrinter qprinter; struct print_options printOptions; private |