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>
This commit is contained in:
Gehad elrobey 2015-08-21 18:01:27 +02:00 committed by Lubomir I. Ivanov
parent c516421bc2
commit 77c81b299b

View file

@ -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) :