summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--printing_templates/custom.html50
-rw-r--r--qt-ui/printoptions.cpp6
-rw-r--r--qt-ui/printoptions.h3
-rw-r--r--qt-ui/printoptions.ui5
-rw-r--r--templatelayout.cpp2
5 files changed, 65 insertions, 1 deletions
diff --git a/printing_templates/custom.html b/printing_templates/custom.html
new file mode 100644
index 000000000..52fdb4b49
--- /dev/null
+++ b/printing_templates/custom.html
@@ -0,0 +1,50 @@
+<html>
+<head>
+ <style>
+ body {
+ background-color: white;
+ padding: 0;
+ margin: 0;
+ font-size: {{ template_options.font_size }}vw;
+ line-height: {{ template_options.line_spacing }};
+ font-family: {{ template_options.font }};
+ }
+
+ h1 {
+ float: left;
+ font-size: {{ template_options.font_size }}vw;
+ }
+
+ .mainContainer {
+ width: 96%;
+ height: 100%;
+ margin-left: 2%;
+ margin-right: 2%;
+ margin-top: 0%;
+ margin-bottom: 0%;
+ overflow: hidden;
+ border-width: 0;
+ page-break-inside: avoid;
+ }
+
+ .innerContainer {
+ width: 98%;
+ height: 98%;
+ padding: 1%;
+ overflow: hidden;
+ }
+ </style>
+</head>
+<body data-numberofdives = 1>
+{% block main_rows %}
+ {% for dive in dives %}
+ <div class="mainContainer">
+ <div class="innerContainer">
+ <h1>This template is empty</h1>
+ <!-- Template must be filled -->
+ </div>
+ </div>
+ {% endfor %}
+{% endblock %}
+</body>
+</html>
diff --git a/qt-ui/printoptions.cpp b/qt-ui/printoptions.cpp
index a7c520b21..cd38e3560 100644
--- a/qt-ui/printoptions.cpp
+++ b/qt-ui/printoptions.cpp
@@ -36,6 +36,9 @@ void PrintOptions::setup(struct print_options *printOpt)
case print_options::TWO_DIVE:
ui.printTemplate->setCurrentIndex(1);
break;
+ case print_options::CUSTOM:
+ ui.printTemplate->setCurrentIndex(2);
+ break;
}
// general print option checkboxes
@@ -97,6 +100,9 @@ void PrintOptions::on_printTemplate_currentIndexChanged(int index)
case 1:
printOptions->p_template = print_options::TWO_DIVE;
break;
+ case 2:
+ printOptions->p_template = print_options::CUSTOM;
+ break;
}
}
diff --git a/qt-ui/printoptions.h b/qt-ui/printoptions.h
index 9bacd4e90..1d806b116 100644
--- a/qt-ui/printoptions.h
+++ b/qt-ui/printoptions.h
@@ -13,7 +13,8 @@ struct print_options {
} type;
enum print_template {
ONE_DIVE,
- TWO_DIVE
+ TWO_DIVE,
+ CUSTOM
} p_template;
bool print_selected;
bool color_selected;
diff --git a/qt-ui/printoptions.ui b/qt-ui/printoptions.ui
index 632b9cdaf..7e66d4cb0 100644
--- a/qt-ui/printoptions.ui
+++ b/qt-ui/printoptions.ui
@@ -140,6 +140,11 @@
<string>Two dives per page</string>
</property>
</item>
+ <item>
+ <property name="text">
+ <string>Custom template</string>
+ </property>
+ </item>
</widget>
</item>
<item>
diff --git a/templatelayout.cpp b/templatelayout.cpp
index 2a5bb8ff7..fcdd22902 100644
--- a/templatelayout.cpp
+++ b/templatelayout.cpp
@@ -71,6 +71,8 @@ QString TemplateLayout::generate()
templateName = "one_dive.html";
} else if (PrintOptions->p_template == print_options::TWO_DIVE) {
templateName = "two_dives.html";
+ } else if (PrintOptions->p_template == print_options::CUSTOM) {
+ templateName = "custom.html";
}
Grantlee::Template t = m_engine->loadByName(templateName);
if (!t || t->error()) {