aboutsummaryrefslogtreecommitdiffstats
path: root/templatelayout.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-19 20:33:54 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-19 20:33:54 -0700
commit56d701dfff72bb4e59f23432c5b7d9c356132412 (patch)
tree6550cb8ef679944f40fd3f93f1f0046ac11523e0 /templatelayout.cpp
parent56b82e0ecf58dd1f2b7585425dbdebbbbe5668a4 (diff)
parentb039e1db8a4d8d745a455dd70b4434acffb5c1c4 (diff)
downloadsubsurface-56d701dfff72bb4e59f23432c5b7d9c356132412.tar.gz
Merge branch 'custom-print' of https://github.com/neolit123/subsurface
Diffstat (limited to 'templatelayout.cpp')
-rw-r--r--templatelayout.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/templatelayout.cpp b/templatelayout.cpp
index a5d4b2329..39bb014d6 100644
--- a/templatelayout.cpp
+++ b/templatelayout.cpp
@@ -3,16 +3,7 @@
#include "templatelayout.h"
#include "helpers.h"
-TemplateLayout::TemplateLayout()
-{
-}
-
-TemplateLayout::~TemplateLayout()
-{
- delete m_engine;
-}
-
-int TemplateLayout::getTotalWork()
+int getTotalWork()
{
int dives = 0, i;
struct dive *dive;
@@ -25,10 +16,21 @@ int TemplateLayout::getTotalWork()
return dives;
}
+TemplateLayout::TemplateLayout(print_options *PrintOptions)
+{
+ this->PrintOptions = PrintOptions;
+}
+
+TemplateLayout::~TemplateLayout()
+{
+ delete m_engine;
+}
+
QString TemplateLayout::generate()
{
int progress = 0;
int totalWork = getTotalWork();
+ QString templateName;
QString htmlContent;
m_engine = new Grantlee::Engine(this);
@@ -58,7 +60,12 @@ QString TemplateLayout::generate()
Grantlee::Context c(mapping);
- Grantlee::Template t = m_engine->loadByName("base.html");
+ if (PrintOptions->p_template == print_options::ONE_DIVE) {
+ templateName = "one_dive.html";
+ } else if (PrintOptions->p_template == print_options::TWO_DIVE) {
+ templateName = "two_dives.html";
+ }
+ Grantlee::Template t = m_engine->loadByName(templateName);
if (!t || t->error()) {
qDebug() << "Can't load template";
return htmlContent;