diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-06-19 20:33:54 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-19 20:33:54 -0700 |
commit | 56d701dfff72bb4e59f23432c5b7d9c356132412 (patch) | |
tree | 6550cb8ef679944f40fd3f93f1f0046ac11523e0 /qt-ui | |
parent | 56b82e0ecf58dd1f2b7585425dbdebbbbe5668a4 (diff) | |
parent | b039e1db8a4d8d745a455dd70b4434acffb5c1c4 (diff) | |
download | subsurface-56d701dfff72bb4e59f23432c5b7d9c356132412.tar.gz |
Merge branch 'custom-print' of https://github.com/neolit123/subsurface
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/printdialog.cpp | 5 | ||||
-rw-r--r-- | qt-ui/printoptions.cpp | 22 | ||||
-rw-r--r-- | qt-ui/printoptions.h | 5 | ||||
-rw-r--r-- | qt-ui/printoptions.ui | 13 |
4 files changed, 40 insertions, 5 deletions
diff --git a/qt-ui/printdialog.cpp b/qt-ui/printdialog.cpp index e7d9099da..848183882 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); } @@ -33,7 +35,7 @@ PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f optionsWidget = new PrintOptions(this, &printOptions); // create a new printer object - printer = new Printer(&qprinter); + printer = new Printer(&qprinter, &printOptions); QVBoxLayout *layout = new QVBoxLayout(this); setLayout(layout); @@ -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..632b9cdaf 100644 --- a/qt-ui/printoptions.ui +++ b/qt-ui/printoptions.ui @@ -38,7 +38,7 @@ </sizepolicy> </property> <property name="text"> - <string>&Dive list Print</string> + <string>&Dive list print</string> </property> <property name="checked"> <bool>true</bool> @@ -54,7 +54,7 @@ </sizepolicy> </property> <property name="text"> - <string>&Table Print</string> + <string>&Table print</string> </property> </widget> </item> @@ -67,7 +67,7 @@ </sizepolicy> </property> <property name="text"> - <string>&Statistics Print</string> + <string>&Statistics print</string> </property> </widget> </item> @@ -132,7 +132,12 @@ <widget class="QComboBox" name="printTemplate"> <item> <property name="text"> - <string>2 Dives per page</string> + <string>One dive per page</string> + </property> + </item> + <item> + <property name="text"> + <string>Two dives per page</string> </property> </item> </widget> |