summaryrefslogtreecommitdiffstats
path: root/qt-ui/printdialog.cpp
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2015-05-30 15:20:01 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-04 10:08:04 -0700
commit231f90bd268b0b4e930772d295368180d118339d (patch)
treeedf7ae20fd85220b88c066e3ce684010a9de5dd2 /qt-ui/printdialog.cpp
parentb4e1563d10ff1d610fdcd622871620e50b0c5bd5 (diff)
downloadsubsurface-231f90bd268b0b4e930772d295368180d118339d.tar.gz
Printing: call print from printer class
This is the main function that prints dive lists. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/printdialog.cpp')
-rw-r--r--qt-ui/printdialog.cpp16
1 files changed, 14 insertions, 2 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();
}
}