Printing: Edit the print options widget

Remove obsolete code and add new customizable print code to the options
dialog.

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>
This commit is contained in:
Gehad elrobey 2015-05-30 13:10:31 +02:00 committed by Dirk Hohndel
parent 912606e1c7
commit a0b8eed612
4 changed files with 58 additions and 108 deletions

View file

@ -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;
}