From a11b498e9aa36169e0cf29348ad6b462abd49d63 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Thu, 31 Oct 2013 00:00:00 -0400 Subject: [PATCH] Store copy of layoutDescription in Frame. --- libglabels/Frame.cpp | 10 ++++------ libglabels/Frame.h | 14 ++++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libglabels/Frame.cpp b/libglabels/Frame.cpp index 62a518a..f403cd6 100644 --- a/libglabels/Frame.cpp +++ b/libglabels/Frame.cpp @@ -38,10 +38,8 @@ namespace libglabels } - QString &Frame::getLayoutDescription() const + QString &Frame::layoutDescription() { - QString description; - if ( mLayouts.size() == 1 ) { Layout *layout = *mLayouts.begin(); @@ -51,16 +49,16 @@ namespace libglabels * %2 = number of labels down a page, * %3 = total number of labels on a page (sheet). */ - description = QString( tr("%1 x %2 (%3 per sheet)") ) + mLayoutDescription = QString( tr("%1 x %2 (%3 per sheet)") ) .arg(layout->nx()).arg(layout->ny()).arg(nLabels()); } else { /* Translators: %1 is the total number of labels on a page (sheet). */ - description = QString( tr("%1 per sheet") ).arg( nLabels() ); + mLayoutDescription = QString( tr("%1 per sheet") ).arg( nLabels() ); } - return description; + return mLayoutDescription; } diff --git a/libglabels/Frame.h b/libglabels/Frame.h index 1655fe8..a75e2f9 100644 --- a/libglabels/Frame.h +++ b/libglabels/Frame.h @@ -41,29 +41,31 @@ namespace libglabels Q_DECLARE_TR_FUNCTIONS(Frame) protected: - Frame( QString id = "0" ) : mId(id) + Frame( const QString &id = "0" ) : mId(id) { } public: inline const QString &id() const { return mId; } - virtual void getSize( double *w, double *h ) const = 0; - virtual bool isSimilar( Frame *b ) const = 0; - virtual QString &getSizeDescription( Units *units ) const = 0; - int nLabels() const; - QString &getLayoutDescription() const; + QString &layoutDescription(); std::vector getOrigins() const; void addLayout( Layout *layout ); void addMarkup( Markup *markup ); + virtual void getSize( double *w, double *h ) const = 0; + virtual bool isSimilar( Frame *b ) const = 0; + virtual QString &getSizeDescription( Units *units ) const = 0; + private: QString mId; std::list mLayouts; std::list mMarkups; + + QString mLayoutDescription; }; }