ProjectExplorer: ProcessParameters code cosmetics

Change-Id: I050cb30222642911b582b9936186719cb4f09fa1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2020-10-05 14:43:23 +02:00
parent a53238e91c
commit b2b35eeddc
2 changed files with 10 additions and 15 deletions

View File

@@ -49,11 +49,7 @@ using namespace Utils;
namespace ProjectExplorer {
ProcessParameters::ProcessParameters() :
m_macroExpander(nullptr),
m_commandMissing(false)
{
}
ProcessParameters::ProcessParameters() = default;
/*!
Sets the command to run.
@@ -68,7 +64,6 @@ void ProcessParameters::setCommandLine(const CommandLine &cmdLine)
effectiveArguments();
}
/*!
Sets the \a workingDirectory for the process for a build configuration.
@@ -159,17 +154,17 @@ QString ProcessParameters::prettyCommand() const
QString cmd = m_command.executable().toString();
if (m_macroExpander)
cmd = m_macroExpander->expand(cmd);
return Utils::FilePath::fromString(cmd).fileName();
return FilePath::fromString(cmd).fileName();
}
QString ProcessParameters::prettyArguments() const
{
QString margs = effectiveArguments();
QString workDir = effectiveWorkingDirectory().toString();
Utils::QtcProcess::SplitError err;
Utils::QtcProcess::Arguments args =
Utils::QtcProcess::prepareArgs(margs, &err, Utils::HostOsInfo::hostOs(), &m_environment, &workDir);
if (err != Utils::QtcProcess::SplitOk)
QtcProcess::SplitError err;
QtcProcess::Arguments args =
QtcProcess::prepareArgs(margs, &err, HostOsInfo::hostOs(), &m_environment, &workDir);
if (err != QtcProcess::SplitOk)
return margs; // Sorry, too complex - just fall back.
return args.toString();
}
@@ -189,7 +184,7 @@ QString ProcessParameters::summary(const QString &displayName) const
return QString::fromLatin1("<b>%1:</b> %2 %3")
.arg(displayName,
Utils::QtcProcess::quoteArg(prettyCommand()),
QtcProcess::quoteArg(prettyCommand()),
prettyArguments());
}
@@ -200,7 +195,7 @@ QString ProcessParameters::summaryInWorkdir(const QString &displayName) const
return QString::fromLatin1("<b>%1:</b> %2 %3 in %4")
.arg(displayName,
Utils::QtcProcess::quoteArg(prettyCommand()),
QtcProcess::quoteArg(prettyCommand()),
prettyArguments(),
QDir::toNativeSeparators(effectiveWorkingDirectory().toString()));
}

View File

@@ -73,12 +73,12 @@ private:
Utils::FilePath m_workingDirectory;
Utils::CommandLine m_command;
Utils::Environment m_environment;
Utils::MacroExpander *m_macroExpander;
Utils::MacroExpander *m_macroExpander = nullptr;
mutable Utils::FilePath m_effectiveWorkingDirectory;
mutable Utils::FilePath m_effectiveCommand;
mutable QString m_effectiveArguments;
mutable bool m_commandMissing;
mutable bool m_commandMissing = false;
};
} // namespace ProjectExplorer