mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Printing: search for grantlee templates in the templates directory
We need to dynamically look up for all the existing templates in the template directory. A grantlee template can be named any name but we ignore files ending with '~'. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
0b085f79b1
commit
f76ebe3b9d
3 changed files with 20 additions and 0 deletions
|
@ -199,6 +199,9 @@ MainWindow::MainWindow() : QMainWindow(),
|
|||
ReverseGeoLookupThread *geoLookup = ReverseGeoLookupThread::instance();
|
||||
connect(geoLookup, SIGNAL(started()),information(), SLOT(disableGeoLookupEdition()));
|
||||
connect(geoLookup, SIGNAL(finished()), information(), SLOT(enableGeoLookupEdition()));
|
||||
#ifndef NO_PRINTING
|
||||
find_all_templates();
|
||||
#endif
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include "helpers.h"
|
||||
#include "display.h"
|
||||
|
||||
QList<QString> grantlee_templates;
|
||||
|
||||
int getTotalWork(print_options *printOptions)
|
||||
{
|
||||
if (printOptions->print_selected) {
|
||||
|
@ -19,6 +21,18 @@ int getTotalWork(print_options *printOptions)
|
|||
return dives;
|
||||
}
|
||||
|
||||
void find_all_templates()
|
||||
{
|
||||
QDir dir(getSubsurfaceDataPath("printing_templates"));
|
||||
QFileInfoList list = dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot);
|
||||
foreach (QFileInfo finfo, list) {
|
||||
QString filename = finfo.fileName();
|
||||
if (filename.at(filename.size() - 1) != '~') {
|
||||
grantlee_templates.append(finfo.fileName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TemplateLayout::TemplateLayout(print_options *PrintOptions, template_options *templateOptions) :
|
||||
m_engine(NULL)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
#include "printoptions.h"
|
||||
|
||||
int getTotalWork(print_options *printOptions);
|
||||
void find_all_templates();
|
||||
|
||||
extern QList<QString> grantlee_templates;
|
||||
|
||||
class TemplateLayout : public QObject {
|
||||
Q_OBJECT
|
||||
|
|
Loading…
Add table
Reference in a new issue