ProjectExplorer: Create a ToolRunSupport base class

This is meant to be a base for tool-specific additions to the
target-specific RunControls providing a common base and convenience
interface for the various *{Debug,Analyze,*}Support classes.

Code in the current support classes in intended to be split
in bits suitable to be handled by the target run controls
and in target-independent bits in the pure tool implementation,
making the ToolRunSupport derived instances as slim as possible.



Change-Id: I2bc3f4ad246f6ea81b19458ee5a4392609e4fd2d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
hjk
2017-03-24 17:06:13 +01:00
parent 9250c19007
commit eb0b0f9443
2 changed files with 46 additions and 2 deletions

View File

@@ -519,6 +519,7 @@ public:
~RunControlPrivate()
{
delete toolRunner;
delete outputFormatter;
}
@@ -528,8 +529,9 @@ public:
Connection connection;
Core::Id runMode;
Utils::Icon icon;
const QPointer<RunConfiguration> runConfiguration;
QPointer<Project> project;
const QPointer<RunConfiguration> runConfiguration; // Not owned.
QPointer<Project> project; // Not owned.
QPointer<ToolRunner> toolRunner; // Owned. QPointer as "extra safety" for now.
Utils::OutputFormatter *outputFormatter = nullptr;
// A handle to the actual application process.
@@ -617,6 +619,16 @@ void RunControl::setConnection(const Connection &connection)
d->connection = connection;
}
ToolRunner *RunControl::toolRunner() const
{
return d->toolRunner;
}
void RunControl::setToolRunner(ToolRunner *tool)
{
d->toolRunner = tool;
}
QString RunControl::displayName() const
{
return d->displayName;
@@ -964,4 +976,17 @@ void SimpleRunControl::onProcessFinished(int exitCode, QProcess::ExitStatus stat
reportApplicationStop();
}
// ToolRunner
ToolRunner::ToolRunner(RunControl *runControl)
: m_runControl(runControl)
{
runControl->setToolRunner(this);
}
RunControl *ToolRunner::runControl() const
{
return m_runControl;
}
} // namespace ProjectExplorer