Modifications to build successfully with -Werror -Wall -Wpedantic.

This commit is contained in:
Jim Evins
2017-04-07 20:37:25 -04:00
parent 8184027c05
commit cc354d06da
13 changed files with 36 additions and 25 deletions
+3
View File
@@ -8,6 +8,9 @@ if (NOT WIN32)
add_compile_options (-fPIC) add_compile_options (-fPIC)
endif () endif ()
# Uncomment to build with pedantic flags
#add_compile_options (-Werror -Wall -Wpedantic)
#======================================= #=======================================
# Auto-generate Version.h # Auto-generate Version.h
+1 -1
View File
@@ -43,7 +43,7 @@ namespace glabels
{ {
if ( const QImage* image = imageObject->image() ) if ( const QImage* image = imageObject->image() )
{ {
addImage( filenameNode.data(), *imageObject->image() ); addImage( filenameNode.data(), *image );
} }
else else
{ {
+4 -3
View File
@@ -35,7 +35,7 @@ namespace glabels
const Distance& h, const Distance& h,
const Distance& waste, const Distance& waste,
const QString& id ) const QString& id )
: mR1(r1), mR2(r2), mW(w), mH(h), mWaste(waste), Frame(id) : Frame(id), mR1(r1), mR2(r2), mW(w), mH(h), mWaste(waste)
{ {
Distance wReal = (mW == 0) ? 2*mR1 : mW; Distance wReal = (mW == 0) ? 2*mR1 : mW;
Distance hReal = (mH == 0) ? 2*mR1 : mH; Distance hReal = (mH == 0) ? 2*mR1 : mH;
@@ -92,8 +92,9 @@ namespace glabels
FrameCd::FrameCd( const FrameCd& other ) FrameCd::FrameCd( const FrameCd& other )
: mR1(other.mR1), mR2(other.mR2), mW(other.mW), mH(other.mH), mWaste(other.mWaste), : Frame(other),
mPath(other.mPath), Frame(other) mR1(other.mR1), mR2(other.mR2), mW(other.mW), mH(other.mH), mWaste(other.mWaste),
mPath(other.mPath)
{ {
// empty // empty
} }
+2 -2
View File
@@ -31,14 +31,14 @@ namespace glabels
const Distance& h, const Distance& h,
const Distance& waste, const Distance& waste,
const QString& id ) const QString& id )
: mW(w), mH(h), mWaste(waste), Frame(id) : Frame(id), mW(w), mH(h), mWaste(waste)
{ {
mPath.addEllipse( 0, 0, mW.pt(), mH.pt() ); mPath.addEllipse( 0, 0, mW.pt(), mH.pt() );
mClipPath.addEllipse( -mWaste.pt(), -mWaste.pt(), (mW+2*mWaste).pt(), (mH+2*mWaste).pt() ); mClipPath.addEllipse( -mWaste.pt(), -mWaste.pt(), (mW+2*mWaste).pt(), (mH+2*mWaste).pt() );
} }
FrameEllipse::FrameEllipse( const FrameEllipse& other ) FrameEllipse::FrameEllipse( const FrameEllipse& other )
: mW(other.mW), mH(other.mH), mWaste(other.mWaste), mPath(other.mPath), Frame(other) : Frame(other), mW(other.mW), mH(other.mH), mWaste(other.mWaste), mPath(other.mPath)
{ {
// empty // empty
} }
+4 -3
View File
@@ -33,7 +33,7 @@ namespace glabels
const Distance& xWaste, const Distance& xWaste,
const Distance& yWaste, const Distance& yWaste,
const QString& id ) const QString& id )
: mW(w), mH(h), mR(r), mXWaste(xWaste), mYWaste(yWaste), Frame(id) : Frame(id), mW(w), mH(h), mR(r), mXWaste(xWaste), mYWaste(yWaste)
{ {
mPath.addRoundedRect( 0, 0, mW.pt(), mH.pt(), mR.pt(), mR.pt() ); mPath.addRoundedRect( 0, 0, mW.pt(), mH.pt(), mR.pt(), mR.pt() );
@@ -44,8 +44,9 @@ namespace glabels
FrameRect::FrameRect( const FrameRect &other ) FrameRect::FrameRect( const FrameRect &other )
: mW(other.mW), mH(other.mH), mR(other.mR), mXWaste(other.mXWaste), : Frame(other),
mYWaste(other.mYWaste), mPath(other.mPath), Frame(other) mW(other.mW), mH(other.mH), mR(other.mR), mXWaste(other.mXWaste),
mYWaste(other.mYWaste), mPath(other.mPath)
{ {
// empty // empty
} }
+2 -2
View File
@@ -30,7 +30,7 @@ namespace glabels
FrameRound::FrameRound( const Distance& r, FrameRound::FrameRound( const Distance& r,
const Distance& waste, const Distance& waste,
const QString& id ) const QString& id )
: mR(r), mWaste(waste), Frame(id) : Frame(id), mR(r), mWaste(waste)
{ {
mPath.addEllipse( 0, 0, 2*mR.pt(), 2*mR.pt() ); mPath.addEllipse( 0, 0, 2*mR.pt(), 2*mR.pt() );
mClipPath.addEllipse( -mWaste.pt(), -mWaste.pt(), mClipPath.addEllipse( -mWaste.pt(), -mWaste.pt(),
@@ -39,7 +39,7 @@ namespace glabels
FrameRound::FrameRound( const FrameRound& other ) FrameRound::FrameRound( const FrameRound& other )
: mR(other.mR), mWaste(other.mWaste), mPath(other.mPath), Frame(other) : Frame(other), mR(other.mR), mWaste(other.mWaste), mPath(other.mPath)
{ {
// empty // empty
} }
+3 -3
View File
@@ -35,7 +35,7 @@ namespace glabels
/// Constructor /// Constructor
/// ///
Text::Text( QChar delimiter, bool line1HasKeys ) Text::Text( QChar delimiter, bool line1HasKeys )
: mNFieldsMax(0), mDelimeter(delimiter), mLine1HasKeys(line1HasKeys) : mDelimeter(delimiter), mLine1HasKeys(line1HasKeys), mNFieldsMax(0)
{ {
} }
@@ -45,8 +45,8 @@ namespace glabels
/// ///
Text::Text( const Text* merge ) Text::Text( const Text* merge )
: Merge( merge ), : Merge( merge ),
mNFieldsMax(merge->mNFieldsMax), mDelimeter(merge->mDelimeter), mLine1HasKeys(merge->mLine1HasKeys),
mDelimeter(merge->mDelimeter), mLine1HasKeys(merge->mLine1HasKeys) mNFieldsMax(merge->mNFieldsMax)
{ {
} }
+1 -1
View File
@@ -47,7 +47,7 @@ namespace glabels
PageRenderer::PageRenderer() PageRenderer::PageRenderer()
: mModel(nullptr), mNCopies(0), mStartLabel(0), : mModel(nullptr), mNCopies(0), mStartLabel(0),
mPrintOutlines(false), mPrintCropMarks(false), mPrintReverse(false), mPrintOutlines(false), mPrintCropMarks(false), mPrintReverse(false),
mIsMerge(false), mIPage(0), mNPages(0) mIPage(0), mIsMerge(false), mNPages(0)
{ {
// empty // empty
} }
+1 -1
View File
@@ -54,7 +54,7 @@ namespace glabels
/// Constructor /// Constructor
/// ///
Preview::Preview( QWidget *parent ) Preview::Preview( QWidget *parent )
: mModel(nullptr), mRenderer(nullptr), QGraphicsView(parent) : QGraphicsView(parent), mModel(nullptr), mRenderer(nullptr)
{ {
mScene = new QGraphicsScene(); mScene = new QGraphicsScene();
setScene( mScene ); setScene( mScene );
+1 -1
View File
@@ -58,7 +58,7 @@ namespace glabels
/// Constructor /// Constructor
/// ///
SimplePreview::SimplePreview( QWidget *parent ) SimplePreview::SimplePreview( QWidget *parent )
: mTmplate(nullptr), mRotateFlag(false), QGraphicsView(parent) : QGraphicsView(parent), mTmplate(nullptr), mRotateFlag(false)
{ {
mScene = new QGraphicsScene(); mScene = new QGraphicsScene();
setScene( mScene ); setScene( mScene );
+9 -5
View File
@@ -31,7 +31,7 @@ namespace glabels
// //
// Static data // Static data
// //
Units XmlUtil::mUnits; XmlUtil* XmlUtil::mInstance = nullptr;
XmlUtil::XmlUtil() XmlUtil::XmlUtil()
@@ -42,7 +42,10 @@ namespace glabels
void XmlUtil::init() void XmlUtil::init()
{ {
static XmlUtil* xmlUtil = new XmlUtil(); if ( mInstance == nullptr )
{
mInstance = new XmlUtil();
}
} }
@@ -50,7 +53,7 @@ namespace glabels
{ {
init(); init();
return mUnits; return mInstance->mUnits;
} }
@@ -58,7 +61,7 @@ namespace glabels
{ {
init(); init();
mUnits = units; mInstance->mUnits = units;
} }
@@ -287,7 +290,8 @@ namespace glabels
{ {
init(); init();
node.setAttribute( name, QString::number(value.inUnits(mUnits)) + mUnits.toIdString() ); Units units = mInstance->mUnits;
node.setAttribute( name, QString::number(value.inUnits(units)) + units.toIdString() );
} }
} // namespace glabels } // namespace glabels
+3 -1
View File
@@ -99,7 +99,9 @@ namespace glabels
const Distance& value ); const Distance& value );
private: private:
static Units mUnits; Units mUnits;
static XmlUtil* mInstance;
}; };
+2 -2
View File
@@ -97,8 +97,8 @@
<context> <context>
<name>FrameCd</name> <name>FrameCd</name>
<message> <message>
<location filename="../glabels/FrameCd.cpp" line="147"/> <location filename="../glabels/FrameCd.cpp" line="148"/>
<location filename="../glabels/FrameCd.cpp" line="154"/> <location filename="../glabels/FrameCd.cpp" line="155"/>
<source>diameter</source> <source>diameter</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>