From 69f2921ffa856e93acb9bc920f3f761db2831880 Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Fri, 21 Aug 2015 19:12:33 +0200 Subject: Printing: use the same code for both statistics and divelist print - use the same generic code for both types of templates - check for the printing type before generating the template - remove unused printStatistics() method Signed-off-by: Lubomir I. Ivanov Signed-off-by: Gehad elrobey --- qt-ui/printdialog.cpp | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'qt-ui/printdialog.cpp') diff --git a/qt-ui/printdialog.cpp b/qt-ui/printdialog.cpp index 002f9b9f4..cf08062d2 100644 --- a/qt-ui/printdialog.cpp +++ b/qt-ui/printdialog.cpp @@ -178,15 +178,8 @@ void PrintDialog::printClicked(void) { QPrintDialog printDialog(&qprinter, this); if (printDialog.exec() == QDialog::Accepted) { - switch (printOptions.type) { - case print_options::DIVELIST: - connect(printer, SIGNAL(progessUpdated(int)), progressBar, SLOT(setValue(int))); - printer->print(); - break; - case print_options::STATISTICS: - printer->print_statistics(); - break; - } + connect(printer, SIGNAL(progessUpdated(int)), progressBar, SLOT(setValue(int))); + printer->print(); close(); } } @@ -194,14 +187,7 @@ void PrintDialog::printClicked(void) void PrintDialog::onPaintRequested(QPrinter *printerPtr) { connect(printer, SIGNAL(progessUpdated(int)), progressBar, SLOT(setValue(int))); - switch (printOptions.type) { - case print_options::DIVELIST: - printer->print(); - break; - case print_options::STATISTICS: - printer->print_statistics(); - break; - } + printer->print(); progressBar->setValue(0); disconnect(printer, SIGNAL(progessUpdated(int)), progressBar, SLOT(setValue(int))); } -- cgit v1.2.3-70-g09d2