summaryrefslogtreecommitdiffstats
path: root/templatelayout.cpp
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2015-07-05 06:21:39 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2015-07-05 21:02:40 +0300
commit605e1e2d93996f57b3e48f698d840f517d84a99d (patch)
tree018975b5a5da85885a44dd2abff341e045d9d38d /templatelayout.cpp
parentc35092f5c9ce30f2b8df4c554302a3e7c8716a07 (diff)
downloadsubsurface-605e1e2d93996f57b3e48f698d840f517d84a99d.tar.gz
Printing: add functions that read/write a template
Read/write templates from files. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Diffstat (limited to 'templatelayout.cpp')
-rw-r--r--templatelayout.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/templatelayout.cpp b/templatelayout.cpp
index fcdd22902..9a9dc9656 100644
--- a/templatelayout.cpp
+++ b/templatelayout.cpp
@@ -89,6 +89,25 @@ QString TemplateLayout::generate()
return htmlContent;
}
+QString TemplateLayout::readTemplate(QString template_name)
+{
+ QFile qfile(getSubsurfaceDataPath("printing_templates") + QDir::separator() + template_name);
+ if (qfile.open(QFile::ReadOnly | QFile::Text)) {
+ QTextStream in(&qfile);
+ return in.readAll();
+ }
+ return "";
+}
+
+void TemplateLayout::writeTemplate(QString template_name, QString grantlee_template)
+{
+ QFile qfile(getSubsurfaceDataPath("printing_templates") + QDir::separator() + template_name);
+ if (qfile.open(QFile::ReadWrite | QFile::Text)) {
+ qfile.write(grantlee_template.toUtf8().data());
+ qfile.close();
+ }
+}
+
Dive::Dive() :
m_number(-1),
dive(NULL)