Implement continuous tape labels and path-based label shapes.

- Added "roll" as a special paper id
- Added roll_width attribute to draw tape in previews
- Updated Brother QL-500/* label templates
- Preserve print dialog settings between print jobs.
- Added path based labels for arbitrary shaped labels.
- Fleshed out implementation of continuous labels.
This commit is contained in:
Jim Evins
2018-08-11 14:05:26 -04:00
parent b9a1f2e150
commit 467ca9fc62
135 changed files with 41934 additions and 13681 deletions
+27 -20
View File
@@ -20,6 +20,9 @@
#include "SimplePreview.h"
#include "RollTemplatePath.h"
#include <QGraphicsPathItem>
#include <QGraphicsRectItem>
#include <QGraphicsDropShadowEffect>
#include <QtDebug>
@@ -33,7 +36,7 @@ namespace glabels
//
namespace
{
const QColor paperColor( 255, 255, 255 );
const QColor paperColor( 242, 242, 242 );
const QColor paperOutlineColor( 0, 0, 0 );
const double paperOutlineWidthPixels = 1;
@@ -105,43 +108,39 @@ namespace glabels
///
void SimplePreview::update()
{
clearScene();
mScene->clear();
if ( mTmplate != nullptr )
{
// For "Roll" templates, allow extra room to draw continuation break lines.
model::Distance drawHeight = mTmplate->pageHeight();
model::Distance drawOffset = 0;
if ( mTmplate->isRoll() )
{
drawHeight = 1.2 * mTmplate->pageHeight();
drawOffset = 0.1 * mTmplate->pageHeight();
}
// Set scene up with a 5% margin around paper
model::Distance x = -0.05 * mTmplate->pageWidth();
model::Distance y = -0.05 * mTmplate->pageHeight();
model::Distance y = -0.05 * drawHeight - drawOffset;
model::Distance w = 1.10 * mTmplate->pageWidth();
model::Distance h = 1.10 * mTmplate->pageHeight();
model::Distance h = 1.10 * drawHeight;
mScene->setSceneRect( x.pt(), y.pt(), w.pt(), h.pt() );
fitInView( mScene->sceneRect(), Qt::KeepAspectRatio );
drawPaper( mTmplate->pageWidth(), mTmplate->pageHeight() );
drawPaper();
drawLabels();
drawArrow();
}
}
///
/// Clear View
///
void SimplePreview::clearScene()
{
foreach ( QGraphicsItem *item, mScene->items() )
{
mScene->removeItem( item );
delete item;
}
}
///
/// Draw Paper
///
void SimplePreview::drawPaper( const model::Distance& pw, const model::Distance& ph )
void SimplePreview::drawPaper()
{
auto *shadowEffect = new QGraphicsDropShadowEffect();
shadowEffect->setColor( shadowColor );
@@ -153,7 +152,15 @@ namespace glabels
pen.setCosmetic( true );
pen.setWidthF( paperOutlineWidthPixels );
auto *pageItem = new QGraphicsRectItem( 0, 0, pw.pt(), ph.pt() );
QAbstractGraphicsShapeItem* pageItem;
if ( !mTmplate->isRoll() )
{
pageItem = new QGraphicsRectItem( 0, 0, mTmplate->pageWidth().pt(), mTmplate->pageHeight().pt() );
}
else
{
pageItem = new QGraphicsPathItem( RollTemplatePath( mTmplate ) );
}
pageItem->setBrush( brush );
pageItem->setPen( pen );
pageItem->setGraphicsEffect( shadowEffect );