mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
c516421bc2
commit
77c81b299b
1 changed files with 11 additions and 1 deletions
|
@ -4,7 +4,7 @@
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
|
|
||||||
QList<QString> grantlee_templates;
|
QList<QString> grantlee_templates, grantlee_statistics_templates;
|
||||||
|
|
||||||
int getTotalWork(print_options *printOptions)
|
int getTotalWork(print_options *printOptions)
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,7 @@ int getTotalWork(print_options *printOptions)
|
||||||
void find_all_templates()
|
void find_all_templates()
|
||||||
{
|
{
|
||||||
grantlee_templates.clear();
|
grantlee_templates.clear();
|
||||||
|
grantlee_statistics_templates.clear();
|
||||||
QDir dir(getSubsurfaceDataPath("printing_templates"));
|
QDir dir(getSubsurfaceDataPath("printing_templates"));
|
||||||
QFileInfoList list = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
|
QFileInfoList list = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
|
||||||
foreach (QFileInfo finfo, list) {
|
foreach (QFileInfo finfo, list) {
|
||||||
|
@ -32,6 +33,15 @@ void find_all_templates()
|
||||||
grantlee_templates.append(finfo.fileName());
|
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) :
|
TemplateLayout::TemplateLayout(print_options *PrintOptions, template_options *templateOptions) :
|
||||||
|
|
Loading…
Add table
Reference in a new issue