Added simple page size filtering.

This commit is contained in:
Jim Evins
2013-11-13 00:04:00 -05:00
parent 5ce9121801
commit 1c02315db9
7 changed files with 77 additions and 17 deletions
+3
View File
@@ -52,6 +52,9 @@ namespace libglabels
/* PWG 5101.1-2002 size name */
inline QString pwgSize() const { return mPwgSize; }
inline bool isSizeIso() const { return mPwgSize.startsWith( "iso_" ); }
inline bool isSizeUs() const { return mPwgSize.startsWith( "na_" ); }
private:
QString mId;
QString mName;
+29
View File
@@ -28,6 +28,33 @@
namespace libglabels
{
Template::Template( const QString &brand,
const QString &part,
const QString &description,
const QString &paperId,
double pageWidth = 0,
double pageHeight = 0 )
: mBrand(brand),
mPart(part),
mDescription(description),
mPaperId(paperId),
mPageWidth(pageWidth),
mPageHeight(pageHeight),
mIsSizeIso(false),
mIsSizeUs(false),
mName("")
{
mName.append( brand ).append( " " ).append( part );
if ( Db::isPaperIdKnown( paperId ) )
{
const Paper *paper = Db::lookupPaperFromId( paperId );
mIsSizeIso = paper->isSizeIso();
mIsSizeUs = paper->isSizeUs();
}
}
Template::Template( const Template &other )
{
mBrand = other.mBrand;
@@ -36,6 +63,8 @@ namespace libglabels
mPaperId = other.mPaperId;
mPageWidth = other.mPageWidth;
mPageHeight = other.mPageHeight;
mIsSizeIso = other.mIsSizeIso;
mIsSizeUs = other.mIsSizeUs;
mEquivPart = other.mEquivPart;
mName = other.mName;
mProductUrl = other.mProductUrl;
+7 -12
View File
@@ -50,18 +50,8 @@ namespace libglabels
const QString &part,
const QString &description,
const QString &paperId,
double pageWidth = 0,
double pageHeight = 0 )
: mBrand(brand),
mPart(part),
mDescription(description),
mPaperId(paperId),
mPageWidth(pageWidth),
mPageHeight(pageHeight),
mName("")
{
mName.append( brand ).append( " " ).append( part );
}
double pageWidth,
double pageHeight );
Template( const Template &other );
@@ -84,6 +74,9 @@ namespace libglabels
inline const QString &paperId() const { return mPaperId; }
inline double pageWidth() const { return mPageWidth; }
inline double pageHeight() const { return mPageHeight; }
inline bool isSizeIso() const { return mIsSizeIso; }
inline bool isSizeUs() const { return mIsSizeUs; }
inline bool isSizeOther() const { return !mIsSizeIso && !mIsSizeUs; }
inline const QString &equivPart() const { return mEquivPart; }
inline void setEquivPart( const QString &value ) { mEquivPart = value; }
@@ -115,6 +108,8 @@ namespace libglabels
QString mPaperId;
double mPageWidth;
double mPageHeight;
bool mIsSizeIso;
bool mIsSizeUs;
QString mEquivPart;
QString mName;