mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-17 20:16:16 +00:00
Printing: add custom options to the PrintDialog
Add: -custom.html template -custom template to print_options struct -options to the options dialog Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
815072d2ae
commit
c35092f5c9
5 changed files with 65 additions and 1 deletions
50
printing_templates/custom.html
Normal file
50
printing_templates/custom.html
Normal file
|
@ -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>
|
|
@ -36,6 +36,9 @@ void PrintOptions::setup(struct print_options *printOpt)
|
||||||
case print_options::TWO_DIVE:
|
case print_options::TWO_DIVE:
|
||||||
ui.printTemplate->setCurrentIndex(1);
|
ui.printTemplate->setCurrentIndex(1);
|
||||||
break;
|
break;
|
||||||
|
case print_options::CUSTOM:
|
||||||
|
ui.printTemplate->setCurrentIndex(2);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// general print option checkboxes
|
// general print option checkboxes
|
||||||
|
@ -97,6 +100,9 @@ void PrintOptions::on_printTemplate_currentIndexChanged(int index)
|
||||||
case 1:
|
case 1:
|
||||||
printOptions->p_template = print_options::TWO_DIVE;
|
printOptions->p_template = print_options::TWO_DIVE;
|
||||||
break;
|
break;
|
||||||
|
case 2:
|
||||||
|
printOptions->p_template = print_options::CUSTOM;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,8 @@ struct print_options {
|
||||||
} type;
|
} type;
|
||||||
enum print_template {
|
enum print_template {
|
||||||
ONE_DIVE,
|
ONE_DIVE,
|
||||||
TWO_DIVE
|
TWO_DIVE,
|
||||||
|
CUSTOM
|
||||||
} p_template;
|
} p_template;
|
||||||
bool print_selected;
|
bool print_selected;
|
||||||
bool color_selected;
|
bool color_selected;
|
||||||
|
|
|
@ -140,6 +140,11 @@
|
||||||
<string>Two dives per page</string>
|
<string>Two dives per page</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Custom template</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -71,6 +71,8 @@ QString TemplateLayout::generate()
|
||||||
templateName = "one_dive.html";
|
templateName = "one_dive.html";
|
||||||
} else if (PrintOptions->p_template == print_options::TWO_DIVE) {
|
} else if (PrintOptions->p_template == print_options::TWO_DIVE) {
|
||||||
templateName = "two_dives.html";
|
templateName = "two_dives.html";
|
||||||
|
} else if (PrintOptions->p_template == print_options::CUSTOM) {
|
||||||
|
templateName = "custom.html";
|
||||||
}
|
}
|
||||||
Grantlee::Template t = m_engine->loadByName(templateName);
|
Grantlee::Template t = m_engine->loadByName(templateName);
|
||||||
if (!t || t->error()) {
|
if (!t || t->error()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue