mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Printing: pass the template_options struct to TemplateLayout
The template_options struct needs to be passed to TemplateLayout constructor. Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
71561e720d
commit
bc80fc8849
5 changed files with 15 additions and 6 deletions
|
@ -19,10 +19,11 @@ int getTotalWork(print_options *printOptions)
|
|||
return dives;
|
||||
}
|
||||
|
||||
TemplateLayout::TemplateLayout(print_options *PrintOptions) :
|
||||
TemplateLayout::TemplateLayout(print_options *PrintOptions, template_options *templateOptions) :
|
||||
m_engine(NULL)
|
||||
{
|
||||
this->PrintOptions = PrintOptions;
|
||||
this->templateOptions = templateOptions;
|
||||
}
|
||||
|
||||
TemplateLayout::~TemplateLayout()
|
||||
|
@ -45,6 +46,7 @@ QString TemplateLayout::generate()
|
|||
m_engine->addTemplateLoader(m_templateLoader);
|
||||
|
||||
Grantlee::registerMetaType<Dive>();
|
||||
Grantlee::registerMetaType<template_options>();
|
||||
|
||||
QVariantHash mapping;
|
||||
QVariantList diveList;
|
||||
|
@ -61,6 +63,7 @@ QString TemplateLayout::generate()
|
|||
emit progressUpdated(progress * 100.0 / totalWork);
|
||||
}
|
||||
mapping.insert("dives", diveList);
|
||||
mapping.insert("template_options", QVariant::fromValue(*templateOptions));
|
||||
|
||||
Grantlee::Context c(mapping);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue