diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-07-05 12:01:43 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-07-05 12:01:43 -0700 |
commit | 9c6a3a7ff387578ddede2e69d8b994a11cf8eaee (patch) | |
tree | 72a08592a24d8d3d1f4fc7d7713da8029bc80c3f /templatelayout.h | |
parent | 35dc81410518e6d39ba8b3f99348884778bedc5b (diff) | |
parent | cc53dc7acf801f022612678f697e6d76c2443153 (diff) | |
download | subsurface-9c6a3a7ff387578ddede2e69d8b994a11cf8eaee.tar.gz |
Merge branch 'custom-print' of github.com:neolit123/subsurface
Diffstat (limited to 'templatelayout.h')
-rw-r--r-- | templatelayout.h | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/templatelayout.h b/templatelayout.h index 21eae1b80..622f7d7a0 100644 --- a/templatelayout.h +++ b/templatelayout.h @@ -5,18 +5,21 @@ #include "mainwindow.h" #include "printoptions.h" -int getTotalWork(); +int getTotalWork(print_options *printOptions); class TemplateLayout : public QObject { Q_OBJECT public: - TemplateLayout(print_options *PrintOptions); + TemplateLayout(print_options *PrintOptions, template_options *templateOptions); ~TemplateLayout(); QString generate(); + static QString readTemplate(QString template_name); + static void writeTemplate(QString template_name, QString grantlee_template); private: Grantlee::Engine *m_engine; print_options *PrintOptions; + template_options *templateOptions; signals: void progressUpdated(int value); @@ -75,6 +78,7 @@ public: }; Q_DECLARE_METATYPE(Dive) +Q_DECLARE_METATYPE(template_options) GRANTLEE_BEGIN_LOOKUP(Dive) if (property == "number") @@ -101,4 +105,25 @@ else if (property == "notes") return object.notes(); GRANTLEE_END_LOOKUP +GRANTLEE_BEGIN_LOOKUP(template_options) +if (property == "font") { + switch (object.font_index) { + case 0: + return "Arial, Helvetica, sans-serif"; + case 1: + return "Impact, Charcoal, sans-serif"; + case 2: + return "Georgia, serif"; + case 3: + return "Courier, monospace"; + case 4: + return "Verdana, Geneva, sans-serif"; + } +} else if (property == "font_size") { + return object.font_size / 9.0; +} else if (property == "line_spacing") { + return object.line_spacing; +} +GRANTLEE_END_LOOKUP + #endif |