From a0b8eed61286d87e98e9344f11d65c5c3aa7d636 Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Sat, 30 May 2015 13:10:31 +0200 Subject: [PATCH] Printing: Edit the print options widget Remove obsolete code and add new customizable print code to the options dialog. Signed-off-by: Gehad elrobey Signed-off-by: Lubomir I. Ivanov Signed-off-by: Dirk Hohndel --- display.h | 4 +- qt-ui/printoptions.cpp | 60 ++++++++------------------- qt-ui/printoptions.h | 9 ++-- qt-ui/printoptions.ui | 93 +++++++++++++++--------------------------- 4 files changed, 58 insertions(+), 108 deletions(-) diff --git a/display.h b/display.h index f0101448d..72b5c99fc 100644 --- a/display.h +++ b/display.h @@ -40,7 +40,9 @@ struct print_options { PRETTY, TABLE, TWOPERPAGE, - ONEPERPAGE + ONEPERPAGE, + DIVELIST, + STATISTICS } type; bool print_selected; bool color_selected; diff --git a/qt-ui/printoptions.cpp b/qt-ui/printoptions.cpp index d3e148c69..03f9d19e2 100644 --- a/qt-ui/printoptions.cpp +++ b/qt-ui/printoptions.cpp @@ -17,66 +17,53 @@ void PrintOptions::setup(struct print_options *printOpt) printOptions = printOpt; // print type radio buttons switch (printOptions->type) { - case print_options::PRETTY: - ui.radioSixDives->setChecked(true); - break; - case print_options::TWOPERPAGE: - ui.radioTwoDives->setChecked(true); - break; - case print_options::ONEPERPAGE: - ui.radioOneDive->setChecked(true); + case print_options::DIVELIST: + ui.radioDiveListPrint->setChecked(true); break; case print_options::TABLE: ui.radioTablePrint->setChecked(true); break; + case print_options::STATISTICS: + ui.radioStatisticsPrint->setChecked(true); + break; } + // general print option checkboxes if (printOptions->color_selected) ui.printInColor->setChecked(true); if (printOptions->print_selected) ui.printSelected->setChecked(true); - // ordering - if (printOptions->notes_up) - ui.notesOnTop->setChecked(true); - else - ui.profileOnTop->setChecked(true); // connect slots only once if (hasSetupSlots) return; - connect(ui.radioSixDives, SIGNAL(clicked(bool)), this, SLOT(radioSixDivesClicked(bool))); - connect(ui.radioTwoDives, SIGNAL(clicked(bool)), this, SLOT(radioTwoDivesClicked(bool))); - connect(ui.radioOneDive, SIGNAL(clicked(bool)), this, SLOT(radioOneDiveClicked(bool))); - connect(ui.radioTablePrint, SIGNAL(clicked(bool)), this, SLOT(radioTablePrintClicked(bool))); - connect(ui.printInColor, SIGNAL(clicked(bool)), this, SLOT(printInColorClicked(bool))); connect(ui.printSelected, SIGNAL(clicked(bool)), this, SLOT(printSelectedClicked(bool))); - connect(ui.notesOnTop, SIGNAL(clicked(bool)), this, SLOT(notesOnTopClicked(bool))); - connect(ui.profileOnTop, SIGNAL(clicked(bool)), this, SLOT(profileOnTopClicked(bool))); hasSetupSlots = true; } // print type radio buttons -void PrintOptions::radioSixDivesClicked(bool check) +void PrintOptions::on_radioDiveListPrint_clicked(bool check) { - printOptions->type = print_options::PRETTY; + if (check) { + printOptions->type = print_options::DIVELIST; + } } -void PrintOptions::radioTwoDivesClicked(bool check) +void PrintOptions::on_radioTablePrint_clicked(bool check) { - printOptions->type = print_options::TWOPERPAGE; + if (check) { + printOptions->type = print_options::TABLE; + } } -void PrintOptions::radioOneDiveClicked(bool check) +void PrintOptions::on_radioStatisticsPrint_clicked(bool check) { - printOptions->type = print_options::ONEPERPAGE; -} - -void PrintOptions::radioTablePrintClicked(bool check) -{ - printOptions->type = print_options::TABLE; + if (check) { + printOptions->type = print_options::STATISTICS; + } } // general print option checkboxes @@ -89,14 +76,3 @@ void PrintOptions::printSelectedClicked(bool check) { printOptions->print_selected = check; } - -// ordering -void PrintOptions::notesOnTopClicked(bool check) -{ - printOptions->notes_up = true; -} - -void PrintOptions::profileOnTopClicked(bool check) -{ - printOptions->notes_up = false; -} diff --git a/qt-ui/printoptions.h b/qt-ui/printoptions.h index 658e7ec1d..af845cb19 100644 --- a/qt-ui/printoptions.h +++ b/qt-ui/printoptions.h @@ -20,14 +20,11 @@ private: private slots: - void radioSixDivesClicked(bool check); - void radioTwoDivesClicked(bool check); - void radioOneDiveClicked(bool check); - void radioTablePrintClicked(bool check); void printInColorClicked(bool check); void printSelectedClicked(bool check); - void notesOnTopClicked(bool check); - void profileOnTopClicked(bool check); + void on_radioStatisticsPrint_clicked(bool check); + void on_radioTablePrint_clicked(bool check); + void on_radioDiveListPrint_clicked(bool check); }; #endif // PRINTOPTIONS_H diff --git a/qt-ui/printoptions.ui b/qt-ui/printoptions.ui index 59a48b956..8ec1718af 100644 --- a/qt-ui/printoptions.ui +++ b/qt-ui/printoptions.ui @@ -30,7 +30,7 @@ - + 0 @@ -38,7 +38,7 @@ - &6 dives per page + &Dive list Print true @@ -46,32 +46,6 @@ - - - - 0 - 0 - - - - &1 dive per page - - - - - - - - 0 - 0 - - - - &2 dives per page - - - - @@ -80,7 +54,20 @@ - &Table print + &Table Print + + + + + + + + 0 + 0 + + + + &Statistics Print @@ -136,40 +123,30 @@ - + - Ordering + Template - + - - - - 0 - 0 - - - - Prof&ile on top - - - true - + + + + 2 Dives per page + + - - - - 0 - 0 - + + + + 106 + 26 + - &Notes on top - - - false + Edit @@ -179,12 +156,10 @@ - radioSixDives - radioTwoDives + radioDiveListPrint + radioStatisticsPrint printSelected printInColor - profileOnTop - notesOnTop