diff options
-rw-r--r-- | qt-ui/printdialog.cpp | 3 | ||||
-rw-r--r-- | qt-ui/printoptions.cpp | 22 | ||||
-rw-r--r-- | qt-ui/printoptions.h | 5 | ||||
-rw-r--r-- | qt-ui/printoptions.ui | 5 |
4 files changed, 35 insertions, 0 deletions
diff --git a/qt-ui/printdialog.cpp b/qt-ui/printdialog.cpp index e7d9099da..4f8a67da1 100644 --- a/qt-ui/printdialog.cpp +++ b/qt-ui/printdialog.cpp @@ -20,12 +20,14 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f printOptions.print_selected = true; printOptions.color_selected = true; printOptions.landscape = false; + printOptions.p_template = print_options::ONE_DIVE; } else { s.beginGroup(SETTINGS_GROUP); printOptions.type = (print_options::print_type)s.value("type").toInt(); printOptions.print_selected = s.value("print_selected").toBool(); printOptions.color_selected = s.value("color_selected").toBool(); printOptions.landscape = s.value("landscape").toBool(); + printOptions.p_template = (print_options::print_template)s.value("template_selected").toInt(); qprinter.setOrientation((QPrinter::Orientation)printOptions.landscape); } @@ -85,6 +87,7 @@ void PrintDialog::onFinished() s.setValue("type", printOptions.type); s.setValue("print_selected", printOptions.print_selected); s.setValue("color_selected", printOptions.color_selected); + s.setValue("template_selected", printOptions.p_template); } void PrintDialog::previewClicked(void) diff --git a/qt-ui/printoptions.cpp b/qt-ui/printoptions.cpp index 50ca8b7c2..e2684b6ed 100644 --- a/qt-ui/printoptions.cpp +++ b/qt-ui/printoptions.cpp @@ -1,4 +1,5 @@ #include "printoptions.h" +#include <QDebug> PrintOptions::PrintOptions(QWidget *parent, struct print_options *printOpt) { @@ -26,6 +27,14 @@ void PrintOptions::setup(struct print_options *printOpt) ui.radioStatisticsPrint->setChecked(true); break; } + switch (printOptions->p_template) { + case print_options::ONE_DIVE: + ui.printTemplate->setCurrentIndex(0); + break; + case print_options::TWO_DIVE: + ui.printTemplate->setCurrentIndex(1); + break; + } // general print option checkboxes if (printOptions->color_selected) @@ -75,3 +84,16 @@ void PrintOptions::printSelectedClicked(bool check) { printOptions->print_selected = check; } + + +void PrintOptions::on_printTemplate_currentIndexChanged(int index) +{ + switch(index){ + case 0: + printOptions->p_template = print_options::ONE_DIVE; + break; + case 1: + printOptions->p_template = print_options::TWO_DIVE; + break; + } +} diff --git a/qt-ui/printoptions.h b/qt-ui/printoptions.h index 1e12efae7..13ef4e310 100644 --- a/qt-ui/printoptions.h +++ b/qt-ui/printoptions.h @@ -11,6 +11,10 @@ struct print_options { TABLE, STATISTICS } type; + enum print_template { + ONE_DIVE, + TWO_DIVE + } p_template; bool print_selected; bool color_selected; bool landscape; @@ -36,6 +40,7 @@ slots: void on_radioStatisticsPrint_clicked(bool check); void on_radioTablePrint_clicked(bool check); void on_radioDiveListPrint_clicked(bool check); + void on_printTemplate_currentIndexChanged(int index); }; #endif // PRINTOPTIONS_H diff --git a/qt-ui/printoptions.ui b/qt-ui/printoptions.ui index 8ec1718af..2d737d5ce 100644 --- a/qt-ui/printoptions.ui +++ b/qt-ui/printoptions.ui @@ -132,6 +132,11 @@ <widget class="QComboBox" name="printTemplate"> <item> <property name="text"> + <string>1 Dive per page</string> + </property> + </item> + <item> + <property name="text"> <string>2 Dives per page</string> </property> </item> |