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>
This commit is contained in:
Anton Lundin 2019-09-06 23:17:49 +02:00 committed by Dirk Hohndel
parent 18644c89f6
commit fcf5333bf2
4 changed files with 41 additions and 0 deletions

View file

@ -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