forked from qt-creator/qt-creator
ProjectExplorer: ProcessParameters code cosmetics
Change-Id: I050cb30222642911b582b9936186719cb4f09fa1 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -49,11 +49,7 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
ProcessParameters::ProcessParameters() :
|
ProcessParameters::ProcessParameters() = default;
|
||||||
m_macroExpander(nullptr),
|
|
||||||
m_commandMissing(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the command to run.
|
Sets the command to run.
|
||||||
@@ -68,7 +64,6 @@ void ProcessParameters::setCommandLine(const CommandLine &cmdLine)
|
|||||||
effectiveArguments();
|
effectiveArguments();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the \a workingDirectory for the process for a build configuration.
|
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();
|
QString cmd = m_command.executable().toString();
|
||||||
if (m_macroExpander)
|
if (m_macroExpander)
|
||||||
cmd = m_macroExpander->expand(cmd);
|
cmd = m_macroExpander->expand(cmd);
|
||||||
return Utils::FilePath::fromString(cmd).fileName();
|
return FilePath::fromString(cmd).fileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ProcessParameters::prettyArguments() const
|
QString ProcessParameters::prettyArguments() const
|
||||||
{
|
{
|
||||||
QString margs = effectiveArguments();
|
QString margs = effectiveArguments();
|
||||||
QString workDir = effectiveWorkingDirectory().toString();
|
QString workDir = effectiveWorkingDirectory().toString();
|
||||||
Utils::QtcProcess::SplitError err;
|
QtcProcess::SplitError err;
|
||||||
Utils::QtcProcess::Arguments args =
|
QtcProcess::Arguments args =
|
||||||
Utils::QtcProcess::prepareArgs(margs, &err, Utils::HostOsInfo::hostOs(), &m_environment, &workDir);
|
QtcProcess::prepareArgs(margs, &err, HostOsInfo::hostOs(), &m_environment, &workDir);
|
||||||
if (err != Utils::QtcProcess::SplitOk)
|
if (err != QtcProcess::SplitOk)
|
||||||
return margs; // Sorry, too complex - just fall back.
|
return margs; // Sorry, too complex - just fall back.
|
||||||
return args.toString();
|
return args.toString();
|
||||||
}
|
}
|
||||||
@@ -189,7 +184,7 @@ QString ProcessParameters::summary(const QString &displayName) const
|
|||||||
|
|
||||||
return QString::fromLatin1("<b>%1:</b> %2 %3")
|
return QString::fromLatin1("<b>%1:</b> %2 %3")
|
||||||
.arg(displayName,
|
.arg(displayName,
|
||||||
Utils::QtcProcess::quoteArg(prettyCommand()),
|
QtcProcess::quoteArg(prettyCommand()),
|
||||||
prettyArguments());
|
prettyArguments());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,7 +195,7 @@ QString ProcessParameters::summaryInWorkdir(const QString &displayName) const
|
|||||||
|
|
||||||
return QString::fromLatin1("<b>%1:</b> %2 %3 in %4")
|
return QString::fromLatin1("<b>%1:</b> %2 %3 in %4")
|
||||||
.arg(displayName,
|
.arg(displayName,
|
||||||
Utils::QtcProcess::quoteArg(prettyCommand()),
|
QtcProcess::quoteArg(prettyCommand()),
|
||||||
prettyArguments(),
|
prettyArguments(),
|
||||||
QDir::toNativeSeparators(effectiveWorkingDirectory().toString()));
|
QDir::toNativeSeparators(effectiveWorkingDirectory().toString()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,12 +73,12 @@ private:
|
|||||||
Utils::FilePath m_workingDirectory;
|
Utils::FilePath m_workingDirectory;
|
||||||
Utils::CommandLine m_command;
|
Utils::CommandLine m_command;
|
||||||
Utils::Environment m_environment;
|
Utils::Environment m_environment;
|
||||||
Utils::MacroExpander *m_macroExpander;
|
Utils::MacroExpander *m_macroExpander = nullptr;
|
||||||
|
|
||||||
mutable Utils::FilePath m_effectiveWorkingDirectory;
|
mutable Utils::FilePath m_effectiveWorkingDirectory;
|
||||||
mutable Utils::FilePath m_effectiveCommand;
|
mutable Utils::FilePath m_effectiveCommand;
|
||||||
mutable QString m_effectiveArguments;
|
mutable QString m_effectiveArguments;
|
||||||
mutable bool m_commandMissing;
|
mutable bool m_commandMissing = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
|||||||
Reference in New Issue
Block a user