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:
@@ -31,6 +31,7 @@ set (glabels_sources
|
||||
PropertiesView.cpp
|
||||
Preview.cpp
|
||||
PreviewOverlayItem.cpp
|
||||
RollTemplatePath.cpp
|
||||
SelectProductDialog.cpp
|
||||
SimplePreview.cpp
|
||||
StartupView.cpp
|
||||
@@ -85,6 +86,8 @@ set (glabels_forms
|
||||
ui/TemplateDesignerRoundPage.ui
|
||||
ui/TemplateDesignerEllipsePage.ui
|
||||
ui/TemplateDesignerCdPage.ui
|
||||
ui/TemplateDesignerPathPage.ui
|
||||
ui/TemplateDesignerContinuousPage.ui
|
||||
ui/TemplateDesignerNLayoutsPage.ui
|
||||
ui/TemplateDesignerOneLayoutPage.ui
|
||||
ui/TemplateDesignerTwoLayoutPage.ui
|
||||
|
||||
+3
-2
@@ -56,12 +56,13 @@ namespace glabels
|
||||
{
|
||||
auto* model = new model::Model();
|
||||
model->setTmplate( tmplate );
|
||||
model->clearModified();
|
||||
|
||||
|
||||
// Intelligently decide to rotate label by default
|
||||
const model::Frame* frame = tmplate->frames().first();
|
||||
model->setRotate( frame->h() > frame->w() );
|
||||
|
||||
model->clearModified();
|
||||
|
||||
// Either apply to current window or open a new one
|
||||
if ( window->isEmpty() )
|
||||
{
|
||||
|
||||
@@ -1143,7 +1143,7 @@ namespace glabels
|
||||
|
||||
foreach( model::Markup* markup, mModel->frame()->markups() )
|
||||
{
|
||||
painter->drawPath( markup->path() );
|
||||
painter->drawPath( markup->path( mModel->frame() ) );
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "MiniPreviewPixmap.h"
|
||||
|
||||
|
||||
#include "RollTemplatePath.h"
|
||||
#include "model/Template.h"
|
||||
|
||||
|
||||
@@ -63,16 +65,25 @@ namespace glabels
|
||||
painter.setBackgroundMode( Qt::TransparentMode );
|
||||
painter.setRenderHint( QPainter::Antialiasing, true );
|
||||
|
||||
// For "Roll" templates, allow extra room for tape width and continuation break lines
|
||||
model::Distance drawWidth = tmplate->pageWidth();
|
||||
model::Distance drawHeight = tmplate->pageHeight();
|
||||
if ( tmplate->isRoll() )
|
||||
{
|
||||
drawWidth = tmplate->rollWidth();
|
||||
drawHeight *= 1.2;
|
||||
}
|
||||
|
||||
double w = width - 1;
|
||||
double h = height - 1;
|
||||
double scale;
|
||||
if ( (w/tmplate->pageWidth().pt()) > (h/tmplate->pageHeight().pt()) )
|
||||
if ( (w/drawWidth.pt()) > (h/drawHeight.pt()) )
|
||||
{
|
||||
scale = h / tmplate->pageHeight().pt();
|
||||
scale = h / drawHeight.pt();
|
||||
}
|
||||
else
|
||||
{
|
||||
scale = w / tmplate->pageWidth().pt();
|
||||
scale = w / drawWidth.pt();
|
||||
}
|
||||
painter.scale( scale, scale );
|
||||
|
||||
@@ -95,7 +106,15 @@ namespace glabels
|
||||
|
||||
painter.setBrush( brush );
|
||||
painter.setPen( pen );
|
||||
painter.drawRect( 0, 0, tmplate->pageWidth().pt(), tmplate->pageHeight().pt() );
|
||||
|
||||
if ( !tmplate->isRoll() )
|
||||
{
|
||||
painter.drawRect( 0, 0, tmplate->pageWidth().pt(), tmplate->pageHeight().pt() );
|
||||
}
|
||||
else
|
||||
{
|
||||
painter.drawPath( RollTemplatePath( tmplate ) );
|
||||
}
|
||||
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
+32
-25
@@ -21,6 +21,7 @@
|
||||
#include "Preview.h"
|
||||
|
||||
#include "PreviewOverlayItem.h"
|
||||
#include "RollTemplatePath.h"
|
||||
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
#include <QGraphicsRectItem>
|
||||
@@ -35,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;
|
||||
|
||||
@@ -44,7 +45,7 @@ namespace glabels
|
||||
const double shadowRadiusPixels = 12;
|
||||
|
||||
const QColor labelColor( 255, 255, 255 );
|
||||
const QColor labelOutlineColor( 215, 215, 215 );
|
||||
const QColor labelOutlineColor( 192, 192, 192 );
|
||||
const double labelOutlineWidthPixels = 1;
|
||||
}
|
||||
|
||||
@@ -85,20 +86,31 @@ namespace glabels
|
||||
{
|
||||
mModel = mRenderer->model();
|
||||
|
||||
clearScene();
|
||||
mScene->clear();
|
||||
|
||||
if ( mModel != nullptr )
|
||||
{
|
||||
auto tmplate = mModel->tmplate();
|
||||
|
||||
// For "Roll" templates, allow extra room to draw continuation break lines.
|
||||
model::Distance drawHeight = mModel->tmplate()->pageHeight();
|
||||
model::Distance drawOffset = 0;
|
||||
if ( tmplate->isRoll() )
|
||||
{
|
||||
drawHeight = 1.2 * tmplate->pageHeight();
|
||||
drawOffset = 0.1 * tmplate->pageHeight();
|
||||
}
|
||||
|
||||
// Set scene up with a 5% margin around paper
|
||||
model::Distance x = -0.05 * mModel->tmplate()->pageWidth();
|
||||
model::Distance y = -0.05 * mModel->tmplate()->pageHeight();
|
||||
model::Distance w = 1.10 * mModel->tmplate()->pageWidth();
|
||||
model::Distance h = 1.10 * mModel->tmplate()->pageHeight();
|
||||
model::Distance x = -0.05 * tmplate->pageWidth();
|
||||
model::Distance y = -0.05 * drawHeight - drawOffset;
|
||||
model::Distance w = 1.10 * tmplate->pageWidth();
|
||||
model::Distance h = 1.10 * drawHeight;
|
||||
|
||||
mScene->setSceneRect( x.pt(), y.pt(), w.pt(), h.pt() );
|
||||
fitInView( mScene->sceneRect(), Qt::KeepAspectRatio );
|
||||
|
||||
drawPaper( mModel->tmplate()->pageWidth(), mModel->tmplate()->pageHeight() );
|
||||
drawPaper();
|
||||
drawLabels();
|
||||
drawPreviewOverlay();
|
||||
}
|
||||
@@ -114,23 +126,10 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Clear View
|
||||
///
|
||||
void Preview::clearScene()
|
||||
{
|
||||
foreach ( QGraphicsItem *item, mScene->items() )
|
||||
{
|
||||
mScene->removeItem( item );
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Draw Paper
|
||||
///
|
||||
void Preview::drawPaper( const model::Distance& pw, const model::Distance& ph )
|
||||
void Preview::drawPaper()
|
||||
{
|
||||
auto *shadowEffect = new QGraphicsDropShadowEffect();
|
||||
shadowEffect->setColor( shadowColor );
|
||||
@@ -142,7 +141,16 @@ namespace glabels
|
||||
pen.setCosmetic( true );
|
||||
pen.setWidthF( paperOutlineWidthPixels );
|
||||
|
||||
auto *pageItem = new QGraphicsRectItem( 0, 0, pw.pt(), ph.pt() );
|
||||
QAbstractGraphicsShapeItem* pageItem;
|
||||
auto tmplate = mModel->tmplate();
|
||||
if ( !tmplate->isRoll() )
|
||||
{
|
||||
pageItem = new QGraphicsRectItem( 0, 0, tmplate->pageWidth().pt(), tmplate->pageHeight().pt() );
|
||||
}
|
||||
else
|
||||
{
|
||||
pageItem = new QGraphicsPathItem( RollTemplatePath( tmplate ) );
|
||||
}
|
||||
pageItem->setBrush( brush );
|
||||
pageItem->setPen( pen );
|
||||
pageItem->setGraphicsEffect( shadowEffect );
|
||||
@@ -170,9 +178,8 @@ namespace glabels
|
||||
///
|
||||
void Preview::drawLabel( const model::Distance& x, const model::Distance& y, const QPainterPath& path )
|
||||
{
|
||||
QBrush brush( Qt::NoBrush );
|
||||
QBrush brush( labelColor );
|
||||
QPen pen( labelOutlineColor );
|
||||
pen.setStyle( Qt::DotLine );
|
||||
pen.setCosmetic( true );
|
||||
pen.setWidthF( labelOutlineWidthPixels );
|
||||
|
||||
|
||||
+1
-2
@@ -68,8 +68,7 @@ namespace glabels
|
||||
// Internal Methods
|
||||
/////////////////////////////////
|
||||
private:
|
||||
void clearScene();
|
||||
void drawPaper( const model::Distance& pw, const model::Distance& ph );
|
||||
void drawPaper();
|
||||
void drawLabels();
|
||||
void drawLabel( const model::Distance& x, const model::Distance& y, const QPainterPath& path );
|
||||
|
||||
|
||||
+9
-10
@@ -40,6 +40,14 @@ namespace glabels
|
||||
preview->setRenderer( &mRenderer );
|
||||
mPrinter = new QPrinter( QPrinter::HighResolution );
|
||||
mPrinter->setColorMode( QPrinter::Color );
|
||||
|
||||
mPrintDialog = new QPrintDialog( mPrinter, this );
|
||||
mPrintDialog->setOption( QAbstractPrintDialog::PrintToFile, true );
|
||||
mPrintDialog->setOption( QAbstractPrintDialog::PrintSelection, false );
|
||||
mPrintDialog->setOption( QAbstractPrintDialog::PrintPageRange, false );
|
||||
mPrintDialog->setOption( QAbstractPrintDialog::PrintShowPageSize, true );
|
||||
mPrintDialog->setOption( QAbstractPrintDialog::PrintCollateCopies, false );
|
||||
mPrintDialog->setOption( QAbstractPrintDialog::PrintCurrentPage, false );
|
||||
}
|
||||
|
||||
|
||||
@@ -120,16 +128,7 @@ namespace glabels
|
||||
///
|
||||
void PrintView::onPrintButtonClicked()
|
||||
{
|
||||
QPrintDialog printDialog( mPrinter, this );
|
||||
|
||||
printDialog.setOption( QAbstractPrintDialog::PrintToFile, true );
|
||||
printDialog.setOption( QAbstractPrintDialog::PrintSelection, false );
|
||||
printDialog.setOption( QAbstractPrintDialog::PrintPageRange, false );
|
||||
printDialog.setOption( QAbstractPrintDialog::PrintShowPageSize, true );
|
||||
printDialog.setOption( QAbstractPrintDialog::PrintCollateCopies, false );
|
||||
printDialog.setOption( QAbstractPrintDialog::PrintCurrentPage, false );
|
||||
|
||||
if ( printDialog.exec() == QDialog::Accepted )
|
||||
if ( mPrintDialog->exec() == QDialog::Accepted )
|
||||
{
|
||||
mRenderer.print( mPrinter );
|
||||
}
|
||||
|
||||
+4
-1
@@ -28,6 +28,7 @@
|
||||
#include "model/PageRenderer.h"
|
||||
|
||||
#include <QPrinter>
|
||||
#include <QPrintDialog>
|
||||
|
||||
|
||||
namespace glabels
|
||||
@@ -73,7 +74,9 @@ namespace glabels
|
||||
QPrinter* mPrinter;
|
||||
model::PageRenderer mRenderer;
|
||||
|
||||
bool mBlocked;
|
||||
QPrintDialog* mPrintDialog;
|
||||
|
||||
bool mBlocked;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "UndoRedoModel.h"
|
||||
|
||||
#include "model/Db.h"
|
||||
#include "model/FrameContinuous.h"
|
||||
#include "model/Settings.h"
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
@@ -171,6 +172,38 @@ namespace glabels
|
||||
orientationCombo->setCurrentIndex( isRotated ? 0 : 1 );
|
||||
}
|
||||
mOldOrientationIndex = orientationCombo->currentIndex();
|
||||
|
||||
if ( auto* continuousFrame = dynamic_cast<const model::FrameContinuous*>( frame ) )
|
||||
{
|
||||
if (!mInLengthSpinChanged)
|
||||
{
|
||||
const QSignalBlocker blocker( lengthSpin );
|
||||
|
||||
lengthSpin->setSuffix( " " + mUnits.toTrName() );
|
||||
lengthSpin->setDecimals( mUnits.resolutionDigits() );
|
||||
lengthSpin->setSingleStep( mUnits.resolution() );
|
||||
lengthSpin->setMinimum( continuousFrame->hMin().inUnits( mUnits ) );
|
||||
lengthSpin->setMaximum( continuousFrame->hMax().inUnits( mUnits ) );
|
||||
lengthSpin->setValue( continuousFrame->h().inUnits( mUnits ) );
|
||||
}
|
||||
|
||||
parametersGroupBox->setVisible( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
parametersGroupBox->setVisible( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Length spin changed handler
|
||||
///
|
||||
void PropertiesView::onLengthSpinChanged()
|
||||
{
|
||||
mInLengthSpinChanged = true;
|
||||
mModel->setH( model::Distance( lengthSpin->value(), mUnits ) );
|
||||
mInLengthSpinChanged = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ namespace glabels
|
||||
private slots:
|
||||
void onSettingsChanged();
|
||||
void onLabelSizeChanged();
|
||||
void onLengthSpinChanged();
|
||||
void onOrientationActivated();
|
||||
void onChangeProductButtonClicked();
|
||||
|
||||
@@ -71,6 +72,8 @@ namespace glabels
|
||||
// Private Data
|
||||
/////////////////////////////////
|
||||
private:
|
||||
bool mInLengthSpinChanged{ false };
|
||||
|
||||
model::Model* mModel;
|
||||
UndoRedoModel* mUndoRedoModel;
|
||||
model::Units mUnits;
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/* RollTemplatePath.cpp
|
||||
*
|
||||
* Copyright (C) 2014 Jim Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "RollTemplatePath.h"
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
RollTemplatePath::RollTemplatePath( const model::Template* tmplate )
|
||||
{
|
||||
if ( !tmplate->isRoll() )
|
||||
{
|
||||
qWarning() << "Not a \"Roll\" template type.";
|
||||
}
|
||||
|
||||
model::Distance x0 = (tmplate->pageWidth() - tmplate->rollWidth()) / 2.0;
|
||||
model::Distance w = tmplate->rollWidth();
|
||||
model::Distance h = tmplate->pageHeight();
|
||||
model::Distance c = 0.07*h;
|
||||
model::Distance b = 0.03*h;
|
||||
|
||||
const int nx = 18;
|
||||
|
||||
// Upper break line
|
||||
moveTo( x0.pt(), -c.pt() );
|
||||
for ( int ix = 1; ix <= nx; ix++ )
|
||||
{
|
||||
model::Distance x = ix * (w/double(nx)) + x0;
|
||||
double a = ix * (2*M_PI/double(nx));
|
||||
|
||||
lineTo( x.pt(), b.pt()*sin(a) - c.pt() );
|
||||
}
|
||||
|
||||
// Lower break line
|
||||
lineTo( (x0+w).pt(), (h+c).pt() );
|
||||
for ( int ix = nx-1; ix >= 0; ix-- )
|
||||
{
|
||||
model::Distance x = ix * (w/double(nx)) + x0;
|
||||
double a = ix * (2*M_PI/double(nx));
|
||||
|
||||
lineTo( x.pt(), b.pt()*sin(a) + h.pt() + c.pt() );
|
||||
}
|
||||
|
||||
// Close path
|
||||
closeSubpath();
|
||||
}
|
||||
|
||||
} // namespace glabels
|
||||
@@ -0,0 +1,49 @@
|
||||
/* RollTemplatePath.h
|
||||
*
|
||||
* Copyright (C) 2018 Jim Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef RollTemplatePath_h
|
||||
#define RollTemplatePath_h
|
||||
|
||||
|
||||
#include "model/Template.h"
|
||||
#include <QPainterPath>
|
||||
|
||||
|
||||
namespace glabels
|
||||
{
|
||||
|
||||
///
|
||||
/// Painter path for "Roll" templates
|
||||
///
|
||||
class RollTemplatePath : public QPainterPath
|
||||
{
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
RollTemplatePath( const model::Template* tmplate );
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // RollTemplatePath_h
|
||||
+27
-20
@@ -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 );
|
||||
|
||||
@@ -67,8 +67,7 @@ namespace glabels
|
||||
/////////////////////////////////
|
||||
private:
|
||||
void update();
|
||||
void clearScene();
|
||||
void drawPaper( const model::Distance& pw, const model::Distance& ph );
|
||||
void drawPaper();
|
||||
void drawLabels();
|
||||
void drawLabel( const model::Distance& x, const model::Distance& y, const QPainterPath& path );
|
||||
void drawArrow();
|
||||
|
||||
+226
-78
@@ -24,7 +24,9 @@
|
||||
#include "model/Db.h"
|
||||
#include "model/Distance.h"
|
||||
#include "model/FrameCd.h"
|
||||
#include "model/FrameContinuous.h"
|
||||
#include "model/FrameEllipse.h"
|
||||
#include "model/FramePath.h"
|
||||
#include "model/FrameRect.h"
|
||||
#include "model/FrameRound.h"
|
||||
#include "model/Markup.h"
|
||||
@@ -60,6 +62,8 @@ namespace glabels
|
||||
RoundPageId,
|
||||
EllipsePageId,
|
||||
CdPageId,
|
||||
PathPageId,
|
||||
ContinuousPageId,
|
||||
NLayoutsPageId,
|
||||
OneLayoutPageId,
|
||||
TwoLayoutPageId,
|
||||
@@ -114,18 +118,20 @@ namespace glabels
|
||||
setOption( QWizard::IndependentPages, false );
|
||||
setOption( QWizard::NoBackButtonOnStartPage, true );
|
||||
|
||||
setPage( IntroPageId, new TemplateDesignerIntroPage() );
|
||||
setPage( NamePageId, new TemplateDesignerNamePage() );
|
||||
setPage( PageSizePageId, new TemplateDesignerPageSizePage() );
|
||||
setPage( ShapePageId, new TemplateDesignerShapePage() );
|
||||
setPage( RectPageId, new TemplateDesignerRectPage() );
|
||||
setPage( RoundPageId, new TemplateDesignerRoundPage() );
|
||||
setPage( EllipsePageId, new TemplateDesignerEllipsePage() );
|
||||
setPage( CdPageId, new TemplateDesignerCdPage() );
|
||||
setPage( NLayoutsPageId, new TemplateDesignerNLayoutsPage() );
|
||||
setPage( OneLayoutPageId, new TemplateDesignerOneLayoutPage() );
|
||||
setPage( TwoLayoutPageId, new TemplateDesignerTwoLayoutPage() );
|
||||
setPage( ApplyPageId, new TemplateDesignerApplyPage() );
|
||||
setPage( IntroPageId, new TemplateDesignerIntroPage() );
|
||||
setPage( NamePageId, new TemplateDesignerNamePage() );
|
||||
setPage( PageSizePageId, new TemplateDesignerPageSizePage() );
|
||||
setPage( ShapePageId, new TemplateDesignerShapePage() );
|
||||
setPage( RectPageId, new TemplateDesignerRectPage() );
|
||||
setPage( RoundPageId, new TemplateDesignerRoundPage() );
|
||||
setPage( EllipsePageId, new TemplateDesignerEllipsePage() );
|
||||
setPage( CdPageId, new TemplateDesignerCdPage() );
|
||||
setPage( PathPageId, new TemplateDesignerPathPage() );
|
||||
setPage( ContinuousPageId, new TemplateDesignerContinuousPage() );
|
||||
setPage( NLayoutsPageId, new TemplateDesignerNLayoutsPage() );
|
||||
setPage( OneLayoutPageId, new TemplateDesignerOneLayoutPage() );
|
||||
setPage( TwoLayoutPageId, new TemplateDesignerTwoLayoutPage() );
|
||||
setPage( ApplyPageId, new TemplateDesignerApplyPage() );
|
||||
}
|
||||
|
||||
|
||||
@@ -136,16 +142,27 @@ namespace glabels
|
||||
{
|
||||
switch (currentId())
|
||||
{
|
||||
|
||||
|
||||
case IntroPageId:
|
||||
return NamePageId;
|
||||
|
||||
if ( mIsTemplatePathBased )
|
||||
{
|
||||
return PathPageId;
|
||||
}
|
||||
else if ( mIsTemplateContinuousBased )
|
||||
{
|
||||
return ContinuousPageId;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NamePageId;
|
||||
}
|
||||
|
||||
case NamePageId:
|
||||
return PageSizePageId;
|
||||
|
||||
|
||||
case PageSizePageId:
|
||||
return ShapePageId;
|
||||
|
||||
|
||||
case ShapePageId:
|
||||
if ( field( "shape.rect" ).toBool() )
|
||||
{
|
||||
@@ -163,19 +180,53 @@ namespace glabels
|
||||
{
|
||||
return CdPageId;
|
||||
}
|
||||
|
||||
|
||||
case RectPageId:
|
||||
return NLayoutsPageId;
|
||||
|
||||
if ( field( "pageSize.pageSize" ) != tr("Roll") )
|
||||
{
|
||||
return NLayoutsPageId;
|
||||
}
|
||||
else
|
||||
{
|
||||
return OneLayoutPageId;
|
||||
}
|
||||
|
||||
case RoundPageId:
|
||||
return NLayoutsPageId;
|
||||
|
||||
if ( field( "pageSize.pageSize" ) != tr("Roll") )
|
||||
{
|
||||
return NLayoutsPageId;
|
||||
}
|
||||
else
|
||||
{
|
||||
return OneLayoutPageId;
|
||||
}
|
||||
|
||||
case EllipsePageId:
|
||||
return NLayoutsPageId;
|
||||
|
||||
if ( field( "pageSize.pageSize" ) != tr("Roll") )
|
||||
{
|
||||
return NLayoutsPageId;
|
||||
}
|
||||
else
|
||||
{
|
||||
return OneLayoutPageId;
|
||||
}
|
||||
|
||||
case CdPageId:
|
||||
return NLayoutsPageId;
|
||||
|
||||
if ( field( "pageSize.pageSize" ) != tr("Roll") )
|
||||
{
|
||||
return NLayoutsPageId;
|
||||
}
|
||||
else
|
||||
{
|
||||
return OneLayoutPageId;
|
||||
}
|
||||
|
||||
case PathPageId:
|
||||
return IntroPageId;
|
||||
|
||||
case ContinuousPageId:
|
||||
return IntroPageId;
|
||||
|
||||
case NLayoutsPageId:
|
||||
if ( field( "nLayouts.one" ).toBool() )
|
||||
{
|
||||
@@ -188,10 +239,10 @@ namespace glabels
|
||||
|
||||
case OneLayoutPageId:
|
||||
return ApplyPageId;
|
||||
|
||||
|
||||
case TwoLayoutPageId:
|
||||
return ApplyPageId;
|
||||
|
||||
|
||||
case ApplyPageId:
|
||||
default:
|
||||
return -1;
|
||||
@@ -326,8 +377,9 @@ namespace glabels
|
||||
QString paperId = model::Db::lookupPaperIdFromName( field( "pageSize.pageSize" ).toString() );
|
||||
model::Distance pageW( field( "pageSize.w" ).toDouble(), units );
|
||||
model::Distance pageH( field( "pageSize.h" ).toDouble(), units );
|
||||
model::Distance pageRollW( field( "pageSize.rollW" ).toDouble(), units );
|
||||
|
||||
auto t = new model::Template( brand, part, description, paperId, pageW, pageH, true );
|
||||
auto t = new model::Template( brand, part, description, paperId, pageW, pageH, pageRollW, true );
|
||||
|
||||
model::Frame* frame;
|
||||
if ( field( "shape.rect" ).toBool() )
|
||||
@@ -337,10 +389,11 @@ namespace glabels
|
||||
model::Distance r( field( "rect.r" ).toDouble(), units );
|
||||
model::Distance xWaste( field( "rect.xWaste" ).toDouble(), units );
|
||||
model::Distance yWaste( field( "rect.yWaste" ).toDouble(), units );
|
||||
model::Distance margin( field( "rect.margin" ).toDouble(), units );
|
||||
model::Distance xMargin( field( "rect.xMargin" ).toDouble(), units );
|
||||
model::Distance yMargin( field( "rect.yMargin" ).toDouble(), units );
|
||||
|
||||
frame = new model::FrameRect( w, h, r, xWaste, yWaste );
|
||||
frame->addMarkup( new model::MarkupMargin( frame, margin ) );
|
||||
frame->addMarkup( new model::MarkupMargin( xMargin, yMargin ) );
|
||||
}
|
||||
else if ( field( "shape.round" ).toBool() )
|
||||
{
|
||||
@@ -349,7 +402,7 @@ namespace glabels
|
||||
model::Distance margin( field( "round.margin" ).toDouble(), units );
|
||||
|
||||
frame = new model::FrameRound( r, waste );
|
||||
frame->addMarkup( new model::MarkupMargin( frame, margin ) );
|
||||
frame->addMarkup( new model::MarkupMargin( margin ) );
|
||||
}
|
||||
else if ( field( "shape.ellipse" ).toBool() )
|
||||
{
|
||||
@@ -359,7 +412,7 @@ namespace glabels
|
||||
model::Distance margin( field( "ellipse.margin" ).toDouble(), units );
|
||||
|
||||
frame = new model::FrameEllipse( w, h, waste );
|
||||
frame->addMarkup( new model::MarkupMargin( frame, margin ) );
|
||||
frame->addMarkup( new model::MarkupMargin( margin ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -371,7 +424,7 @@ namespace glabels
|
||||
model::Distance margin( field( "cd.margin" ).toDouble(), units );
|
||||
|
||||
frame = new model::FrameCd( r1, r2, xClip, yClip, waste );
|
||||
frame->addMarkup( new model::MarkupMargin( frame, margin ) );
|
||||
frame->addMarkup( new model::MarkupMargin( margin ) );
|
||||
}
|
||||
t->addFrame( frame );
|
||||
|
||||
@@ -384,7 +437,7 @@ namespace glabels
|
||||
model::Distance dx( field( "oneLayout.dx" ).toDouble(), units );
|
||||
model::Distance dy( field( "oneLayout.dy" ).toDouble(), units );
|
||||
|
||||
frame->addLayout( new model::Layout( nx, ny, x0, y0, dx, dy ) );
|
||||
frame->addLayout( model::Layout( nx, ny, x0, y0, dx, dy ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -402,8 +455,8 @@ namespace glabels
|
||||
model::Distance dx2( field( "twoLayout.dx2" ).toDouble(), units );
|
||||
model::Distance dy2( field( "twoLayout.dy2" ).toDouble(), units );
|
||||
|
||||
frame->addLayout( new model::Layout( nx1, ny1, x01, y01, dx1, dy1 ) );
|
||||
frame->addLayout( new model::Layout( nx2, ny2, x02, y02, dx2, dy2 ) );
|
||||
frame->addLayout( model::Layout( nx1, ny1, x01, y01, dx1, dy1 ) );
|
||||
frame->addLayout( model::Layout( nx2, ny2, x02, y02, dx2, dy2 ) );
|
||||
}
|
||||
|
||||
return t;
|
||||
@@ -458,6 +511,7 @@ namespace glabels
|
||||
setField( "pageSize.pageSize", model::Db::lookupPaperNameFromId( tmplate->paperId() ) );
|
||||
setField( "pageSize.w", tmplate->pageWidth().inUnits( units ) );
|
||||
setField( "pageSize.h", tmplate->pageHeight().inUnits( units ) );
|
||||
setField( "pageSize.rollW", tmplate->rollWidth().inUnits( units ) );
|
||||
|
||||
const model::Frame* frame = tmplate->frames().first();
|
||||
if ( auto frameRect = dynamic_cast<const model::FrameRect*>( frame ) )
|
||||
@@ -500,38 +554,39 @@ namespace glabels
|
||||
{
|
||||
if ( auto markupMargin = dynamic_cast<const model::MarkupMargin*>( markup ) )
|
||||
{
|
||||
setField( "rect.margin", markupMargin->size().inUnits( units ) );
|
||||
setField( "round.margin", markupMargin->size().inUnits( units ) );
|
||||
setField( "ellipse.margin", markupMargin->size().inUnits( units ) );
|
||||
setField( "cd.margin", markupMargin->size().inUnits( units ) );
|
||||
setField( "rect.xMargin", markupMargin->xSize().inUnits( units ) );
|
||||
setField( "rect.yMargin", markupMargin->ySize().inUnits( units ) );
|
||||
setField( "round.margin", markupMargin->xSize().inUnits( units ) );
|
||||
setField( "ellipse.margin", markupMargin->xSize().inUnits( units ) );
|
||||
setField( "cd.margin", markupMargin->xSize().inUnits( units ) );
|
||||
}
|
||||
}
|
||||
|
||||
QList<model::Layout*> layouts = frame->layouts();
|
||||
auto layouts = frame->layouts();
|
||||
if ( layouts.size() == 1 )
|
||||
{
|
||||
setField( "oneLayout.nx", layouts[0]->nx() );
|
||||
setField( "oneLayout.ny", layouts[0]->ny() );
|
||||
setField( "oneLayout.x0", layouts[0]->x0().inUnits( units ) );
|
||||
setField( "oneLayout.y0", layouts[0]->y0().inUnits( units ) );
|
||||
setField( "oneLayout.dx", layouts[0]->dx().inUnits( units ) );
|
||||
setField( "oneLayout.dy", layouts[0]->dy().inUnits( units ) );
|
||||
setField( "oneLayout.nx", layouts[0].nx() );
|
||||
setField( "oneLayout.ny", layouts[0].ny() );
|
||||
setField( "oneLayout.x0", layouts[0].x0().inUnits( units ) );
|
||||
setField( "oneLayout.y0", layouts[0].y0().inUnits( units ) );
|
||||
setField( "oneLayout.dx", layouts[0].dx().inUnits( units ) );
|
||||
setField( "oneLayout.dy", layouts[0].dy().inUnits( units ) );
|
||||
}
|
||||
else if ( layouts.size() > 1 )
|
||||
{
|
||||
setField( "twoLayout.nx1", layouts[0]->nx() );
|
||||
setField( "twoLayout.ny1", layouts[0]->ny() );
|
||||
setField( "twoLayout.x01", layouts[0]->x0().inUnits( units ) );
|
||||
setField( "twoLayout.y01", layouts[0]->y0().inUnits( units ) );
|
||||
setField( "twoLayout.dx1", layouts[0]->dx().inUnits( units ) );
|
||||
setField( "twoLayout.dy1", layouts[0]->dy().inUnits( units ) );
|
||||
setField( "twoLayout.nx1", layouts[0].nx() );
|
||||
setField( "twoLayout.ny1", layouts[0].ny() );
|
||||
setField( "twoLayout.x01", layouts[0].x0().inUnits( units ) );
|
||||
setField( "twoLayout.y01", layouts[0].y0().inUnits( units ) );
|
||||
setField( "twoLayout.dx1", layouts[0].dx().inUnits( units ) );
|
||||
setField( "twoLayout.dy1", layouts[0].dy().inUnits( units ) );
|
||||
|
||||
setField( "twoLayout.nx2", layouts[1]->nx() );
|
||||
setField( "twoLayout.ny2", layouts[1]->ny() );
|
||||
setField( "twoLayout.x02", layouts[1]->x0().inUnits( units ) );
|
||||
setField( "twoLayout.y02", layouts[1]->y0().inUnits( units ) );
|
||||
setField( "twoLayout.dx2", layouts[1]->dx().inUnits( units ) );
|
||||
setField( "twoLayout.dy2", layouts[1]->dy().inUnits( units ) );
|
||||
setField( "twoLayout.nx2", layouts[1].nx() );
|
||||
setField( "twoLayout.ny2", layouts[1].ny() );
|
||||
setField( "twoLayout.x02", layouts[1].x0().inUnits( units ) );
|
||||
setField( "twoLayout.y02", layouts[1].y0().inUnits( units ) );
|
||||
setField( "twoLayout.dx2", layouts[1].dx().inUnits( units ) );
|
||||
setField( "twoLayout.dy2", layouts[1].dy().inUnits( units ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -583,7 +638,20 @@ namespace glabels
|
||||
{
|
||||
if ( auto td = dynamic_cast<TemplateDesigner*>( wizard() ) )
|
||||
{
|
||||
td->loadFromTemplate( tmplate );
|
||||
if ( dynamic_cast<model::FramePath*>(tmplate->frames().constFirst()) )
|
||||
{
|
||||
td->mIsTemplatePathBased = true;
|
||||
}
|
||||
else if ( dynamic_cast<model::FrameContinuous*>(tmplate->frames().constFirst()) )
|
||||
{
|
||||
td->mIsTemplateContinuousBased = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
td->mIsTemplatePathBased = false;
|
||||
td->mIsTemplateContinuousBased = false;
|
||||
td->loadFromTemplate( tmplate );
|
||||
}
|
||||
td->next();
|
||||
}
|
||||
}
|
||||
@@ -658,20 +726,30 @@ namespace glabels
|
||||
setupUi( widget );
|
||||
|
||||
pageSizeCombo->insertItem( 0, tr("Other") );
|
||||
pageSizeCombo->insertItems( 1, model::Db::paperNames() );
|
||||
pageSizeCombo->insertItem( 1, tr("Roll") );
|
||||
pageSizeCombo->insertItems( 2, model::Db::paperNames() );
|
||||
pageSizeCombo->setCurrentText( defaultPageSize[ model::Settings::preferedPageSizeFamily() ] );
|
||||
|
||||
bool isOther = pageSizeCombo->currentText() == tr("Other");
|
||||
bool isRoll = pageSizeCombo->currentText() == tr("Roll");
|
||||
|
||||
wSpin->setSuffix( " " + model::Settings::units().toTrName() );
|
||||
wSpin->setDecimals( model::Settings::units().resolutionDigits() );
|
||||
wSpin->setSingleStep( model::Settings::units().resolution() );
|
||||
wSpin->setMaximum( maxPageSize[ model::Settings::units().toEnum() ] );
|
||||
wSpin->setEnabled( pageSizeCombo->currentText() == tr("Other") );
|
||||
wSpin->setEnabled( isOther || isRoll );
|
||||
|
||||
hSpin->setSuffix( " " + model::Settings::units().toTrName() );
|
||||
hSpin->setDecimals( model::Settings::units().resolutionDigits() );
|
||||
hSpin->setSingleStep( model::Settings::units().resolution() );
|
||||
hSpin->setMaximum( maxPageSize[ model::Settings::units().toEnum() ] );
|
||||
hSpin->setEnabled( pageSizeCombo->currentText() == tr("Other") );
|
||||
hSpin->setEnabled( isOther || isRoll );
|
||||
|
||||
rollWSpin->setSuffix( " " + model::Settings::units().toTrName() );
|
||||
rollWSpin->setDecimals( model::Settings::units().resolutionDigits() );
|
||||
rollWSpin->setSingleStep( model::Settings::units().resolution() );
|
||||
rollWSpin->setMaximum( maxPageSize[ model::Settings::units().toEnum() ] );
|
||||
rollWSpin->setEnabled( isRoll );
|
||||
|
||||
if ( pageSizeCombo->currentText() != tr("Other") )
|
||||
{
|
||||
@@ -683,6 +761,7 @@ namespace glabels
|
||||
registerField( "pageSize.pageSize", pageSizeCombo, "currentText" );
|
||||
registerField( "pageSize.w", wSpin, "value" );
|
||||
registerField( "pageSize.h", hSpin, "value" );
|
||||
registerField( "pageSize.rollW", rollWSpin, "value" );
|
||||
|
||||
connect( pageSizeCombo, &QComboBox::currentTextChanged, this, &TemplateDesignerPageSizePage::onComboChanged );
|
||||
|
||||
@@ -705,15 +784,29 @@ namespace glabels
|
||||
|
||||
void TemplateDesignerPageSizePage::onComboChanged()
|
||||
{
|
||||
if ( pageSizeCombo->currentText() != tr("Other") )
|
||||
bool isOther = pageSizeCombo->currentText() == tr("Other");
|
||||
bool isRoll = pageSizeCombo->currentText() == tr("Roll");
|
||||
|
||||
if ( !isOther && !isRoll )
|
||||
{
|
||||
const model::Paper* paper = model::Db::lookupPaperFromName( pageSizeCombo->currentText() );
|
||||
wSpin->setValue( paper->width().inUnits( model::Settings::units() ) );
|
||||
hSpin->setValue( paper->height().inUnits( model::Settings::units() ) );
|
||||
}
|
||||
|
||||
wSpin->setEnabled( pageSizeCombo->currentText() == tr("Other") );
|
||||
hSpin->setEnabled( pageSizeCombo->currentText() == tr("Other") );
|
||||
if ( !isRoll )
|
||||
{
|
||||
rollWSpin->setValue( 0 );
|
||||
}
|
||||
|
||||
wLabel->setEnabled( isOther || isRoll );
|
||||
wSpin->setEnabled( isOther || isRoll );
|
||||
|
||||
hLabel->setEnabled( isOther || isRoll );
|
||||
hSpin->setEnabled( isOther || isRoll );
|
||||
|
||||
rollWLabel->setEnabled( isRoll );
|
||||
rollWSpin->setEnabled( isRoll );
|
||||
}
|
||||
|
||||
|
||||
@@ -781,16 +874,21 @@ namespace glabels
|
||||
yWasteSpin->setDecimals( model::Settings::units().resolutionDigits() );
|
||||
yWasteSpin->setSingleStep( model::Settings::units().resolution() );
|
||||
|
||||
marginSpin->setSuffix( " " + model::Settings::units().toTrName() );
|
||||
marginSpin->setDecimals( model::Settings::units().resolutionDigits() );
|
||||
marginSpin->setSingleStep( model::Settings::units().resolution() );
|
||||
xMarginSpin->setSuffix( " " + model::Settings::units().toTrName() );
|
||||
xMarginSpin->setDecimals( model::Settings::units().resolutionDigits() );
|
||||
xMarginSpin->setSingleStep( model::Settings::units().resolution() );
|
||||
|
||||
registerField( "rect.w", wSpin, "value" );
|
||||
registerField( "rect.h", hSpin, "value" );
|
||||
registerField( "rect.r", rSpin, "value" );
|
||||
registerField( "rect.xWaste", xWasteSpin, "value" );
|
||||
registerField( "rect.yWaste", yWasteSpin, "value" );
|
||||
registerField( "rect.margin", marginSpin, "value" );
|
||||
yMarginSpin->setSuffix( " " + model::Settings::units().toTrName() );
|
||||
yMarginSpin->setDecimals( model::Settings::units().resolutionDigits() );
|
||||
yMarginSpin->setSingleStep( model::Settings::units().resolution() );
|
||||
|
||||
registerField( "rect.w", wSpin, "value" );
|
||||
registerField( "rect.h", hSpin, "value" );
|
||||
registerField( "rect.r", rSpin, "value" );
|
||||
registerField( "rect.xWaste", xWasteSpin, "value" );
|
||||
registerField( "rect.yWaste", yWasteSpin, "value" );
|
||||
registerField( "rect.xMargin", xMarginSpin, "value" );
|
||||
registerField( "rect.yMargin", yMarginSpin, "value" );
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
layout->addWidget( widget );
|
||||
@@ -811,7 +909,8 @@ namespace glabels
|
||||
rSpin->setMaximum( std::min(wMax,hMax)/2.0 );
|
||||
xWasteSpin->setMaximum( std::min(wMax,hMax)/4.0 );
|
||||
yWasteSpin->setMaximum( std::min(wMax,hMax)/4.0 );
|
||||
marginSpin->setMaximum( std::min(wMax,hMax)/4.0 );
|
||||
xMarginSpin->setMaximum( std::min(wMax,hMax)/4.0 );
|
||||
yMarginSpin->setMaximum( std::min(wMax,hMax)/4.0 );
|
||||
|
||||
static bool alreadyInitialized = false;
|
||||
if ( !td->isBasedOnCopy() && !alreadyInitialized )
|
||||
@@ -824,7 +923,8 @@ namespace glabels
|
||||
rSpin->setValue( defaultRectR.inUnits( model::Settings::units() ) );
|
||||
xWasteSpin->setValue( defaultWaste.inUnits( model::Settings::units() ) );
|
||||
yWasteSpin->setValue( defaultWaste.inUnits( model::Settings::units() ) );
|
||||
marginSpin->setValue( defaultMargin.inUnits( model::Settings::units() ) );
|
||||
xMarginSpin->setValue( defaultMargin.inUnits( model::Settings::units() ) );
|
||||
yMarginSpin->setValue( defaultMargin.inUnits( model::Settings::units() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1059,6 +1159,54 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Path Product Page
|
||||
///
|
||||
TemplateDesignerPathPage::TemplateDesignerPathPage( QWidget* parent ) : QWizardPage(parent)
|
||||
{
|
||||
setTitle( tr("Unsupported Product Style") );
|
||||
setSubTitle( tr("Path based product templates are not currently supported by the Product Template Designer.") );
|
||||
|
||||
QWidget* widget = new QWidget;
|
||||
setupUi( widget );
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
layout->addWidget( widget );
|
||||
setLayout( layout );
|
||||
}
|
||||
|
||||
|
||||
bool TemplateDesignerPathPage::isComplete() const
|
||||
{
|
||||
// Must "Cancel" or "Back" from this page
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Continuous Product Page
|
||||
///
|
||||
TemplateDesignerContinuousPage::TemplateDesignerContinuousPage( QWidget* parent ) : QWizardPage(parent)
|
||||
{
|
||||
setTitle( tr("Unsupported Product Style") );
|
||||
setSubTitle( tr("Continuous tape product templates are not currently supported by the Product Template Designer.") );
|
||||
|
||||
QWidget* widget = new QWidget;
|
||||
setupUi( widget );
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
layout->addWidget( widget );
|
||||
setLayout( layout );
|
||||
}
|
||||
|
||||
|
||||
bool TemplateDesignerContinuousPage::isComplete() const
|
||||
{
|
||||
// Must "Cancel" or "Back" from this page
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Number of Layouts Page
|
||||
///
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "ui_TemplateDesignerRoundPage.h"
|
||||
#include "ui_TemplateDesignerEllipsePage.h"
|
||||
#include "ui_TemplateDesignerCdPage.h"
|
||||
#include "ui_TemplateDesignerPathPage.h"
|
||||
#include "ui_TemplateDesignerContinuousPage.h"
|
||||
#include "ui_TemplateDesignerNLayoutsPage.h"
|
||||
#include "ui_TemplateDesignerOneLayoutPage.h"
|
||||
#include "ui_TemplateDesignerTwoLayoutPage.h"
|
||||
@@ -59,6 +61,8 @@ namespace glabels
|
||||
friend class TemplateDesignerRoundPage;
|
||||
friend class TemplateDesignerEllipsePage;
|
||||
friend class TemplateDesignerCdPage;
|
||||
friend class TemplateDesignerPathPage;
|
||||
friend class TemplateDesignerContinuousPage;
|
||||
friend class TemplateDesignerNLayoutsPage;
|
||||
friend class TemplateDesignerOneLayoutPage;
|
||||
friend class TemplateDesignerTwoLayoutPage;
|
||||
@@ -92,7 +96,9 @@ namespace glabels
|
||||
// Private methods
|
||||
/////////////////////////////////
|
||||
private:
|
||||
bool mIsBasedOnCopy;
|
||||
bool mIsBasedOnCopy{false};
|
||||
bool mIsTemplatePathBased{false};
|
||||
bool mIsTemplateContinuousBased{false};
|
||||
};
|
||||
|
||||
|
||||
@@ -220,6 +226,32 @@ namespace glabels
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Path Page
|
||||
//
|
||||
class TemplateDesignerPathPage : public QWizardPage, public Ui::TemplateDesignerPathPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TemplateDesignerPathPage( QWidget* parent = nullptr );
|
||||
|
||||
bool isComplete() const override;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Continuous Page
|
||||
//
|
||||
class TemplateDesignerContinuousPage : public QWizardPage, public Ui::TemplateDesignerContinuousPage
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TemplateDesignerContinuousPage( QWidget* parent = nullptr );
|
||||
|
||||
bool isComplete() const override;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// NLayouts Page
|
||||
//
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>806</width>
|
||||
<width>886</width>
|
||||
<height>742</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -25,7 +25,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<layout class="QGridLayout" name="gridLayout_5" columnstretch="0,0,0,0,1">
|
||||
<item row="0" column="4">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
@@ -42,7 +42,16 @@
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item>
|
||||
@@ -256,6 +265,51 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="parametersGroupBox">
|
||||
<property name="title">
|
||||
<string>Adjustable Parameters</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="horizontalSpacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="lengthSpin">
|
||||
<property name="accelerated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string notr="true"> in</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Label length:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="orientationGroupBox">
|
||||
<property name="sizePolicy">
|
||||
@@ -385,8 +439,8 @@
|
||||
<slot>onChangeProductButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>309</x>
|
||||
<y>239</y>
|
||||
<x>342</x>
|
||||
<y>291</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>728</x>
|
||||
@@ -401,8 +455,8 @@
|
||||
<slot>onOrientationActivated()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>308</x>
|
||||
<y>334</y>
|
||||
<x>342</x>
|
||||
<y>467</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>802</x>
|
||||
@@ -410,9 +464,26 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>lengthSpin</sender>
|
||||
<signal>valueChanged(double)</signal>
|
||||
<receiver>PropertiesView</receiver>
|
||||
<slot>onLengthSpinChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>188</x>
|
||||
<y>349</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>801</x>
|
||||
<y>376</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>onChangeProductButtonClicked()</slot>
|
||||
<slot>onOrientationActivated()</slot>
|
||||
<slot>onLengthSpinChanged()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TemplateDesignerContinuousPage</class>
|
||||
<widget class="QWidget" name="TemplateDesignerContinuousPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>640</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>18</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Click &quot;Cancel&quot; to quit, or click &quot;Back&quot; to begin with a different product.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -25,54 +25,19 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Page size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Width:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="wSpin">
|
||||
<property name="accelerated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string notr="true">in</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Height:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="hSpin">
|
||||
<property name="accelerated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string notr="true">in</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="pageSizeCombo"/>
|
||||
</item>
|
||||
</layout>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>173</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
@@ -87,18 +52,80 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>173</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="hSpin">
|
||||
<property name="accelerated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string notr="true">in</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="rollWLabel">
|
||||
<property name="text">
|
||||
<string>Roll width:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="hLabel">
|
||||
<property name="text">
|
||||
<string>Height:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="pageSizeCombo"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="wLabel">
|
||||
<property name="text">
|
||||
<string>Width:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="rollWSpin">
|
||||
<property name="suffix">
|
||||
<string notr="true">in</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="wSpin">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="accelerated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string notr="true">in</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Page size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TemplateDesignerPathPage</class>
|
||||
<widget class="QWidget" name="TemplateDesignerPathPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>640</width>
|
||||
<height>400</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>18</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Click &quot;Cancel&quot; to quit, or click &quot;Back&quot; to begin with a different product.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -30,25 +30,15 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>2. Height:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="rSpin">
|
||||
<property name="accelerated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string notr="true">in</string>
|
||||
<string>4. Horizontal waste:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QDoubleSpinBox" name="marginSpin">
|
||||
<widget class="QDoubleSpinBox" name="xMarginSpin">
|
||||
<property name="accelerated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -57,23 +47,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="yWasteSpin">
|
||||
<property name="accelerated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string notr="true">in</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="hSpin">
|
||||
<property name="accelerated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string notr="true">in</string>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>3. Corner radius</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -94,24 +71,54 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>4. Horizontal waste:</string>
|
||||
<item row="2" column="1">
|
||||
<widget class="QDoubleSpinBox" name="rSpin">
|
||||
<property name="accelerated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string notr="true">in</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>3. Corner radius</string>
|
||||
<string>5. Vertical waste:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="hSpin">
|
||||
<property name="accelerated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string notr="true">in</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDoubleSpinBox" name="yWasteSpin">
|
||||
<property name="accelerated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string notr="true">in</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>2. Height:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>6. Margin:</string>
|
||||
<string>6. Margin (X):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -125,10 +132,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>5. Vertical waste:</string>
|
||||
<string>7. Margin (Y):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QDoubleSpinBox" name="yMarginSpin">
|
||||
<property name="accelerated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>in</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user