summaryrefslogtreecommitdiffstats
path: root/qt-ui/printoptions.cpp
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2015-07-24 09:53:07 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-07-28 11:37:30 +0300
commit2b2c506cb7e5e1659ad68818eca46d14d7840ecd (patch)
tree1085b0d8faa43c12818b89a4cfc7666a481457d0 /qt-ui/printoptions.cpp
parentc95358c4b9c39016d08c234fb7e5db4958ff381e (diff)
downloadsubsurface-2b2c506cb7e5e1659ad68818eca46d14d7840ecd.tar.gz
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>
Diffstat (limited to 'qt-ui/printoptions.cpp')
-rw-r--r--qt-ui/printoptions.cpp28
1 files changed, 7 insertions, 21 deletions
diff --git a/qt-ui/printoptions.cpp b/qt-ui/printoptions.cpp
index 0e6a0b320..3ed3edf11 100644
--- a/qt-ui/printoptions.cpp
+++ b/qt-ui/printoptions.cpp
@@ -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()