ProjectExplorer: Add a RunControl::supportsReRunning setter

Removes one reason to derive from base RunControls (specifically
ValgrindRunControl).

Change-Id: I81e32a49ef30e79ee7e7b53a54021eaaba43453a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
hjk
2017-04-07 11:09:12 +02:00
parent 1779578930
commit cd3c5104bf
8 changed files with 17 additions and 4 deletions

View File

@@ -79,6 +79,7 @@ ClangStaticAnalyzerRunControl::ClangStaticAnalyzerRunControl(
{
setDisplayName(tr("Clang Static Analyzer"));
setIcon(ProjectExplorer::Icons::ANALYZER_START_SMALL_TOOLBAR);
setSupportsReRunning(false);
Target *target = runConfiguration->target();
BuildConfiguration *buildConfiguration = target->activeBuildConfiguration();

View File

@@ -60,7 +60,6 @@ public:
void stop() override;
bool success() const { return m_success; } // For testing.
bool supportsReRunning() const override { return false; }
signals:
void newDiagnosticsAvailable(const QList<Diagnostic> &diagnostics);

View File

@@ -589,6 +589,7 @@ public:
Utils::ProcessHandle applicationProcessHandle;
State state = State::Initialized;
bool supportsReRunning = true;
#ifdef Q_OS_OSX
// This is used to bring apps in the foreground on Mac
@@ -892,6 +893,16 @@ bool RunControl::promptToStop(bool *optionalPrompt) const
optionalPrompt);
}
bool RunControl::supportsReRunning() const
{
return d->supportsReRunning;
}
void RunControl::setSupportsReRunning(bool reRunningSupported)
{
d->supportsReRunning = reRunningSupported;
}
bool RunControl::isRunning() const
{
return d->state == RunControlPrivate::State::Running;

View File

@@ -371,7 +371,9 @@ public:
void initiateStop(); // Calls stop() asynchronously.
virtual bool promptToStop(bool *optionalPrompt = nullptr) const;
virtual bool supportsReRunning() const { return true; }
virtual bool supportsReRunning() const;
void setSupportsReRunning(bool reRunningSupported);
virtual QString displayName() const;
void setDisplayName(const QString &displayName);

View File

@@ -82,6 +82,7 @@ QmlProfilerRunControl::QmlProfilerRunControl(RunConfiguration *runConfiguration,
, d(new QmlProfilerRunControlPrivate)
{
setIcon(ProjectExplorer::Icons::ANALYZER_START_SMALL_TOOLBAR);
setSupportsReRunning(false);
d->m_tool = tool;
// Only wait 4 seconds for the 'Waiting for connection' on application output, then just try to connect

View File

@@ -51,7 +51,6 @@ public:
void stop() override;
void cancelProcess();
void notifyRemoteFinished() override;
bool supportsReRunning() const override { return false; }
signals:
void processRunning(Utils::Port port);

View File

@@ -57,6 +57,7 @@ ValgrindRunControl::ValgrindRunControl(RunConfiguration *runConfiguration, Core:
: RunControl(runConfiguration, runMode)
{
setIcon(ProjectExplorer::Icons::ANALYZER_START_SMALL_TOOLBAR);
setSupportsReRunning(false);
if (runConfiguration)
if (IRunConfigurationAspect *aspect = runConfiguration->extraAspect(ANALYZER_VALGRIND_SETTINGS))

View File

@@ -47,7 +47,6 @@ public:
void start() override;
void stop() override;
bool supportsReRunning() const override { return false; }
QString executable() const;