Increment per item, not per merge record.

This commit is contained in:
Jim Evins
2019-03-24 22:33:40 -04:00
parent efbb052856
commit 54a66dfd8f
7 changed files with 34 additions and 33 deletions
+1 -1
View File
@@ -37,8 +37,8 @@ namespace
// All variable increments. (must be in sorted order) // All variable increments. (must be in sorted order)
const QVector<glabels::model::Variable::Increment> allIncrements = { const QVector<glabels::model::Variable::Increment> allIncrements = {
glabels::model::Variable::Increment::NEVER, glabels::model::Variable::Increment::NEVER,
glabels::model::Variable::Increment::PER_ITEM,
glabels::model::Variable::Increment::PER_COPY, glabels::model::Variable::Increment::PER_COPY,
glabels::model::Variable::Increment::PER_MERGE_RECORD,
glabels::model::Variable::Increment::PER_PAGE glabels::model::Variable::Increment::PER_PAGE
}; };
} }
+2 -1
View File
@@ -283,6 +283,7 @@ namespace glabels
iLabel++; iLabel++;
iCurrentPage = iLabel / mNLabelsPerPage; iCurrentPage = iLabel / mNLabelsPerPage;
mVariables->incrementVariablesOnItem();
mVariables->incrementVariablesOnCopy(); mVariables->incrementVariablesOnCopy();
if ( (iLabel % mNLabelsPerPage) == 0 /* starting a new page */ ) if ( (iLabel % mNLabelsPerPage) == 0 /* starting a new page */ )
{ {
@@ -341,7 +342,7 @@ namespace glabels
iLabel++; iLabel++;
iCurrentPage = iLabel / mNLabelsPerPage; iCurrentPage = iLabel / mNLabelsPerPage;
mVariables->incrementVariablesOnMerge(); mVariables->incrementVariablesOnItem();
if ( iRecord == 0 ) if ( iRecord == 0 )
{ {
mVariables->incrementVariablesOnCopy(); mVariables->incrementVariablesOnCopy();
+12 -12
View File
@@ -90,9 +90,9 @@ namespace glabels
} }
void Variable::incrementValueOnCopy() void Variable::incrementValueOnItem()
{ {
if ( mIncrement == Increment::PER_COPY ) if ( mIncrement == Increment::PER_ITEM )
{ {
switch (mType) switch (mType)
{ {
@@ -110,9 +110,9 @@ namespace glabels
} }
void Variable::incrementValueOnMerge() void Variable::incrementValueOnCopy()
{ {
if ( mIncrement == Increment::PER_MERGE_RECORD ) if ( mIncrement == Increment::PER_COPY )
{ {
switch (mType) switch (mType)
{ {
@@ -219,10 +219,10 @@ namespace glabels
{ {
case Increment::NEVER: case Increment::NEVER:
return tr("Never"); return tr("Never");
case Increment::PER_ITEM:
return tr("Per item");
case Increment::PER_COPY: case Increment::PER_COPY:
return tr("Per copy"); return tr("Per copy");
case Increment::PER_MERGE_RECORD:
return tr("Per merge record");
case Increment::PER_PAGE: case Increment::PER_PAGE:
return tr("Per page"); return tr("Per page");
} }
@@ -235,10 +235,10 @@ namespace glabels
{ {
case Increment::NEVER: case Increment::NEVER:
return "never"; return "never";
case Increment::PER_ITEM:
return "per_item";
case Increment::PER_COPY: case Increment::PER_COPY:
return "per_copy"; return "per_copy";
case Increment::PER_MERGE_RECORD:
return "per_merge_record";
case Increment::PER_PAGE: case Increment::PER_PAGE:
return "per_page"; return "per_page";
} }
@@ -251,14 +251,14 @@ namespace glabels
{ {
return Increment::NEVER; return Increment::NEVER;
} }
else if ( id == "per_item" )
{
return Increment::PER_ITEM;
}
else if ( id == "per_copy" ) else if ( id == "per_copy" )
{ {
return Increment::PER_COPY; return Increment::PER_COPY;
} }
else if ( id == "per_merge_record" )
{
return Increment::PER_MERGE_RECORD;
}
else if ( id == "per_page" ) else if ( id == "per_page" )
{ {
return Increment::PER_PAGE; return Increment::PER_PAGE;
+2 -2
View File
@@ -46,8 +46,8 @@ namespace glabels
enum class Increment enum class Increment
{ {
NEVER, NEVER,
PER_ITEM,
PER_COPY, PER_COPY,
PER_MERGE_RECORD,
PER_PAGE PER_PAGE
}; };
@@ -71,8 +71,8 @@ namespace glabels
QString stepSize() const; QString stepSize() const;
void resetValue(); void resetValue();
void incrementValueOnItem();
void incrementValueOnCopy(); void incrementValueOnCopy();
void incrementValueOnMerge();
void incrementValueOnPage(); void incrementValueOnPage();
QString value() const; QString value() const;
+12 -12
View File
@@ -97,6 +97,18 @@ namespace glabels
} }
///
/// Increment variables on item
///
void Variables::incrementVariablesOnItem()
{
for ( auto& v : *this )
{
v.incrementValueOnItem();
}
}
/// ///
/// Increment variables on copy /// Increment variables on copy
/// ///
@@ -109,18 +121,6 @@ namespace glabels
} }
///
/// Increment variables on merge record
///
void Variables::incrementVariablesOnMerge()
{
for ( auto& v : *this )
{
v.incrementValueOnMerge();
}
}
/// ///
/// Increment variables on page /// Increment variables on page
/// ///
+1 -1
View File
@@ -64,8 +64,8 @@ namespace glabels
void replaceVariable( const QString& name, const Variable& variable ); void replaceVariable( const QString& name, const Variable& variable );
void resetVariables(); void resetVariables();
void incrementVariablesOnItem();
void incrementVariablesOnCopy(); void incrementVariablesOnCopy();
void incrementVariablesOnMerge();
void incrementVariablesOnPage(); void incrementVariablesOnPage();
+4 -4
View File
@@ -1072,10 +1072,6 @@
<source>Per copy</source> <source>Per copy</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Per merge record</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Per page</source> <source>Per page</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@@ -1088,6 +1084,10 @@
<source>Floating Point</source> <source>Floating Point</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Per item</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VariablesView</name> <name>VariablesView</name>