summaryrefslogtreecommitdiffstats
path: root/qt-ui/templateedit.cpp
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2015-08-27 22:40:04 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-16 21:17:22 -0700
commit27bec9bc7b2a163f680d1fb03f53b4bcaecd1234 (patch)
tree4af0b29835f3ff9fef005a7b126f8333530a3b83 /qt-ui/templateedit.cpp
parent3d8e5b638ad4c1fbb43f6dd5f535bf0b33a51f0b (diff)
downloadsubsurface-27bec9bc7b2a163f680d1fb03f53b4bcaecd1234.tar.gz
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>
Diffstat (limited to 'qt-ui/templateedit.cpp')
-rw-r--r--qt-ui/templateedit.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/qt-ui/templateedit.cpp b/qt-ui/templateedit.cpp
index b50338090..7ca84c88a 100644
--- a/qt-ui/templateedit.cpp
+++ b/qt-ui/templateedit.cpp
@@ -75,6 +75,9 @@ void TemplateEdit::updatePreview()
// update critical UI elements
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)
@@ -128,8 +131,7 @@ void TemplateEdit::saveSettings()
if (msgBox.exec() == QMessageBox::Save) {
memcpy(templateOptions, &newTemplateOptions, sizeof(struct template_options));
if (grantlee_template.compare(ui->plainTextEdit->toPlainText())) {
- printOptions->p_template = "Custom.html";
- TemplateLayout::writeTemplate("Custom.html", ui->plainTextEdit->toPlainText());
+ TemplateLayout::writeTemplate(printOptions->p_template, ui->plainTextEdit->toPlainText());
}
if (templateOptions->color_palette_index == CUSTOM) {
custom_colors = templateOptions->color_palette;