diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2017-02-27 17:25:58 +0100 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2017-03-01 12:46:59 +0000 |
commit | e07c6383d7e6bc7f44e0820fa1a33a9470397a60 (patch) | |
tree | 1c3da78e0f6872e1d4de5874d60fae83672b208e /src/plugins/qmlprofiler | |
parent | 329db5f4cc1fced14aeccbd2f8f580ec8c2d26a3 (diff) |
ProjectExplorer: Unify RunControl setup/teardown
Provide protected methods in RunControl to handle the notification
of when the RunControl starts and stops. Use these helpers to
move the isRunning() method into the RunConfiguration itself instead
of reimplementing it everywhere.
Change-Id: Ia8de42f7a6a14a049870d4e7fcb9af6756c2caa4
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler')
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp | 27 | ||||
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilerruncontrol.h | 1 |
2 files changed, 8 insertions, 20 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp index 224e5652cf..f0a64d2a5a 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp @@ -70,7 +70,6 @@ public: Internal::QmlProfilerTool *m_tool = 0; QmlProfilerStateManager *m_profilerState = 0; QTimer m_noDebugOutputTimer; - bool m_running = false; }; // @@ -96,17 +95,18 @@ QmlProfilerRunControl::QmlProfilerRunControl(RunConfiguration *runConfiguration, QmlProfilerRunControl::~QmlProfilerRunControl() { - if (d->m_running && d->m_profilerState) + if (isRunning() && d->m_profilerState) stop(); delete d; } void QmlProfilerRunControl::start() { + reportApplicationStart(); d->m_tool->finalizeRunControl(this); - QTC_ASSERT(d->m_profilerState, finished(); return); + QTC_ASSERT(d->m_profilerState, reportApplicationStop(); return); - QTC_ASSERT(connection().is<AnalyzerConnection>(), finished(); return); + QTC_ASSERT(connection().is<AnalyzerConnection>(), reportApplicationStop(); return); auto conn = connection().as<AnalyzerConnection>(); if (conn.analyzerPort.isValid()) @@ -115,13 +115,11 @@ void QmlProfilerRunControl::start() d->m_noDebugOutputTimer.start(); d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppRunning); - d->m_running = true; emit starting(); } RunControl::StopResult QmlProfilerRunControl::stop() { - d->m_running = false; QTC_ASSERT(d->m_profilerState, return RunControl::StoppedSynchronously); switch (d->m_profilerState->currentState()) { @@ -147,11 +145,6 @@ RunControl::StopResult QmlProfilerRunControl::stop() return RunControl::StoppedSynchronously; } -bool QmlProfilerRunControl::isRunning() const -{ - return d->m_running; -} - void QmlProfilerRunControl::notifyRemoteFinished() { QTC_ASSERT(d->m_profilerState, return); @@ -159,8 +152,7 @@ void QmlProfilerRunControl::notifyRemoteFinished() switch (d->m_profilerState->currentState()) { case QmlProfilerStateManager::AppRunning: d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying); - d->m_running = false; - emit finished(); + reportApplicationStop(); break; case QmlProfilerStateManager::Idle: break; @@ -189,8 +181,7 @@ void QmlProfilerRunControl::cancelProcess() return; } } - d->m_running = false; - emit finished(); + reportApplicationStop(); } void QmlProfilerRunControl::notifyRemoteSetupFailed(const QString &errorMessage) @@ -213,8 +204,7 @@ void QmlProfilerRunControl::notifyRemoteSetupFailed(const QString &errorMessage) // KILL d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying); d->m_noDebugOutputTimer.stop(); - d->m_running = false; - emit finished(); + reportApplicationStop(); } void QmlProfilerRunControl::wrongSetupMessageBoxFinished(int button) @@ -256,8 +246,7 @@ void QmlProfilerRunControl::profilerStateChanged() { switch (d->m_profilerState->currentState()) { case QmlProfilerStateManager::Idle: - d->m_running = false; - emit finished(); + reportApplicationStop(); d->m_noDebugOutputTimer.stop(); break; default: diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h index 49716c05a4..5c7c770755 100644 --- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h +++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h @@ -49,7 +49,6 @@ public: void notifyRemoteSetupFailed(const QString &errorMessage) override; void start() override; StopResult stop() override; - bool isRunning() const override; void cancelProcess(); void notifyRemoteFinished() override; bool supportsReRunning() const override { return false; } |