Commit 1a775dd8 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

A bit of cleanup/unduplication

parent 9e700af4
...@@ -39,6 +39,12 @@ ...@@ -39,6 +39,12 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
static const char * const PROCESS_COMMAND = "abstractProcess.command";
static const char * const PROCESS_WORKINGDIRECTORY = "abstractProcess.workingDirectory";
static const char * const PROCESS_ARGUMENTS = "abstractProcess.arguments";
static const char * const PROCESS_ENABLED = "abstractProcess.enabled";
static const char * const PROCESS_ENVIRONMENT = "abstractProcess.Environment";
AbstractProcessStep::AbstractProcessStep(Project *pro) AbstractProcessStep::AbstractProcessStep(Project *pro)
: BuildStep(pro) : BuildStep(pro)
{ {
...@@ -46,62 +52,61 @@ AbstractProcessStep::AbstractProcessStep(Project *pro) ...@@ -46,62 +52,61 @@ AbstractProcessStep::AbstractProcessStep(Project *pro)
void AbstractProcessStep::setCommand(const QString &buildConfiguration, const QString &cmd) void AbstractProcessStep::setCommand(const QString &buildConfiguration, const QString &cmd)
{ {
setValue(buildConfiguration, "abstractProcess.command", cmd); setValue(buildConfiguration, PROCESS_COMMAND, cmd);
} }
QString AbstractProcessStep::command(const QString &buildConfiguration) const QString AbstractProcessStep::command(const QString &buildConfiguration) const
{ {
return value(buildConfiguration, "abstractProcess.command").toString(); return value(buildConfiguration, PROCESS_COMMAND).toString();
} }
void AbstractProcessStep::setWorkingDirectory(const QString &buildConfiguration, const QString &workingDirectory) void AbstractProcessStep::setWorkingDirectory(const QString &buildConfiguration, const QString &workingDirectory)
{ {
setValue(buildConfiguration, "abstractProcess.workingDirectory", workingDirectory); setValue(buildConfiguration, PROCESS_WORKINGDIRECTORY, workingDirectory);
} }
QString AbstractProcessStep::workingDirectory(const QString &buildConfiguration) const QString AbstractProcessStep::workingDirectory(const QString &buildConfiguration) const
{ {
return value(buildConfiguration, "abstractProcess.workingDirectory").toString(); return value(buildConfiguration, PROCESS_WORKINGDIRECTORY).toString();
} }
void AbstractProcessStep::setArguments(const QString &buildConfiguration, const QStringList &arguments) void AbstractProcessStep::setArguments(const QString &buildConfiguration, const QStringList &arguments)
{ {
setValue(buildConfiguration, "abstractProcess.arguments", arguments); setValue(buildConfiguration, PROCESS_ARGUMENTS, arguments);
} }
QStringList AbstractProcessStep::arguments(const QString &buildConfiguration) const QStringList AbstractProcessStep::arguments(const QString &buildConfiguration) const
{ {
return value(buildConfiguration, "abstractProcess.arguments").toStringList(); return value(buildConfiguration, PROCESS_ARGUMENTS).toStringList();
} }
void AbstractProcessStep::setEnabled(const QString &buildConfiguration, bool b) void AbstractProcessStep::setEnabled(const QString &buildConfiguration, bool b)
{ {
setValue(buildConfiguration, "abstractProcess.enabled", b); setValue(buildConfiguration, PROCESS_ENABLED, b);
} }
bool AbstractProcessStep::enabled(const QString &buildConfiguration) const bool AbstractProcessStep::enabled(const QString &buildConfiguration) const
{ {
return value(buildConfiguration, "abstractProcess.enabled").toBool(); return value(buildConfiguration, PROCESS_ENABLED).toBool();
} }
void AbstractProcessStep::setEnvironment(const QString &buildConfiguration, Environment env) void AbstractProcessStep::setEnvironment(const QString &buildConfiguration, Environment env)
{ {
setValue(buildConfiguration, "abstractProcess.Environment", env.toStringList()); setValue(buildConfiguration, PROCESS_ENVIRONMENT, env.toStringList());
} }
Environment AbstractProcessStep::environment(const QString &buildConfiguration) const Environment AbstractProcessStep::environment(const QString &buildConfiguration) const
{ {
return Environment(value(buildConfiguration, "abstractProcess.Environment").toStringList()); return Environment(value(buildConfiguration, PROCESS_ENVIRONMENT).toStringList());
} }
bool AbstractProcessStep::init(const QString &name) bool AbstractProcessStep::init(const QString &name)
{ {
m_command = value(name, "abstractProcess.command").toString(); m_command = command(name);
m_arguments = value(name, "abstractProcess.arguments").toStringList(); m_arguments = arguments(name);
QVariant var = value(name, "abstractProcess.enabled"); m_enabled = enabled(name);
m_enabled = var.isValid() && var.toBool(); m_workingDirectory = workingDirectory(name);
m_workingDirectory = value(name, "abstractProcess.workingDirectory").toString(); m_environment = environment(name);
m_environment = Environment(value(name, "abstractProcess.Environment").toStringList());
return true; return true;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment