Removed C++17 nested namespace definitions. Should build on trusty again.

This commit is contained in:
Jim Evins
2017-11-24 15:49:26 -05:00
parent 4821e103bc
commit c9f2b91daf
129 changed files with 18995 additions and 18592 deletions
+97 -94
View File
@@ -25,114 +25,117 @@
#include <algorithm>
namespace glabels::model
namespace glabels
{
Frame::Frame( const QString& id )
: mId(id), mNLabels(0), mLayoutDescription("")
namespace model
{
// empty
}
Frame::Frame( const Frame& other )
{
mId = other.mId;
mNLabels = 0;
foreach ( Layout *layout, mLayouts )
Frame::Frame( const QString& id )
: mId(id), mNLabels(0), mLayoutDescription("")
{
addLayout( layout->dup() );
// empty
}
foreach ( Markup *markup, mMarkups )
Frame::Frame( const Frame& other )
{
addMarkup( markup->dup() );
}
}
mId = other.mId;
mNLabels = 0;
QString Frame::id() const
{
return mId;
}
int Frame::nLabels() const
{
return mNLabels;
}
QString Frame::layoutDescription() const
{
return mLayoutDescription;
}
const QList<Layout*>& Frame::layouts() const
{
return mLayouts;
}
const QList<Markup*>& Frame::markups() const
{
return mMarkups;
}
QVector<Point> Frame::getOrigins() const
{
QVector<Point> origins( nLabels() );
int i = 0;
foreach ( Layout *layout, mLayouts )
{
for ( int iy = 0; iy < layout->ny(); iy++ )
foreach ( Layout *layout, mLayouts )
{
for ( int ix = 0; ix < layout->nx(); ix++ )
{
origins[i++] = Point( ix*layout->dx() + layout->x0(), iy*layout->dy() + layout->y0() );
}
addLayout( layout->dup() );
}
foreach ( Markup *markup, mMarkups )
{
addMarkup( markup->dup() );
}
}
std::stable_sort( origins.begin(), origins.end() );
return origins;
}
void Frame::addLayout( Layout *layout )
{
mLayouts << layout;
// Update total number of labels
mNLabels += layout->nx() * layout->ny();
// Update layout description
if ( mLayouts.size() == 1 )
QString Frame::id() const
{
/*
* Translators: %1 = number of labels across a page,
* %2 = number of labels down a page,
* %3 = total number of labels on a page (sheet).
*/
mLayoutDescription = QString( tr("%1 x %2 (%3 per sheet)") )
.arg(layout->nx()).arg(layout->ny()).arg(mNLabels);
return mId;
}
else
int Frame::nLabels() const
{
/* Translators: %1 is the total number of labels on a page (sheet). */
mLayoutDescription = QString( tr("%1 per sheet") ).arg(mNLabels);
return mNLabels;
}
QString Frame::layoutDescription() const
{
return mLayoutDescription;
}
const QList<Layout*>& Frame::layouts() const
{
return mLayouts;
}
const QList<Markup*>& Frame::markups() const
{
return mMarkups;
}
QVector<Point> Frame::getOrigins() const
{
QVector<Point> origins( nLabels() );
int i = 0;
foreach ( Layout *layout, mLayouts )
{
for ( int iy = 0; iy < layout->ny(); iy++ )
{
for ( int ix = 0; ix < layout->nx(); ix++ )
{
origins[i++] = Point( ix*layout->dx() + layout->x0(), iy*layout->dy() + layout->y0() );
}
}
}
std::stable_sort( origins.begin(), origins.end() );
return origins;
}
void Frame::addLayout( Layout *layout )
{
mLayouts << layout;
// Update total number of labels
mNLabels += layout->nx() * layout->ny();
// Update layout description
if ( mLayouts.size() == 1 )
{
/*
* Translators: %1 = number of labels across a page,
* %2 = number of labels down a page,
* %3 = total number of labels on a page (sheet).
*/
mLayoutDescription = QString( tr("%1 x %2 (%3 per sheet)") )
.arg(layout->nx()).arg(layout->ny()).arg(mNLabels);
}
else
{
/* Translators: %1 is the total number of labels on a page (sheet). */
mLayoutDescription = QString( tr("%1 per sheet") ).arg(mNLabels);
}
}
void Frame::addMarkup( Markup *markup )
{
mMarkups << markup;
}
}
void Frame::addMarkup( Markup *markup )
{
mMarkups << markup;
}
} // namespace glabels::model
}