Store copy of layoutDescription in Frame.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+8
-6
@@ -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<Point> 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<Layout*> mLayouts;
|
||||
std::list<Markup*> mMarkups;
|
||||
|
||||
QString mLayoutDescription;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user