Allow user variables to be set from glabels-batch command line (#75)

This commit is contained in:
Jim Evins
2019-10-12 21:57:04 -04:00
parent 1a900d0ebc
commit 7a02c0b226
6 changed files with 60 additions and 2 deletions
+6
View File
@@ -88,6 +88,12 @@ namespace glabels
}
void Variable::setInitialValue( const QString& value )
{
mInitialValue = value;
}
void Variable::resetValue()
{
switch (mType)
+2
View File
@@ -71,6 +71,8 @@ namespace glabels
Increment increment() const;
QString stepSize() const;
void setInitialValue( const QString& value );
void resetValue();
void incrementValueOnItem();
void incrementValueOnCopy();
+21
View File
@@ -85,6 +85,27 @@ namespace glabels
}
///
/// Set initial value of multiple variables
///
void Variables::setVariables( const QMap<QString,QString>& definitions )
{
for ( auto& name : definitions.keys() )
{
if ( hasVariable( name ) )
{
(*this)[name].setInitialValue( definitions[name] );
}
else
{
addVariable( Variable( Variable::Type::STRING,
name,
definitions[name] ) );
}
}
}
///
/// Reset variables to their initial values
///
+2
View File
@@ -63,6 +63,8 @@ namespace glabels
void deleteVariable( const QString& name );
void replaceVariable( const QString& name, const Variable& variable );
void setVariables( const QMap<QString,QString>& definitions );
void resetVariables();
void incrementVariablesOnItem();
void incrementVariablesOnCopy();