Initial implementation of barcode object.

This commit is contained in:
Jim Evins
2017-04-29 19:12:20 -04:00
parent 02630aec19
commit cf000a5d5c
17 changed files with 647 additions and 56 deletions
+7 -5
View File
@@ -124,7 +124,7 @@ namespace glabels
} }
const BarcodeStyle* BarcodeBackends::lookupStyleFromId( const QString& id ) BarcodeStyle BarcodeBackends::lookupStyleFromId( const QString& id )
{ {
StyleMap::iterator i = mStyleIdMap.find( id ); StyleMap::iterator i = mStyleIdMap.find( id );
if ( i != mStyleIdMap.end() ) if ( i != mStyleIdMap.end() )
@@ -132,11 +132,12 @@ namespace glabels
return i.value(); return i.value();
} }
return nullptr; return BarcodeStyle( QString("code39"), QString(""), tr("Code 39"),
true, true, true, true, QString("1234567890"), true, 10 );
} }
const BarcodeStyle* BarcodeBackends::lookupStyleFromName( const QString& name ) BarcodeStyle BarcodeBackends::lookupStyleFromName( const QString& name )
{ {
StyleMap::iterator i = mStyleNameMap.find( name ); StyleMap::iterator i = mStyleNameMap.find( name );
if ( i != mStyleNameMap.end() ) if ( i != mStyleNameMap.end() )
@@ -144,7 +145,8 @@ namespace glabels
return i.value(); return i.value();
} }
return nullptr; return BarcodeStyle( QString("code39"), QString(""), tr("Code 39"),
true, true, true, true, QString("1234567890"), true, 10 );
} }
@@ -167,7 +169,7 @@ namespace glabels
bool canFreeForm, bool canFreeForm,
int preferedN ) int preferedN )
{ {
BarcodeStyle* style = new BarcodeStyle( QString(id), QString(backendId), name, BarcodeStyle style( QString(id), QString(backendId), name,
canText, textOptional, canText, textOptional,
canChecksum, checksumOptional, canChecksum, checksumOptional,
QString(defaultDigits), QString(defaultDigits),
+3 -3
View File
@@ -60,8 +60,8 @@ namespace glabels
static const QList<QString>& getBackendNameList(); static const QList<QString>& getBackendNameList();
static const QList<QString>& getNameList(); static const QList<QString>& getNameList();
static const BarcodeStyle* lookupStyleFromId( const QString& id ); static BarcodeStyle lookupStyleFromId( const QString& id );
static const BarcodeStyle* lookupStyleFromName( const QString& name ); static BarcodeStyle lookupStyleFromName( const QString& name );
///////////////////////////////// /////////////////////////////////
@@ -89,7 +89,7 @@ namespace glabels
static BackendMap mBackendIdMap; static BackendMap mBackendIdMap;
static BackendMap mBackendNameMap; static BackendMap mBackendNameMap;
typedef QMap<QString,BarcodeStyle*> StyleMap; typedef QMap<QString,BarcodeStyle> StyleMap;
static StyleMap mStyleIdMap; static StyleMap mStyleIdMap;
static StyleMap mStyleNameMap; static StyleMap mStyleNameMap;
+3 -3
View File
@@ -34,7 +34,7 @@ namespace glabels
{ {
foreach ( QString name, BarcodeBackends::getNameList() ) foreach ( QString name, BarcodeBackends::getNameList() )
{ {
const BarcodeStyle* bcStyle = BarcodeBackends::lookupStyleFromName( name ); BarcodeStyle bcStyle = BarcodeBackends::lookupStyleFromName( name );
BarcodeMenuItem* bcMenuItem = new BarcodeMenuItem( bcStyle ); BarcodeMenuItem* bcMenuItem = new BarcodeMenuItem( bcStyle );
connect( bcMenuItem, SIGNAL(activated()), this, SLOT(onMenuItemActivated) ); connect( bcMenuItem, SIGNAL(activated()), this, SLOT(onMenuItemActivated) );
@@ -47,7 +47,7 @@ namespace glabels
/// ///
/// bcStyle getter /// bcStyle getter
/// ///
const BarcodeStyle* BarcodeMenu::bcStyle() const BarcodeStyle BarcodeMenu::bcStyle() const
{ {
return mBcStyle; return mBcStyle;
} }
@@ -56,7 +56,7 @@ namespace glabels
/// ///
/// onMenuItemActivated slot /// onMenuItemActivated slot
/// ///
void BarcodeMenu::onMenuItemActivated( BarcodeStyle *bcStyle ) void BarcodeMenu::onMenuItemActivated( BarcodeStyle bcStyle )
{ {
mBcStyle = bcStyle; mBcStyle = bcStyle;
+3 -3
View File
@@ -55,21 +55,21 @@ namespace glabels
// Properties // Properties
///////////////////////////////// /////////////////////////////////
public: public:
const BarcodeStyle* bcStyle() const; BarcodeStyle bcStyle() const;
///////////////////////////////// /////////////////////////////////
// Slots // Slots
///////////////////////////////// /////////////////////////////////
private slots: private slots:
void onMenuItemActivated( BarcodeStyle *bcStyle ); void onMenuItemActivated( BarcodeStyle bcStyle );
///////////////////////////////// /////////////////////////////////
// Private Data // Private Data
///////////////////////////////// /////////////////////////////////
private: private:
BarcodeStyle* mBcStyle; BarcodeStyle mBcStyle;
}; };
+3 -3
View File
@@ -37,7 +37,7 @@ namespace glabels
setMenu( mMenu ); setMenu( mMenu );
mBcStyle = BarcodeBackends::lookupStyleFromId( "" ); // Default style mBcStyle = BarcodeBackends::lookupStyleFromId( "" ); // Default style
setText( mBcStyle->name() ); setText( mBcStyle.name() );
connect( mMenu, SIGNAL(styleChanged()), this, SLOT(onMenuStyleChanged()) ); connect( mMenu, SIGNAL(styleChanged()), this, SLOT(onMenuStyleChanged()) );
} }
@@ -46,7 +46,7 @@ namespace glabels
/// ///
/// bcStyle getter /// bcStyle getter
/// ///
const BarcodeStyle* BarcodeMenuButton::bcStyle() const BarcodeStyle BarcodeMenuButton::bcStyle() const
{ {
return mBcStyle; return mBcStyle;
} }
@@ -58,7 +58,7 @@ namespace glabels
void BarcodeMenuButton::onMenuStyleChanged() void BarcodeMenuButton::onMenuStyleChanged()
{ {
mBcStyle = mMenu->bcStyle(); mBcStyle = mMenu->bcStyle();
setText( mBcStyle->name() ); setText( mBcStyle.name() );
emit styleChanged(); emit styleChanged();
} }
+2 -2
View File
@@ -56,7 +56,7 @@ namespace glabels
// Properties // Properties
///////////////////////////////// /////////////////////////////////
public: public:
const BarcodeStyle* bcStyle() const; BarcodeStyle bcStyle() const;
///////////////////////////////// /////////////////////////////////
@@ -71,7 +71,7 @@ namespace glabels
///////////////////////////////// /////////////////////////////////
private: private:
BarcodeMenu* mMenu; BarcodeMenu* mMenu;
const BarcodeStyle* mBcStyle; BarcodeStyle mBcStyle;
}; };
+3 -3
View File
@@ -27,10 +27,10 @@ namespace glabels
/// ///
/// Constructor From Data /// Constructor From Data
/// ///
BarcodeMenuItem::BarcodeMenuItem( const BarcodeStyle* bcStyle, QObject* parent ) BarcodeMenuItem::BarcodeMenuItem( const BarcodeStyle& bcStyle, QObject* parent )
: QAction(parent), mBcStyle(bcStyle) : QAction(parent), mBcStyle(bcStyle)
{ {
setText( bcStyle->name() ); setText( bcStyle.name() );
connect( this, SIGNAL(triggered()), this, SLOT(onTriggered()) ); connect( this, SIGNAL(triggered()), this, SLOT(onTriggered()) );
} }
@@ -39,7 +39,7 @@ namespace glabels
/// ///
/// bcStyle Property Getter /// bcStyle Property Getter
/// ///
const BarcodeStyle* BarcodeMenuItem::bcStyle() const BarcodeStyle BarcodeMenuItem::bcStyle() const
{ {
return mBcStyle; return mBcStyle;
} }
+4 -4
View File
@@ -41,21 +41,21 @@ namespace glabels
// Life Cycle // Life Cycle
///////////////////////////////// /////////////////////////////////
public: public:
BarcodeMenuItem( const BarcodeStyle* bcStyle, QObject* parent = nullptr ); BarcodeMenuItem( const BarcodeStyle& bcStyle, QObject* parent = nullptr );
///////////////////////////////// /////////////////////////////////
// Signals // Signals
///////////////////////////////// /////////////////////////////////
signals: signals:
void activated( const BarcodeStyle* bcStyle ); void activated( const BarcodeStyle& bcStyle );
///////////////////////////////// /////////////////////////////////
// Properties // Properties
///////////////////////////////// /////////////////////////////////
public: public:
const BarcodeStyle* bcStyle() const; BarcodeStyle bcStyle() const;
///////////////////////////////// /////////////////////////////////
@@ -69,7 +69,7 @@ namespace glabels
// Private Data // Private Data
///////////////////////////////// /////////////////////////////////
private: private:
const BarcodeStyle* mBcStyle; BarcodeStyle mBcStyle;
}; };
+9
View File
@@ -176,4 +176,13 @@ namespace glabels
} }
} }
///
/// "Not equals" operator
///
bool BarcodeStyle::operator!=( const BarcodeStyle& other ) const
{
return mId != other.mId;
}
} // namespace glabels } // namespace glabels
+8 -1
View File
@@ -31,7 +31,7 @@ namespace glabels
/// ///
/// Barcode Style Type /// Barcode Style Type
/// ///
struct BarcodeStyle class BarcodeStyle
{ {
///////////////////////////////// /////////////////////////////////
@@ -83,6 +83,13 @@ namespace glabels
QString exampleDigits( int n ) const; QString exampleDigits( int n ) const;
/////////////////////////////////
// Operators
/////////////////////////////////
public:
bool operator!=( const BarcodeStyle& other ) const;
///////////////////////////////// /////////////////////////////////
// Private Data // Private Data
///////////////////////////////// /////////////////////////////////
+7
View File
@@ -57,6 +57,7 @@ set (glabels_sources
LabelEditor.cpp LabelEditor.cpp
LabelModel.cpp LabelModel.cpp
LabelModelObject.cpp LabelModelObject.cpp
LabelModelBarcodeObject.cpp
LabelModelBoxObject.cpp LabelModelBoxObject.cpp
LabelModelEllipseObject.cpp LabelModelEllipseObject.cpp
LabelModelImageObject.cpp LabelModelImageObject.cpp
@@ -118,6 +119,7 @@ set (glabels_qobject_headers
LabelEditor.h LabelEditor.h
LabelModel.h LabelModel.h
LabelModelObject.h LabelModelObject.h
LabelModelBarcodeObject.h
LabelModelBoxObject.h LabelModelBoxObject.h
LabelModelEllipseObject.h LabelModelEllipseObject.h
LabelModelImageObject.h LabelModelImageObject.h
@@ -176,6 +178,7 @@ add_executable (glabels-qt WIN32
target_link_libraries (glabels-qt target_link_libraries (glabels-qt
Merge Merge
glbarcode
${Qt5Widgets_LIBRARIES} ${Qt5Widgets_LIBRARIES}
${Qt5PrintSupport_LIBRARIES} ${Qt5PrintSupport_LIBRARIES}
${Qt5Xml_LIBRARIES} ${Qt5Xml_LIBRARIES}
@@ -196,6 +199,10 @@ include_directories (
${Qt5Svg_INCLUDE_DIRS} ${Qt5Svg_INCLUDE_DIRS}
) )
link_directories (
${glabels_qt_SOURCE_DIR}/glbarcode
)
#======================================= #=======================================
# Subdirectories # Subdirectories
+15 -1
View File
@@ -27,6 +27,7 @@
#include "FrameRound.h" #include "FrameRound.h"
#include "LabelModel.h" #include "LabelModel.h"
#include "LabelModelObject.h" #include "LabelModelObject.h"
#include "LabelModelBarcodeObject.h"
#include "LabelModelBoxObject.h" #include "LabelModelBoxObject.h"
#include "LabelModelEllipseObject.h" #include "LabelModelEllipseObject.h"
#include "LabelModelImageObject.h" #include "LabelModelImageObject.h"
@@ -377,6 +378,19 @@ namespace glabels
} }
///
/// Create barcode mode
///
void
LabelEditor::createBarcodeMode()
{
setCursor( Cursors::Barcode() );
mCreateObjectType = Barcode;
mState = CreateIdle;
}
/// ///
/// Resize Event Handler /// Resize Event Handler
/// ///
@@ -522,7 +536,7 @@ namespace glabels
mCreateObject = new LabelModelTextObject(); mCreateObject = new LabelModelTextObject();
break; break;
case Barcode: case Barcode:
// mCreateObject = new LabelModelBarcodeObject(); mCreateObject = new LabelModelBarcodeObject();
break; break;
default: default:
qDebug() << "LabelEditor::mousePressEvent: Invalid creation type. Should not happen!"; qDebug() << "LabelEditor::mousePressEvent: Invalid creation type. Should not happen!";
+395
View File
@@ -0,0 +1,395 @@
/* LabelModelBarcodeObject.cpp
*
* Copyright (C) 2017 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 "LabelModelBarcodeObject.h"
#include "BarcodeBackends.h"
#include "Size.h"
#include "glbarcode/Factory.h"
#include "glbarcode/QtRenderer.h"
#include <QBrush>
#include <QPen>
#include <QTextDocument>
#include <QTextBlock>
#include <QRegularExpression>
#include <QtDebug>
namespace glabels
{
//
// Private
//
namespace
{
}
///
/// Constructor
///
LabelModelBarcodeObject::LabelModelBarcodeObject()
{
mOutline = new Outline( this );
mHandles << new HandleNorthWest( this );
mHandles << new HandleNorth( this );
mHandles << new HandleNorthEast( this );
mHandles << new HandleEast( this );
mHandles << new HandleSouthEast( this );
mHandles << new HandleSouth( this );
mHandles << new HandleSouthWest( this );
mHandles << new HandleWest( this );
mBcStyle = BarcodeBackends::lookupStyleFromId( "code39" );
mBcTextFlag = mBcStyle.canText();
mBcChecksumFlag = mBcStyle.canChecksum();
mBcFormatDigits = mBcStyle.preferedN();
mBcDataNode = TextNode( false, mBcStyle.defaultDigits() );
mBcColorNode = ColorNode( Qt::black );
update(); // Initialize cached editor layouts
}
///
/// Copy constructor
///
LabelModelBarcodeObject::LabelModelBarcodeObject( const LabelModelBarcodeObject* object )
: LabelModelObject(object)
{
mBcStyle = object->mBcStyle;
mBcTextFlag = object->mBcTextFlag;
mBcChecksumFlag = object->mBcChecksumFlag;
mBcFormatDigits = object->mBcFormatDigits;
mBcDataNode = object->mBcDataNode;
mBcColorNode = object->mBcColorNode;
mEditorBarcode = nullptr;
update(); // Initialize cached editor layouts
}
///
/// Destructor
///
LabelModelBarcodeObject::~LabelModelBarcodeObject()
{
delete mOutline;
foreach( Handle* handle, mHandles )
{
delete handle;
}
mHandles.clear();
delete mEditorBarcode;
}
///
/// Clone
///
LabelModelBarcodeObject* LabelModelBarcodeObject::clone() const
{
return new LabelModelBarcodeObject( this );
}
///
/// bcDataNode Property Getter
///
TextNode LabelModelBarcodeObject::bcDataNode() const
{
return mBcDataNode;
}
///
/// bcDataNode Property Setter
///
void LabelModelBarcodeObject::setBcDataNode( const TextNode& value )
{
if ( mBcDataNode != value )
{
mBcDataNode = value;
update();
emit changed();
}
}
///
/// bcTextFlag Property Getter
///
bool LabelModelBarcodeObject::bcTextFlag() const
{
return mBcTextFlag;
}
///
/// bcTextFlag Property Setter
///
void LabelModelBarcodeObject::setBcTextFlag( bool value )
{
if ( mBcTextFlag != value )
{
mBcTextFlag = value;
update();
emit changed();
}
}
///
/// bcChecksumFlag Property Getter
///
bool LabelModelBarcodeObject::bcChecksumFlag() const
{
return mBcChecksumFlag;
}
///
/// bcChecksumFlag Property Setter
///
void LabelModelBarcodeObject::setBcChecksumFlag( bool value )
{
if ( mBcChecksumFlag != value )
{
mBcChecksumFlag = value;
update();
emit changed();
}
}
///
/// Barcode Color Node Property Getter
///
ColorNode LabelModelBarcodeObject::bcColorNode() const
{
return mBcColorNode;
}
///
/// Barcode Color Node Property Setter
///
void LabelModelBarcodeObject::setBcColorNode( const ColorNode& value )
{
if ( mBcColorNode != value )
{
mBcColorNode = value;
update();
emit changed();
}
}
///
/// Barcode Style Property Getter
///
BarcodeStyle LabelModelBarcodeObject::bcStyle() const
{
return mBcStyle;
}
///
/// Barcode Style Property Setter
///
void LabelModelBarcodeObject::setBcStyle( const BarcodeStyle& value )
{
if ( mBcStyle != value )
{
mBcStyle = value;
update();
emit changed();
}
}
///
/// Barcode Format Digits Property Getter
///
int LabelModelBarcodeObject::bcFormatDigits() const
{
return mBcFormatDigits;
}
///
/// Barcode Format Digits Property Setter
///
void LabelModelBarcodeObject::setBcFormatDigits( int value )
{
if ( mBcFormatDigits != value )
{
mBcFormatDigits = value;
update();
emit changed();
}
}
///
/// Draw shadow of object
///
void LabelModelBarcodeObject::drawShadow( QPainter* painter,
bool inEditor,
merge::Record* record ) const
{
QColor bcColor = mBcColorNode.color( record );
if ( bcColor.alpha() )
{
QColor shadowColor = mShadowColorNode.color( record );
shadowColor.setAlphaF( mShadowOpacity );
if ( inEditor )
{
drawBcInEditor( painter, shadowColor );
}
else
{
drawBc( painter, shadowColor, record );
}
}
}
///
/// Draw object itself
///
void LabelModelBarcodeObject::drawObject( QPainter* painter,
bool inEditor,
merge::Record* record ) const
{
QColor bcColor = mBcColorNode.color( record );
if ( inEditor )
{
drawBcInEditor( painter, bcColor );
}
else
{
drawBc( painter, bcColor, record );
}
}
///
/// Path to test for hover condition
///
QPainterPath LabelModelBarcodeObject::hoverPath( double scale ) const
{
return mHoverPath;
}
///
/// Size updated
///
void LabelModelBarcodeObject::sizeUpdated()
{
update();
}
///
/// Update cached information for editor view
///
void LabelModelBarcodeObject::update()
{
if ( mEditorBarcode )
{
delete mEditorBarcode;
}
mEditorBarcode = glbarcode::Factory::createBarcode( mBcStyle.id().toStdString() );
mEditorBarcode->setChecksum(mBcChecksumFlag);
mEditorBarcode->setShowText(mBcTextFlag);
if ( mBcDataNode.isField() )
{
mEditorBarcode->build( mBcStyle.defaultDigits().toStdString(), mW.pt(), mH.pt() );
}
else
{
mEditorBarcode->build( mBcDataNode.data().toStdString(), mW.pt(), mH.pt() );
}
mW = Distance::pt( mEditorBarcode->width() );
mH = Distance::pt( mEditorBarcode->height() );
QPainterPath path;
path.addRect( 0, 0, mEditorBarcode->width(), mEditorBarcode->height() );
mHoverPath = path;
}
///
/// Draw text in editor from cached information
///
void LabelModelBarcodeObject::drawBcInEditor( QPainter* painter, const QColor& color ) const
{
painter->setPen( QPen( color ) );
if ( mEditorBarcode->isDataValid() )
{
glbarcode::QtRenderer renderer(painter);
mEditorBarcode->render( renderer );
}
else if ( mEditorBarcode->isEmpty() )
{
// FIXME: display "Empty"
}
else
{
// FIXME: display "Invalid data"
}
}
///
/// Draw text in final printout or preview
///
void
LabelModelBarcodeObject::drawBc( QPainter* painter,
const QColor& color,
merge::Record* record ) const
{
painter->setPen( QPen( color ) );
glbarcode::Barcode* bc = glbarcode::Factory::createBarcode( mBcStyle.id().toStdString() );
bc->setChecksum(mBcChecksumFlag);
bc->setShowText(mBcTextFlag);
bc->build( mBcDataNode.text(record).toStdString(), mW.pt(), mH.pt() );
glbarcode::QtRenderer renderer(painter);
bc->render( renderer );
}
} // namespace glabels
+149
View File
@@ -0,0 +1,149 @@
/* LabelModelBarcodeObject.h
*
* Copyright (C) 2017 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 LabelModelBarcodeObject_h
#define LabelModelBarcodeObject_h
#include "LabelModelObject.h"
#include "glbarcode/Barcode.h"
namespace glabels
{
///
/// Label Model Line Object
///
class LabelModelBarcodeObject : public LabelModelObject
{
Q_OBJECT
///////////////////////////////////////////////////////////////
// Lifecycle Methods
///////////////////////////////////////////////////////////////
public:
LabelModelBarcodeObject();
LabelModelBarcodeObject( const LabelModelBarcodeObject* object );
~LabelModelBarcodeObject() override;
///////////////////////////////////////////////////////////////
// Object duplication
///////////////////////////////////////////////////////////////
LabelModelBarcodeObject* clone() const override;
///////////////////////////////////////////////////////////////
// Property Implementations
///////////////////////////////////////////////////////////////
public:
//
// Barcode Property: bcDataNode
//
TextNode bcDataNode() const override;
void setBcDataNode( const TextNode &value ) override;
//
// Barcode Property: bcTextFlag
//
bool bcTextFlag() const override;
void setBcTextFlag( bool value ) override;
//
// Barcode Property: bcChecksumFlag
//
bool bcChecksumFlag() const override;
void setBcChecksumFlag( bool value ) override;
//
// Barcode Property: bcColorNode
//
ColorNode bcColorNode() const override;
void setBcColorNode( const ColorNode &value ) override;
//
// Barcode Property: bcStyle
//
BarcodeStyle bcStyle() const override;
void setBcStyle( const BarcodeStyle &value ) override;
//
// Barcode Property: bcFormatDigits
//
int bcFormatDigits() const override;
void setBcFormatDigits( int value ) override;
///////////////////////////////////////////////////////////////
// Capability Implementations
///////////////////////////////////////////////////////////////
public:
///////////////////////////////////////////////////////////////
// Drawing operations
///////////////////////////////////////////////////////////////
protected:
void drawShadow( QPainter* painter, bool inEditor, merge::Record* record ) const override;
void drawObject( QPainter* painter, bool inEditor, merge::Record* record ) const override;
QPainterPath hoverPath( double scale ) const override;
///////////////////////////////////////////////////////////////
// Private methods
///////////////////////////////////////////////////////////////
private:
void sizeUpdated() override;
void update();
void drawBcInEditor( QPainter* painter, const QColor& color ) const;
void drawBc( QPainter* painter, const QColor& color, merge::Record* record ) const;
///////////////////////////////////////////////////////////////
// Private Members
///////////////////////////////////////////////////////////////
private:
BarcodeStyle mBcStyle;
bool mBcTextFlag;
bool mBcChecksumFlag;
int mBcFormatDigits;
TextNode mBcDataNode;
ColorNode mBcColorNode;
glbarcode::Barcode* mEditorBarcode;
QPainterPath mHoverPath;
};
}
#endif // LabelModelBarcodeObject_h
+2 -1
View File
@@ -1278,7 +1278,8 @@ namespace glabels
/// ///
void MainWindow::objectsCreateBarcode() void MainWindow::objectsCreateBarcode()
{ {
qDebug() << "ACTION: objects->Create->Barcode"; mUndoRedoModel->checkpoint( tr("Create Barcode") );
mLabelEditor->createBarcodeMode();
} }
+2 -2
View File
@@ -112,7 +112,7 @@ namespace glbarcode
{ {
double x1 = x + w/2; // Offset line origin by 1/2 line width. double x1 = x + w/2; // Offset line origin by 1/2 line width.
d->painter->setPen( QPen( d->color, w ) ); d->painter->setPen( QPen( d->color, w, Qt::SolidLine, Qt::FlatCap ) );
d->painter->drawLine( QPointF(x1, y), QPointF(x1, y+h) ); d->painter->drawLine( QPointF(x1, y), QPointF(x1, y+h) );
} }
} }
@@ -145,7 +145,7 @@ namespace glbarcode
QRect rect = fm.boundingRect( QString::fromStdString(text) ); QRect rect = fm.boundingRect( QString::fromStdString(text) );
double xCorner = x - rect.width()/2.0; double xCorner = x - rect.width()/2.0;
double yCorner = y - rect.height() + fm.descent(); double yCorner = y + fm.descent();
d->painter->drawText( QPointF(xCorner, yCorner), QString::fromStdString(text) ); d->painter->drawText( QPointF(xCorner, yCorner), QString::fromStdString(text) );
} }
+27 -20
View File
@@ -800,6 +800,8 @@
</message> </message>
<message> <message>
<location filename="../glabels/BarcodeBackends.cpp" line="60"/> <location filename="../glabels/BarcodeBackends.cpp" line="60"/>
<location filename="../glabels/BarcodeBackends.cpp" line="135"/>
<location filename="../glabels/BarcodeBackends.cpp" line="148"/>
<source>Code 39</source> <source>Code 39</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -1115,16 +1117,16 @@
<context> <context>
<name>glabels::LabelEditor</name> <name>glabels::LabelEditor</name>
<message> <message>
<location filename="../glabels/LabelEditor.cpp" line="626"/> <location filename="../glabels/LabelEditor.cpp" line="640"/>
<location filename="../glabels/LabelEditor.cpp" line="923"/> <location filename="../glabels/LabelEditor.cpp" line="937"/>
<location filename="../glabels/LabelEditor.cpp" line="928"/> <location filename="../glabels/LabelEditor.cpp" line="942"/>
<location filename="../glabels/LabelEditor.cpp" line="933"/> <location filename="../glabels/LabelEditor.cpp" line="947"/>
<location filename="../glabels/LabelEditor.cpp" line="938"/> <location filename="../glabels/LabelEditor.cpp" line="952"/>
<source>Move</source> <source>Move</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../glabels/LabelEditor.cpp" line="943"/> <location filename="../glabels/LabelEditor.cpp" line="957"/>
<source>Delete</source> <source>Delete</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -1486,7 +1488,7 @@
</message> </message>
<message> <message>
<location filename="../glabels/MainWindow.cpp" line="401"/> <location filename="../glabels/MainWindow.cpp" line="401"/>
<location filename="../glabels/MainWindow.cpp" line="1290"/> <location filename="../glabels/MainWindow.cpp" line="1291"/>
<source>Bring To Front</source> <source>Bring To Front</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -1497,7 +1499,7 @@
</message> </message>
<message> <message>
<location filename="../glabels/MainWindow.cpp" line="406"/> <location filename="../glabels/MainWindow.cpp" line="406"/>
<location filename="../glabels/MainWindow.cpp" line="1300"/> <location filename="../glabels/MainWindow.cpp" line="1301"/>
<source>Send To Back</source> <source>Send To Back</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -1508,7 +1510,7 @@
</message> </message>
<message> <message>
<location filename="../glabels/MainWindow.cpp" line="411"/> <location filename="../glabels/MainWindow.cpp" line="411"/>
<location filename="../glabels/MainWindow.cpp" line="1310"/> <location filename="../glabels/MainWindow.cpp" line="1311"/>
<source>Rotate Left</source> <source>Rotate Left</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -1519,7 +1521,7 @@
</message> </message>
<message> <message>
<location filename="../glabels/MainWindow.cpp" line="416"/> <location filename="../glabels/MainWindow.cpp" line="416"/>
<location filename="../glabels/MainWindow.cpp" line="1320"/> <location filename="../glabels/MainWindow.cpp" line="1321"/>
<source>Rotate Right</source> <source>Rotate Right</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -1530,7 +1532,7 @@
</message> </message>
<message> <message>
<location filename="../glabels/MainWindow.cpp" line="421"/> <location filename="../glabels/MainWindow.cpp" line="421"/>
<location filename="../glabels/MainWindow.cpp" line="1330"/> <location filename="../glabels/MainWindow.cpp" line="1331"/>
<source>Flip Horizontally</source> <source>Flip Horizontally</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -1541,7 +1543,7 @@
</message> </message>
<message> <message>
<location filename="../glabels/MainWindow.cpp" line="426"/> <location filename="../glabels/MainWindow.cpp" line="426"/>
<location filename="../glabels/MainWindow.cpp" line="1340"/> <location filename="../glabels/MainWindow.cpp" line="1341"/>
<source>Flip Vertically</source> <source>Flip Vertically</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -1552,7 +1554,7 @@
</message> </message>
<message> <message>
<location filename="../glabels/MainWindow.cpp" line="431"/> <location filename="../glabels/MainWindow.cpp" line="431"/>
<location filename="../glabels/MainWindow.cpp" line="1350"/> <location filename="../glabels/MainWindow.cpp" line="1351"/>
<source>Align Left</source> <source>Align Left</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -1563,7 +1565,7 @@
</message> </message>
<message> <message>
<location filename="../glabels/MainWindow.cpp" line="436"/> <location filename="../glabels/MainWindow.cpp" line="436"/>
<location filename="../glabels/MainWindow.cpp" line="1360"/> <location filename="../glabels/MainWindow.cpp" line="1361"/>
<source>Align Center</source> <source>Align Center</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -1574,7 +1576,7 @@
</message> </message>
<message> <message>
<location filename="../glabels/MainWindow.cpp" line="441"/> <location filename="../glabels/MainWindow.cpp" line="441"/>
<location filename="../glabels/MainWindow.cpp" line="1370"/> <location filename="../glabels/MainWindow.cpp" line="1371"/>
<source>Align Right</source> <source>Align Right</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -1585,7 +1587,7 @@
</message> </message>
<message> <message>
<location filename="../glabels/MainWindow.cpp" line="446"/> <location filename="../glabels/MainWindow.cpp" line="446"/>
<location filename="../glabels/MainWindow.cpp" line="1380"/> <location filename="../glabels/MainWindow.cpp" line="1381"/>
<source>Align Top</source> <source>Align Top</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -1596,7 +1598,7 @@
</message> </message>
<message> <message>
<location filename="../glabels/MainWindow.cpp" line="451"/> <location filename="../glabels/MainWindow.cpp" line="451"/>
<location filename="../glabels/MainWindow.cpp" line="1390"/> <location filename="../glabels/MainWindow.cpp" line="1391"/>
<source>Align Middle</source> <source>Align Middle</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -1607,7 +1609,7 @@
</message> </message>
<message> <message>
<location filename="../glabels/MainWindow.cpp" line="456"/> <location filename="../glabels/MainWindow.cpp" line="456"/>
<location filename="../glabels/MainWindow.cpp" line="1400"/> <location filename="../glabels/MainWindow.cpp" line="1401"/>
<source>Align Bottom</source> <source>Align Bottom</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -1618,7 +1620,7 @@
</message> </message>
<message> <message>
<location filename="../glabels/MainWindow.cpp" line="461"/> <location filename="../glabels/MainWindow.cpp" line="461"/>
<location filename="../glabels/MainWindow.cpp" line="1410"/> <location filename="../glabels/MainWindow.cpp" line="1411"/>
<source>Center Horizontally</source> <source>Center Horizontally</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -1629,7 +1631,7 @@
</message> </message>
<message> <message>
<location filename="../glabels/MainWindow.cpp" line="466"/> <location filename="../glabels/MainWindow.cpp" line="466"/>
<location filename="../glabels/MainWindow.cpp" line="1420"/> <location filename="../glabels/MainWindow.cpp" line="1421"/>
<source>Center Vertically</source> <source>Center Vertically</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@@ -1778,6 +1780,11 @@
<source>Create Image</source> <source>Create Image</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="../glabels/MainWindow.cpp" line="1281"/>
<source>Create Barcode</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>glabels::MergeView</name> <name>glabels::MergeView</name>