diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2015-07-24 14:27:33 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2015-07-28 11:37:33 +0300 |
commit | 2a85be91b1bc3ae80a75e5508ffdfc7b7e4c1daa (patch) | |
tree | 54b98e741b7c25a3d228c5bd59b84291fedf0e5b /qt-ui/printoptions.cpp | |
parent | 2b2c506cb7e5e1659ad68818eca46d14d7840ecd (diff) | |
download | subsurface-2a85be91b1bc3ae80a75e5508ffdfc7b7e4c1daa.tar.gz |
Printing: save/load selected template by QSettings
We save the selected template name on closing the printDialog, We also
load the last selected template from QSettings when initializing the
dialog.
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.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/qt-ui/printoptions.cpp b/qt-ui/printoptions.cpp index 3ed3edf11..df49694ee 100644 --- a/qt-ui/printoptions.cpp +++ b/qt-ui/printoptions.cpp @@ -30,12 +30,20 @@ void PrintOptions::setup() break; } - // insert existing templates in the UI - ui.printTemplate->clear(); + // insert existing templates in the UI and select the current template qSort(grantlee_templates); + int current_index = 0; + for (QList<QString>::iterator i = grantlee_templates.begin(); i != grantlee_templates.end(); ++i) { + if ((*i).compare(printOptions->p_template) == 0) { + break; + } + current_index++; + } + ui.printTemplate->clear(); for (QList<QString>::iterator i = grantlee_templates.begin(); i != grantlee_templates.end(); ++i) { ui.printTemplate->addItem((*i).split('.')[0], QVariant::fromValue(*i)); } + ui.printTemplate->setCurrentIndex(current_index); // general print option checkboxes if (printOptions->color_selected) |