summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/printer.cpp
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2019-09-06 23:17:49 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-09-11 17:21:50 +0100
commitfcf5333bf2caf8eb34e31b9f7cd1d72bf4797115 (patch)
treeebc665a52913fba7c420cf629ff61934cbc30804 /desktop-widgets/printer.cpp
parent18644c89f66091bdde23c7e491c763b49ff4fe2a (diff)
downloadsubsurface-fcf5333bf2caf8eb34e31b9f7cd1d72bf4797115.tar.gz
Add the ability to export print template as html
This way we can view the html generated from a print template, for debugging, validation or printing via your favorite browser. Signed-off-by: Anton Lundin <glance@acc.umu.se>
Diffstat (limited to 'desktop-widgets/printer.cpp')
-rw-r--r--desktop-widgets/printer.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/desktop-widgets/printer.cpp b/desktop-widgets/printer.cpp
index b617fde11..9de1e41be 100644
--- a/desktop-widgets/printer.cpp
+++ b/desktop-widgets/printer.cpp
@@ -195,6 +195,21 @@ void Printer::templateProgessUpdated(int value)
emit progessUpdated(done);
}
+QString Printer::exportHtml() {
+ TemplateLayout t(printOptions, templateOptions);
+ connect(&t, SIGNAL(progressUpdated(int)), this, SLOT(templateProgessUpdated(int)));
+ QString html;
+
+ if (printOptions->type == print_options::DIVELIST) {
+ html = t.generate();
+ } else if (printOptions->type == print_options::STATISTICS ) {
+ html = t.generateStatistics();
+ }
+
+ // TODO: write html to file
+ return html;
+}
+
void Printer::print()
{
// we can only print if "PRINT" mode is selected