Allow user variables to be set from glabels-batch command line (#75)
This commit is contained in:
@@ -88,6 +88,12 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
void Variable::setInitialValue( const QString& value )
|
||||
{
|
||||
mInitialValue = value;
|
||||
}
|
||||
|
||||
|
||||
void Variable::resetValue()
|
||||
{
|
||||
switch (mType)
|
||||
|
||||
@@ -71,6 +71,8 @@ namespace glabels
|
||||
Increment increment() const;
|
||||
QString stepSize() const;
|
||||
|
||||
void setInitialValue( const QString& value );
|
||||
|
||||
void resetValue();
|
||||
void incrementValueOnItem();
|
||||
void incrementValueOnCopy();
|
||||
|
||||
@@ -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
|
||||
///
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user