mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Printing: support in-place editing for templates
Edit the templates into the same file, which is more intuitive as Custom.html is a bit confusing. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
3d8e5b638a
commit
27bec9bc7b
2 changed files with 4 additions and 52 deletions
|
@ -1,50 +0,0 @@
|
||||||
<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>
|
|
|
@ -75,6 +75,9 @@ void TemplateEdit::updatePreview()
|
||||||
|
|
||||||
// update critical UI elements
|
// update critical UI elements
|
||||||
ui->colorpalette->setCurrentIndex(newTemplateOptions.color_palette_index);
|
ui->colorpalette->setCurrentIndex(newTemplateOptions.color_palette_index);
|
||||||
|
|
||||||
|
// update grantlee template string
|
||||||
|
grantlee_template = TemplateLayout::readTemplate(printOptions->p_template);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TemplateEdit::on_fontsize_valueChanged(int font_size)
|
void TemplateEdit::on_fontsize_valueChanged(int font_size)
|
||||||
|
@ -128,8 +131,7 @@ void TemplateEdit::saveSettings()
|
||||||
if (msgBox.exec() == QMessageBox::Save) {
|
if (msgBox.exec() == QMessageBox::Save) {
|
||||||
memcpy(templateOptions, &newTemplateOptions, sizeof(struct template_options));
|
memcpy(templateOptions, &newTemplateOptions, sizeof(struct template_options));
|
||||||
if (grantlee_template.compare(ui->plainTextEdit->toPlainText())) {
|
if (grantlee_template.compare(ui->plainTextEdit->toPlainText())) {
|
||||||
printOptions->p_template = "Custom.html";
|
TemplateLayout::writeTemplate(printOptions->p_template, ui->plainTextEdit->toPlainText());
|
||||||
TemplateLayout::writeTemplate("Custom.html", ui->plainTextEdit->toPlainText());
|
|
||||||
}
|
}
|
||||||
if (templateOptions->color_palette_index == CUSTOM) {
|
if (templateOptions->color_palette_index == CUSTOM) {
|
||||||
custom_colors = templateOptions->color_palette;
|
custom_colors = templateOptions->color_palette;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue