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 )
|
if ( mLayouts.size() == 1 )
|
||||||
{
|
{
|
||||||
Layout *layout = *mLayouts.begin();
|
Layout *layout = *mLayouts.begin();
|
||||||
@@ -51,16 +49,16 @@ namespace libglabels
|
|||||||
* %2 = number of labels down a page,
|
* %2 = number of labels down a page,
|
||||||
* %3 = total number of labels on a page (sheet).
|
* %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());
|
.arg(layout->nx()).arg(layout->ny()).arg(nLabels());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Translators: %1 is the total number of labels on a page (sheet). */
|
/* 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)
|
Q_DECLARE_TR_FUNCTIONS(Frame)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Frame( QString id = "0" ) : mId(id)
|
Frame( const QString &id = "0" ) : mId(id)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline const QString &id() const { return mId; }
|
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;
|
int nLabels() const;
|
||||||
QString &getLayoutDescription() const;
|
QString &layoutDescription();
|
||||||
std::vector<Point> getOrigins() const;
|
std::vector<Point> getOrigins() const;
|
||||||
|
|
||||||
void addLayout( Layout *layout );
|
void addLayout( Layout *layout );
|
||||||
void addMarkup( Markup *markup );
|
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:
|
private:
|
||||||
QString mId;
|
QString mId;
|
||||||
|
|
||||||
std::list<Layout*> mLayouts;
|
std::list<Layout*> mLayouts;
|
||||||
std::list<Markup*> mMarkups;
|
std::list<Markup*> mMarkups;
|
||||||
|
|
||||||
|
QString mLayoutDescription;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user