Use auto to reduce some verbosity.

This commit is contained in:
Jim Evins
2017-12-30 21:41:02 -05:00
parent c7a6ed4917
commit 9a135f8971
34 changed files with 84 additions and 84 deletions
+1 -1
View File
@@ -213,7 +213,7 @@ namespace glabels
/* But it can be too small, in this case enlarge and center the area */
if ( bci->width < (int)(barlen * scalef) )
{
int wid = (int)( barlen * scalef + 1);
auto wid = int( barlen * scalef + 1);
bci->xoff -= (wid - bci->width)/2 ;
bci->width = wid;
/* Can't extend too far on the left */
+1 -1
View File
@@ -119,7 +119,7 @@ namespace glabels
QStringList values = parseLine();
if ( !values.isEmpty() )
{
Record* record = new Record();
auto* record = new Record();
int iField = 0;
foreach ( QString value, values )
+2 -2
View File
@@ -39,7 +39,7 @@ namespace glabels
{
if ( bcStyle.backendId() == "" )
{
BarcodeMenuItem* bcMenuItem = new BarcodeMenuItem( bcStyle );
auto* bcMenuItem = new BarcodeMenuItem( bcStyle );
connect( bcMenuItem, SIGNAL(activated(const barcode::Style&)),
this, SLOT(onMenuItemActivated(const barcode::Style&)) );
@@ -55,7 +55,7 @@ namespace glabels
{
if ( bcStyle.backendId() == backendId )
{
BarcodeMenuItem* bcMenuItem = new BarcodeMenuItem( bcStyle );
auto* bcMenuItem = new BarcodeMenuItem( bcStyle );
connect( bcMenuItem, SIGNAL(activated(const barcode::Style&)),
this, SLOT(onMenuItemActivated(const barcode::Style&)) );
+5 -5
View File
@@ -95,11 +95,11 @@ namespace glabels
setStyleSheet( ".glabels--ColorPaletteDialog {background: white; border: 1px solid black}" );
setWindowFlags( Qt::Popup | Qt::FramelessWindowHint );
QVBoxLayout* vLayout = new QVBoxLayout();
auto* vLayout = new QVBoxLayout();
vLayout->setContentsMargins( 0, 0, 0, 0 );
vLayout->setSpacing( 0 );
ColorPaletteButtonItem* defaultButton = new ColorPaletteButtonItem( defaultLabel );
auto* defaultButton = new ColorPaletteButtonItem( defaultLabel );
connect( defaultButton, SIGNAL(activated()), this, SLOT(onDefaultItemActivated()) );
vLayout->addWidget( defaultButton );
@@ -108,7 +108,7 @@ namespace glabels
hline1->setLineWidth( 1 );
vLayout->addWidget( hline1 );
QGridLayout* mainPaletteLayout = new QGridLayout();
auto* mainPaletteLayout = new QGridLayout();
mainPaletteLayout->setSpacing( 0 );
for ( int iRow = 0; iRow < PALETTE_ROWS; iRow++ )
{
@@ -131,7 +131,7 @@ namespace glabels
hline2->setLineWidth( 1 );
vLayout->addWidget( hline2 );
QHBoxLayout* customPaletteLayout = new QHBoxLayout();
auto* customPaletteLayout = new QHBoxLayout();
customPaletteLayout->setSpacing( 0 );
for ( int iCol = 0; iCol < PALETTE_COLS; iCol++ )
{
@@ -167,7 +167,7 @@ namespace glabels
vLayout->addWidget( mMergeFieldCombo );
// Item 0 is the ComboBox title, not an item intended for selection. So disable it.
const QStandardItemModel* model = qobject_cast<const QStandardItemModel*>(mMergeFieldCombo->model());
const auto* model = qobject_cast<const QStandardItemModel*>(mMergeFieldCombo->model());
QStandardItem* item = model->item(0);
item->setFlags( item->flags() & ~(Qt::ItemIsSelectable|Qt::ItemIsEnabled) );
+2 -2
View File
@@ -52,7 +52,7 @@ namespace glabels
}
// Item 0 is the ComboBox title, not an item intended for selection. So disable it.
const QStandardItemModel* itemModel = qobject_cast<const QStandardItemModel*>(model());
const auto* itemModel = qobject_cast<const QStandardItemModel*>(model());
QStandardItem* item = itemModel->item(0);
item->setFlags( item->flags() & ~(Qt::ItemIsSelectable|Qt::ItemIsEnabled) );
}
@@ -65,7 +65,7 @@ namespace glabels
addItem( mName );
// Item 0 is the ComboBox title, not an item intended for selection. So disable it.
const QStandardItemModel* itemModel = qobject_cast<const QStandardItemModel*>(model());
const auto* itemModel = qobject_cast<const QStandardItemModel*>(model());
QStandardItem* item = itemModel->item(0);
item->setFlags( item->flags() & ~(Qt::ItemIsSelectable|Qt::ItemIsEnabled) );
+4 -4
View File
@@ -53,7 +53,7 @@ namespace glabels
const model::Template* tmplate = dialog.tmplate();
if ( tmplate )
{
model::Model* model = new model::Model();
auto* model = new model::Model();
model->setTmplate( tmplate );
model->clearModified();
@@ -68,7 +68,7 @@ namespace glabels
}
else
{
MainWindow *newWindow = new MainWindow();
auto *newWindow = new MainWindow();
newWindow->setModel( model );
newWindow->show();
}
@@ -118,7 +118,7 @@ namespace glabels
}
else
{
MainWindow *newWindow = new MainWindow();
auto *newWindow = new MainWindow();
newWindow->setModel( model );
newWindow->show();
}
@@ -237,7 +237,7 @@ namespace glabels
{
foreach ( QWidget* qwidget, QApplication::topLevelWidgets() )
{
if ( MainWindow* window = qobject_cast<MainWindow*>(qwidget) )
if ( auto* window = qobject_cast<MainWindow*>(qwidget) )
{
window->close();
}
+3 -3
View File
@@ -113,7 +113,7 @@ namespace glabels
// Create central widget
QWidget *centralWidget = new QWidget();
QHBoxLayout *hLayout = new QHBoxLayout();
auto *hLayout = new QHBoxLayout();
hLayout->setContentsMargins( 0, 0, 0, 0 );
hLayout->addWidget( mContents );
hLayout->addWidget( mPages );
@@ -698,12 +698,12 @@ namespace glabels
mLabelEditorScrollArea->setWidget( mLabelEditor );
QVBoxLayout* editorVLayout = new QVBoxLayout;
auto* editorVLayout = new QVBoxLayout;
editorVLayout->setContentsMargins( 0, 0, 0, 0 );
editorVLayout->addWidget( editorToolBar );
editorVLayout->addWidget( mLabelEditorScrollArea );
QHBoxLayout* editorHLayout = new QHBoxLayout;
auto* editorHLayout = new QHBoxLayout;
editorHLayout->setContentsMargins( 0, 0, 0, 0 );
editorHLayout->addLayout( editorVLayout );
editorHLayout->addWidget( mObjectEditor );
+6 -6
View File
@@ -246,7 +246,7 @@ namespace glabels
recordsTable->setColumnCount( mKeys.size() + 1 ); // Include extra column
// First column = primay Key
QTableWidgetItem* item = new QTableWidgetItem( mPrimaryKey );
auto* item = new QTableWidgetItem( mPrimaryKey );
item->setFlags( Qt::ItemIsEnabled );
recordsTable->setHorizontalHeaderItem( 0, item );
@@ -256,7 +256,7 @@ namespace glabels
{
if ( key != mPrimaryKey )
{
QTableWidgetItem* item = new QTableWidgetItem( key );
auto* item = new QTableWidgetItem( key );
item->setFlags( Qt::ItemIsEnabled );
recordsTable->setHorizontalHeaderItem( iCol, item );
@@ -266,7 +266,7 @@ namespace glabels
}
// Extra dummy column to fill any extra horizontal space
QTableWidgetItem* fillItem = new QTableWidgetItem();
auto* fillItem = new QTableWidgetItem();
fillItem->setFlags( Qt::NoItemFlags );
recordsTable->setHorizontalHeaderItem( iCol, fillItem );
recordsTable->horizontalHeader()->setStretchLastSection( true );
@@ -288,7 +288,7 @@ namespace glabels
foreach ( merge::Record* record, records )
{
// First column for primay field
QTableWidgetItem* item = new QTableWidgetItem();
auto* item = new QTableWidgetItem();
if ( record->contains( mPrimaryKey ) )
{
item->setText( (*record)[mPrimaryKey] );
@@ -306,7 +306,7 @@ namespace glabels
{
if ( record->contains( key ) )
{
QTableWidgetItem* item = new QTableWidgetItem( (*record)[key] );
auto* item = new QTableWidgetItem( (*record)[key] );
item->setFlags( Qt::ItemIsEnabled );
recordsTable->setItem( iRow, iCol, item );
recordsTable->resizeColumnToContents( iCol );
@@ -317,7 +317,7 @@ namespace glabels
}
// Extra dummy column to fill any extra horizontal space
QTableWidgetItem* fillItem = new QTableWidgetItem();
auto* fillItem = new QTableWidgetItem();
fillItem->setFlags( Qt::NoItemFlags );
recordsTable->setItem( iRow, iCol, fillItem );
+4 -4
View File
@@ -132,7 +132,7 @@ namespace glabels
///
void Preview::drawPaper( const model::Distance& pw, const model::Distance& ph )
{
QGraphicsDropShadowEffect *shadowEffect = new QGraphicsDropShadowEffect();
auto *shadowEffect = new QGraphicsDropShadowEffect();
shadowEffect->setColor( shadowColor );
shadowEffect->setOffset( shadowOffsetPixels );
shadowEffect->setBlurRadius( shadowRadiusPixels );
@@ -142,7 +142,7 @@ namespace glabels
pen.setCosmetic( true );
pen.setWidthF( paperOutlineWidthPixels );
QGraphicsRectItem *pageItem = new QGraphicsRectItem( 0, 0, pw.pt(), ph.pt() );
auto *pageItem = new QGraphicsRectItem( 0, 0, pw.pt(), ph.pt() );
pageItem->setBrush( brush );
pageItem->setPen( pen );
pageItem->setGraphicsEffect( shadowEffect );
@@ -176,7 +176,7 @@ namespace glabels
pen.setCosmetic( true );
pen.setWidthF( labelOutlineWidthPixels );
QGraphicsPathItem *labelOutlineItem = new QGraphicsPathItem( path );
auto *labelOutlineItem = new QGraphicsPathItem( path );
labelOutlineItem->setBrush( brush );
labelOutlineItem->setPen( pen );
labelOutlineItem->setPos( x.pt(), y.pt() );
@@ -192,7 +192,7 @@ namespace glabels
{
if ( mRenderer )
{
PreviewOverlayItem* overlayItem = new PreviewOverlayItem( mRenderer );
auto* overlayItem = new PreviewOverlayItem( mRenderer );
mScene->addItem( overlayItem );
}
}
+1 -1
View File
@@ -44,7 +44,7 @@ namespace glabels
titleLabel->setText( QString( "<span style='font-size:18pt;'>%1</span>" ).arg( tr("Properties") ) );
// Hack to get orientationCombo item height to follow icon size plus padding
QStyledItemDelegate* itemDelegate = new QStyledItemDelegate();
auto* itemDelegate = new QStyledItemDelegate();
orientationCombo->setItemDelegate( itemDelegate );
orientationCombo->setStyleSheet( "* QAbstractItemView::item { padding: 8px; }" );
+4 -4
View File
@@ -143,7 +143,7 @@ namespace glabels
///
void SimplePreview::drawPaper( const model::Distance& pw, const model::Distance& ph )
{
QGraphicsDropShadowEffect *shadowEffect = new QGraphicsDropShadowEffect();
auto *shadowEffect = new QGraphicsDropShadowEffect();
shadowEffect->setColor( shadowColor );
shadowEffect->setOffset( shadowOffsetPixels );
shadowEffect->setBlurRadius( shadowRadiusPixels );
@@ -153,7 +153,7 @@ namespace glabels
pen.setCosmetic( true );
pen.setWidthF( paperOutlineWidthPixels );
QGraphicsRectItem *pageItem = new QGraphicsRectItem( 0, 0, pw.pt(), ph.pt() );
auto *pageItem = new QGraphicsRectItem( 0, 0, pw.pt(), ph.pt() );
pageItem->setBrush( brush );
pageItem->setPen( pen );
pageItem->setGraphicsEffect( shadowEffect );
@@ -188,7 +188,7 @@ namespace glabels
pen.setCosmetic( true );
pen.setWidthF( labelOutlineWidthPixels );
QGraphicsPathItem *labelItem = new QGraphicsPathItem( path );
auto *labelItem = new QGraphicsPathItem( path );
labelItem->setBrush( brush );
labelItem->setPen( pen );
labelItem->setPos( x.pt(), y.pt() );
@@ -227,7 +227,7 @@ namespace glabels
path.lineTo( 0, -minWH.pt()*arrowScale );
path.lineTo( minWH.pt()*arrowScale/2, -minWH.pt()*arrowScale/2 );
QGraphicsPathItem *arrowItem = new QGraphicsPathItem( path );
auto *arrowItem = new QGraphicsPathItem( path );
arrowItem->setPen( pen );
arrowItem->setPos( (x0+w/2).pt(), (y0+h/2).pt() );
if ( mRotateFlag )
+3 -3
View File
@@ -63,7 +63,7 @@ namespace glabels
{
foreach ( QListWidgetItem *item, findItems( "*", Qt::MatchWildcard ) )
{
TemplatePickerItem *tItem = dynamic_cast<TemplatePickerItem *>(item);
auto *tItem = dynamic_cast<TemplatePickerItem *>(item);
bool nameMask = tItem->tmplate()->name().contains( searchString, Qt::CaseInsensitive );
@@ -107,7 +107,7 @@ namespace glabels
{
foreach ( QListWidgetItem *item, findItems( "*", Qt::MatchWildcard ) )
{
TemplatePickerItem *tItem = dynamic_cast<TemplatePickerItem *>(item);
auto *tItem = dynamic_cast<TemplatePickerItem *>(item);
bool match = false;
foreach ( QString name, names )
@@ -144,7 +144,7 @@ namespace glabels
}
else
{
TemplatePickerItem *tItem = dynamic_cast<TemplatePickerItem*>(items.first());
auto *tItem = dynamic_cast<TemplatePickerItem*>(items.first());
return tItem->tmplate();
}
}
+3 -3
View File
@@ -66,7 +66,7 @@ namespace glabels
mRedoStack.clear();
/* Save state onto undo stack. */
State* stateNow = new State( mModel, description );
auto* stateNow = new State( mModel, description );
mUndoStack.push( stateNow );
/* Track consecutive checkpoints. */
@@ -84,7 +84,7 @@ namespace glabels
void UndoRedoModel::undo()
{
State* oldState = mUndoStack.pop();
State* stateNow = new State( mModel, oldState->description );
auto* stateNow = new State( mModel, oldState->description );
mRedoStack.push( stateNow );
@@ -103,7 +103,7 @@ namespace glabels
void UndoRedoModel::redo()
{
State* oldState = mRedoStack.pop();
State* stateNow = new State( mModel, oldState->description );
auto* stateNow = new State( mModel, oldState->description );
mUndoStack.push( stateNow );
+2 -2
View File
@@ -104,7 +104,7 @@ int main( int argc, char **argv )
if ( model )
{
model->setFileName( filename );
glabels::MainWindow *newWindow = new glabels::MainWindow();
auto *newWindow = new glabels::MainWindow();
newWindow->setModel( model );
newWindow->show();
openedFiles = true;
@@ -117,7 +117,7 @@ int main( int argc, char **argv )
//
if ( !openedFiles )
{
glabels::MainWindow *mainWindow = new glabels::MainWindow();
auto *mainWindow = new glabels::MainWindow();
mainWindow->show();
}
+1 -1
View File
@@ -190,7 +190,7 @@ namespace glbarcode
{
/* determine width and establish horizontal scale, based on original cooked data */
double dataSize = double( cookedData.size() );
auto dataSize = double( cookedData.size() );
double minL;
if ( !checksum() )
{
+1 -1
View File
@@ -256,7 +256,7 @@ namespace glbarcode
/* now traverse the code string and draw each bar */
int nBarsSpaces = int( codedData.size() - 1 ); /* coded data has dummy "0" on end. */
auto nBarsSpaces = int( codedData.size() - 1 ); /* coded data has dummy "0" on end. */
double xModules = 0;
for ( int i = 0; i < nBarsSpaces; i += 2 )
+2 -2
View File
@@ -86,7 +86,7 @@ namespace glbarcode
{
init();
BarcodeTypeMap::iterator i = mBarcodeTypeMap.find( typeId );
auto i = mBarcodeTypeMap.find( typeId );
return ( i != mBarcodeTypeMap.end() );
}
@@ -104,7 +104,7 @@ namespace glbarcode
{
init();
BarcodeTypeMap::iterator i = mBarcodeTypeMap.find( typeId );
auto i = mBarcodeTypeMap.find( typeId );
if( i != mBarcodeTypeMap.end() )
{
+5 -5
View File
@@ -31,23 +31,23 @@ void glbarcode::Renderer::render( double w, double h, const std::list<DrawingPri
for ( primitive = primitives.begin(); primitive != primitives.end(); primitive++ )
{
if ( DrawingPrimitiveLine* line = dynamic_cast<DrawingPrimitiveLine*>(*primitive) )
if ( auto* line = dynamic_cast<DrawingPrimitiveLine*>(*primitive) )
{
drawLine( line->x(), line->y(), line->w(), line->h() );
}
else if ( DrawingPrimitiveBox* box = dynamic_cast<DrawingPrimitiveBox*>(*primitive) )
else if ( auto* box = dynamic_cast<DrawingPrimitiveBox*>(*primitive) )
{
drawBox( box->x(), box->y(), box->w(), box->h() );
}
else if ( DrawingPrimitiveText* text = dynamic_cast<DrawingPrimitiveText*>(*primitive) )
else if ( auto* text = dynamic_cast<DrawingPrimitiveText*>(*primitive) )
{
drawText( text->x(), text->y(), text->size(), text->text() );
}
else if ( DrawingPrimitiveRing* ring = dynamic_cast<DrawingPrimitiveRing*>(*primitive) )
else if ( auto* ring = dynamic_cast<DrawingPrimitiveRing*>(*primitive) )
{
drawRing( ring->x(), ring->y(), ring->r(), ring->w() );
}
else if ( DrawingPrimitiveHexagon* hex = dynamic_cast<DrawingPrimitiveHexagon*>(*primitive) )
else if ( auto* hex = dynamic_cast<DrawingPrimitiveHexagon*>(*primitive) )
{
drawHexagon( hex->x(), hex->y(), hex->h() );
}
+1 -1
View File
@@ -38,7 +38,7 @@ namespace glabels
{
foreach( ModelObject* object, objects )
{
if ( ModelImageObject* imageObject = dynamic_cast<ModelImageObject*>(object) )
if ( auto* imageObject = dynamic_cast<ModelImageObject*>(object) )
{
TextNode filenameNode = imageObject->filenameNode();
if ( !filenameNode.isField() )
+1 -1
View File
@@ -87,7 +87,7 @@ namespace glabels
Db* Db::instance()
{
static Db* db = new Db();
static auto* db = new Db();
return db;
}
+1 -1
View File
@@ -161,7 +161,7 @@ namespace glabels
bool FrameCd::isSimilarTo( Frame* other ) const
{
if ( FrameCd *otherCd = dynamic_cast<FrameCd*>(other) )
if ( auto *otherCd = dynamic_cast<FrameCd*>(other) )
{
if ( (fabs( mW - otherCd->mW ) <= EPSILON) &&
(fabs( mH - otherCd->mH ) <= EPSILON) &&
+1 -1
View File
@@ -95,7 +95,7 @@ namespace glabels
bool FrameEllipse::isSimilarTo( Frame* other ) const
{
if ( FrameEllipse* otherEllipse = dynamic_cast<FrameEllipse*>(other) )
if ( auto* otherEllipse = dynamic_cast<FrameEllipse*>(other) )
{
if ( (fabs( mW - otherEllipse->mW ) <= EPSILON) &&
(fabs( mH - otherEllipse->mH ) <= EPSILON) )
+1 -1
View File
@@ -114,7 +114,7 @@ namespace glabels
bool FrameRect::isSimilarTo( Frame* other ) const
{
if ( FrameRect *otherRect = dynamic_cast<FrameRect*>(other) )
if ( auto *otherRect = dynamic_cast<FrameRect*>(other) )
{
if ( (fabs( mW - otherRect->mW ) <= EPSILON) &&
(fabs( mH - otherRect->mH ) <= EPSILON) )
+1 -1
View File
@@ -100,7 +100,7 @@ namespace glabels
bool FrameRound::isSimilarTo( Frame* other ) const
{
if ( FrameRound *otherRound = dynamic_cast<FrameRound*>(other) )
if ( auto *otherRound = dynamic_cast<FrameRound*>(other) )
{
if ( fabs( mR - otherRound->mR ) <= EPSILON )
{
+1 -1
View File
@@ -99,7 +99,7 @@ namespace glabels
Layout* Layout::dup() const
{
Layout *other = new Layout( *this );
auto *other = new Layout( *this );
return other;
}
+4 -4
View File
@@ -65,7 +65,7 @@ namespace glabels
///
Model* Model::save() const
{
Model* savedModel = new Model;
auto* savedModel = new Model;
savedModel->restore( this );
return savedModel;
@@ -1344,7 +1344,7 @@ namespace glabels
QByteArray buffer;
XmlLabelCreator::serializeObjects( getSelection(), buffer );
QMimeData *mimeData = new QMimeData;
auto *mimeData = new QMimeData;
mimeData->setData( MIME_TYPE, buffer );
clipboard->setMimeData( mimeData );
@@ -1410,7 +1410,7 @@ namespace glabels
else if ( mimeData->hasImage() )
{
// Create object from clipboard image
ModelImageObject* object = new ModelImageObject();
auto* object = new ModelImageObject();
object->setImage( qvariant_cast<QImage>(mimeData->imageData()) );
object->setSize( object->naturalSize() );
object->setPosition( (w()-object->w())/2.0, (h()-object->h())/2.0 );
@@ -1421,7 +1421,7 @@ namespace glabels
else if ( mimeData->hasText() )
{
// Create object from clipboard text
ModelTextObject* object = new ModelTextObject();
auto* object = new ModelTextObject();
object->setText( mimeData->text() );
object->setSize( object->naturalSize() );
object->setPosition( (w()-object->w())/2.0, (h()-object->h())/2.0 );
+2 -2
View File
@@ -551,10 +551,10 @@ namespace glabels
int b = color.blue();
int a = color.alpha();
QImage* shadow = new QImage( *mImage );
auto* shadow = new QImage( *mImage );
for ( int iy = 0; iy < shadow->height(); iy++ )
{
QRgb* scanLine = (QRgb*)shadow->scanLine( iy );
auto* scanLine = (QRgb*)shadow->scanLine( iy );
for ( int ix = 0; ix < shadow->width(); ix++ )
{
+2 -2
View File
@@ -68,8 +68,8 @@ namespace glabels
/* Simple integer. */
return QString().sprintf( "%.0f", x );
}
int n = (int)( x * denom[i] + 0.5 );
int d = (int)denom[i];
auto n = int( x * denom[i] + 0.5 );
auto d = int( denom[i] );
if ( n > d )
{
return QString::number(n/d) +
+1 -1
View File
@@ -95,7 +95,7 @@ namespace glabels
QString id = XmlUtil::getStringAttr( node, "id", "" );
QString name = XmlUtil::getI18nAttr( node, "name", "" );
Category *category = new Category( id, name );
auto *category = new Category( id, name );
if ( category != nullptr )
{
Db::registerCategory( category );
+6 -6
View File
@@ -132,27 +132,27 @@ namespace glabels
foreach ( ModelObject* object, objects )
{
if ( ModelBoxObject* boxObject = dynamic_cast<ModelBoxObject*>(object) )
if ( auto* boxObject = dynamic_cast<ModelBoxObject*>(object) )
{
createObjectBoxNode( node, boxObject );
}
else if ( ModelEllipseObject* ellipseObject = dynamic_cast<ModelEllipseObject*>(object) )
else if ( auto* ellipseObject = dynamic_cast<ModelEllipseObject*>(object) )
{
createObjectEllipseNode( node, ellipseObject );
}
else if ( ModelLineObject* lineObject = dynamic_cast<ModelLineObject*>(object) )
else if ( auto* lineObject = dynamic_cast<ModelLineObject*>(object) )
{
createObjectLineNode( node, lineObject );
}
else if ( ModelImageObject* imageObject = dynamic_cast<ModelImageObject*>(object) )
else if ( auto* imageObject = dynamic_cast<ModelImageObject*>(object) )
{
createObjectImageNode( node, imageObject );
}
else if ( ModelBarcodeObject* barcodeObject = dynamic_cast<ModelBarcodeObject*>(object) )
else if ( auto* barcodeObject = dynamic_cast<ModelBarcodeObject*>(object) )
{
createObjectBarcodeNode( node, barcodeObject );
}
else if ( ModelTextObject* textObject = dynamic_cast<ModelTextObject*>(object) )
else if ( auto* textObject = dynamic_cast<ModelTextObject*>(object) )
{
createObjectTextNode( node, textObject );
}
+1 -1
View File
@@ -242,7 +242,7 @@ namespace glabels
qWarning() << "TODO: compatability mode.";
}
Model* label = new Model();
auto* label = new Model();
/* Pass 1, extract data nodes to pre-load cache. */
DataCache data;
+1 -1
View File
@@ -100,7 +100,7 @@ namespace glabels
QString pwgSize = XmlUtil::getStringAttr( node, "pwg_size", "" );
Paper *paper = new Paper( id, name, width, height, pwgSize );
auto *paper = new Paper( id, name, width, height, pwgSize );
if ( paper != nullptr )
{
Db::registerPaper( paper );
+9 -9
View File
@@ -125,19 +125,19 @@ namespace glabels
void XmlTemplateCreator::createLabelNode( QDomElement &parent, const Frame* frame )
{
if ( const FrameRect* frameRect = dynamic_cast<const FrameRect*>(frame) )
if ( const auto* frameRect = dynamic_cast<const FrameRect*>(frame) )
{
createLabelRectangleNode( parent, frameRect );
}
else if ( const FrameEllipse* frameEllipse = dynamic_cast<const FrameEllipse*>(frame) )
else if ( const auto* frameEllipse = dynamic_cast<const FrameEllipse*>(frame) )
{
createLabelEllipseNode( parent, frameEllipse );
}
else if ( const FrameRound* frameRound = dynamic_cast<const FrameRound*>(frame) )
else if ( const auto* frameRound = dynamic_cast<const FrameRound*>(frame) )
{
createLabelRoundNode( parent, frameRound );
}
else if ( const FrameCd* frameCd = dynamic_cast<const FrameCd*>(frame) )
else if ( const auto* frameCd = dynamic_cast<const FrameCd*>(frame) )
{
createLabelCdNode( parent, frameCd );
}
@@ -221,23 +221,23 @@ namespace glabels
{
foreach ( Markup* markup, frame->markups() )
{
if ( MarkupMargin* markupMargin = dynamic_cast<MarkupMargin*>(markup) )
if ( auto* markupMargin = dynamic_cast<MarkupMargin*>(markup) )
{
createMarkupMarginNode( node, markupMargin );
}
else if ( MarkupLine* markupLine = dynamic_cast<MarkupLine*>(markup) )
else if ( auto* markupLine = dynamic_cast<MarkupLine*>(markup) )
{
createMarkupLineNode( node, markupLine );
}
else if ( MarkupCircle* markupCircle = dynamic_cast<MarkupCircle*>(markup) )
else if ( auto* markupCircle = dynamic_cast<MarkupCircle*>(markup) )
{
createMarkupCircleNode( node, markupCircle );
}
else if ( MarkupRect* markupRect = dynamic_cast<MarkupRect*>(markup) )
else if ( auto* markupRect = dynamic_cast<MarkupRect*>(markup) )
{
createMarkupRectNode( node, markupRect );
}
else if ( MarkupEllipse* markupEllipse = dynamic_cast<MarkupEllipse*>(markup) )
else if ( auto* markupEllipse = dynamic_cast<MarkupEllipse*>(markup) )
{
createMarkupEllipseNode( node, markupEllipse );
}
+1 -1
View File
@@ -95,7 +95,7 @@ namespace glabels
QString name = XmlUtil::getStringAttr( node, "name", "" );
QString url = XmlUtil::getStringAttr( node, "url", "" );
Vendor *vendor = new Vendor( name, url );
auto *vendor = new Vendor( name, url );
if ( vendor != nullptr )
{
Db::registerVendor( vendor );