Printing: use grantlee templates from the current existing template list

We use templates from the grantlee templates list created and
dynamically. So we don't need static templates anymore.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
Gehad elrobey 2015-07-24 09:53:07 +02:00 committed by Lubomir I. Ivanov
parent c95358c4b9
commit 2b2c506cb7
5 changed files with 11 additions and 45 deletions

View file

@ -29,16 +29,12 @@ void PrintOptions::setup()
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;
case print_options::CUSTOM:
ui.printTemplate->setCurrentIndex(2);
break;
// insert existing templates in the UI
ui.printTemplate->clear();
qSort(grantlee_templates);
for (QList<QString>::iterator i = grantlee_templates.begin(); i != grantlee_templates.end(); ++i) {
ui.printTemplate->addItem((*i).split('.')[0], QVariant::fromValue(*i));
}
// general print option checkboxes
@ -93,17 +89,7 @@ void PrintOptions::printSelectedClicked(bool 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;
case 2:
printOptions->p_template = print_options::CUSTOM;
break;
}
printOptions->p_template = ui.printTemplate->itemData(index).toString();
}
void PrintOptions::on_editButton_clicked()