From 77c81b299bf376d67435e61cf172d49a3177f680 Mon Sep 17 00:00:00 2001 From: Gehad elrobey Date: Fri, 21 Aug 2015 18:01:27 +0200 Subject: 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 Signed-off-by: Gehad elrobey --- templatelayout.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 grantlee_templates; +QList 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) : -- cgit v1.2.3-70-g09d2