Add generic templates (#307)

- Add generic full-page templates.  (This feature from 3.4 was missing)
- Also add generic half-page, quarter-page, and envelope templates.
- Add several more common envelope sizes to page-sizes.xml
- Qt print backend does not need pwg_size.
    - Replace with pwg_class, to distinguish between ISO and NA sizes
This commit is contained in:
Jaye Evins
2026-02-11 11:27:41 -05:00
committed by GitHub
parent 993e1e460d
commit e6673a0a24
15 changed files with 369 additions and 67 deletions
+27 -5
View File
@@ -24,6 +24,7 @@
#include "Config.hpp"
#include "StrUtil.hpp"
#include "FileUtil.hpp"
#include "GenericTemplate.hpp"
#include "Settings.hpp"
#include "XmlCategoryParser.hpp"
#include "XmlPaperParser.hpp"
@@ -87,6 +88,7 @@ namespace glabels::model
readCategories();
readVendors();
readTemplates();
createGenericTemplates();
}
@@ -470,11 +472,12 @@ namespace glabels::model
for ( auto& paper : mPapers )
{
qDebug() << "paper "
<< "id=" << paper.id() << ", "
<< "name=" << paper.name() << ", "
<< "width=" << paper.width().pt() << "pts, "
<< "height=" << paper.height().pt() << "pts, "
<< "pwg_size=" << paper.pwgSize();
<< "id=" << paper.id() << ", "
<< "name=" << paper.name() << ", "
<< "width=" << paper.width().pt() << "pts, "
<< "height=" << paper.height().pt() << "pts, "
<< "pwg_class=" << paper.pwgClass()
<< "type=" << paper.type();
}
qDebug();
@@ -697,6 +700,25 @@ namespace glabels::model
}
void Db::createGenericTemplates()
{
for ( auto& paper : papers() )
{
if ( paper.type() == Paper::SHEET )
{
registerTemplate( GenericTemplate::fullPage( paper ) );
registerTemplate( GenericTemplate::halfPage1x2( paper ) );
registerTemplate( GenericTemplate::halfPage2x1( paper ) );
registerTemplate( GenericTemplate::quarterPage2x2( paper ) );
}
else if ( paper.type() == Paper::ENVELOPE )
{
registerTemplate( GenericTemplate::envelope( paper ) );
}
}
}
void Db::readUserTemplatesFromDir( const QDir& dir )
{
QStringList filters;