aboutsummaryrefslogtreecommitdiffstats
path: root/templatelayout.cpp
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2015-08-21 18:01:27 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-08-22 18:34:06 +0300
commit77c81b299bf376d67435e61cf172d49a3177f680 (patch)
tree4096d8645ae60908c5035c21178f0851b23c105d /templatelayout.cpp
parentc516421bc2ba8bcd70e1ac3e7173f3e9524ecb24 (diff)
downloadsubsurface-77c81b299bf376d67435e61cf172d49a3177f680.tar.gz
Printing: read statistics templates from the "statistics" path
Now there are two types of templates, dive list and statistics. We need to support reading both types of templates. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Diffstat (limited to 'templatelayout.cpp')
-rw-r--r--templatelayout.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/templatelayout.cpp b/templatelayout.cpp
index b0098fbd9..2da048266 100644
--- a/templatelayout.cpp
+++ b/templatelayout.cpp
@@ -4,7 +4,7 @@
#include "helpers.h"
#include "display.h"
-QList<QString> grantlee_templates;
+QList<QString> grantlee_templates, grantlee_statistics_templates;
int getTotalWork(print_options *printOptions)
{
@@ -24,6 +24,7 @@ int getTotalWork(print_options *printOptions)
void find_all_templates()
{
grantlee_templates.clear();
+ grantlee_statistics_templates.clear();
QDir dir(getSubsurfaceDataPath("printing_templates"));
QFileInfoList list = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
foreach (QFileInfo finfo, list) {
@@ -32,6 +33,15 @@ void find_all_templates()
grantlee_templates.append(finfo.fileName());
}
}
+ // find statistics templates
+ dir.setPath(getSubsurfaceDataPath("printing_templates") + QDir::separator() + "statistics");
+ list = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
+ foreach (QFileInfo finfo, list) {
+ QString filename = finfo.fileName();
+ if (filename.at(filename.size() - 1) != '~') {
+ grantlee_statistics_templates.append(finfo.fileName());
+ }
+ }
}
TemplateLayout::TemplateLayout(print_options *PrintOptions, template_options *templateOptions) :