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/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | |
parent | 329db5f4cc1fced14aeccbd2f8f580ec8c2d26a3 (diff) | |
download | qt-creator-e07c6383d7e6bc7f44e0820fa1a33a9470397a60.tar.gz |
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/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp')
-rw-r--r-- | src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp index 544832013a..019b0632b5 100644 --- a/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp +++ b/src/plugins/clangstaticanalyzer/clangstaticanalyzerruncontrol.cpp @@ -469,7 +469,7 @@ void ClangStaticAnalyzerRunControl::start() m_success = false; emit starting(); - QTC_ASSERT(m_projectInfo.isValid(), emit finished(); return); + QTC_ASSERT(m_projectInfo.isValid(), reportApplicationStop(); return); const Utils::FileName projectFile = m_projectInfo.project()->projectFilePath(); appendMessage(tr("Running Clang Static Analyzer on %1").arg(projectFile.toUserOutput()) + QLatin1Char('\n'), Utils::NormalMessageFormat); @@ -485,7 +485,7 @@ void ClangStaticAnalyzerRunControl::start() appendMessage(errorMessage + QLatin1Char('\n'), Utils::ErrorMessageFormat); TaskHub::addTask(Task::Error, errorMessage, Debugger::Constants::ANALYZERTASK_ID); TaskHub::requestPopup(); - emit finished(); + reportApplicationStop(); return; } @@ -522,7 +522,7 @@ void ClangStaticAnalyzerRunControl::start() appendMessage(errorMessage + QLatin1Char('\n'), Utils::ErrorMessageFormat); TaskHub::addTask(Task::Error, errorMessage, Debugger::Constants::ANALYZERTASK_ID); TaskHub::requestPopup(); - emit finished(); + reportApplicationStop(); return; } m_clangLogFileDir = temporaryDir.path(); @@ -550,16 +550,15 @@ void ClangStaticAnalyzerRunControl::start() qCDebug(LOG) << "Environment:" << m_environment; m_runners.clear(); const int parallelRuns = ClangStaticAnalyzerSettings::instance()->simultaneousProcesses(); - QTC_ASSERT(parallelRuns >= 1, emit finished(); return); + QTC_ASSERT(parallelRuns >= 1, reportApplicationStop(); return); m_success = true; - m_running = true; if (m_unitsToProcess.isEmpty()) { finalize(); return; } - emit started(); + reportApplicationStart(); while (m_runners.size() < parallelRuns && !m_unitsToProcess.isEmpty()) analyzeNextFile(); @@ -578,16 +577,10 @@ RunControl::StopResult ClangStaticAnalyzerRunControl::stop() appendMessage(tr("Clang Static Analyzer stopped by user.") + QLatin1Char('\n'), Utils::NormalMessageFormat); m_progress.reportFinished(); - m_running = false; - emit finished(); + reportApplicationStop(); return RunControl::StoppedSynchronously; } -bool ClangStaticAnalyzerRunControl::isRunning() const -{ - return m_running; -} - void ClangStaticAnalyzerRunControl::analyzeNextFile() { if (m_progress.isFinished()) @@ -701,8 +694,7 @@ void ClangStaticAnalyzerRunControl::finalize() } m_progress.reportFinished(); - m_running = false; - emit finished(); + reportApplicationStop(); } } // namespace Internal |