forked from qt-creator/qt-creator
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:
@@ -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
|
||||
|
@@ -49,6 +49,7 @@ class IRunConfigurationAspect;
|
||||
class RunConfiguration;
|
||||
class RunConfigWidget;
|
||||
class RunControl;
|
||||
class ToolRunner;
|
||||
class Target;
|
||||
|
||||
namespace Internal {
|
||||
@@ -397,6 +398,9 @@ public:
|
||||
const Connection &connection() const;
|
||||
void setConnection(const Connection &connection);
|
||||
|
||||
ToolRunner *toolRunner() const;
|
||||
void setToolRunner(ToolRunner *tool);
|
||||
|
||||
virtual void appendMessage(const QString &msg, Utils::OutputFormat format);
|
||||
virtual void bringApplicationToForeground();
|
||||
|
||||
@@ -444,4 +448,19 @@ private:
|
||||
Internal::SimpleRunControlPrivate * const d;
|
||||
};
|
||||
|
||||
/**
|
||||
* A base for tool-specific additions to target-specific RunControl.
|
||||
*/
|
||||
|
||||
class PROJECTEXPLORER_EXPORT ToolRunner : public QObject
|
||||
{
|
||||
public:
|
||||
explicit ToolRunner(RunControl *runControl);
|
||||
|
||||
RunControl *runControl() const;
|
||||
|
||||
private:
|
||||
QPointer<RunControl> m_runControl;
|
||||
};
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
Reference in New Issue
Block a user