forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -41,7 +41,6 @@ namespace Internal {
|
|||||||
AndroidRunControl::AndroidRunControl(AndroidRunConfiguration *rc)
|
AndroidRunControl::AndroidRunControl(AndroidRunConfiguration *rc)
|
||||||
: RunControl(rc, ProjectExplorer::Constants::NORMAL_RUN_MODE)
|
: RunControl(rc, ProjectExplorer::Constants::NORMAL_RUN_MODE)
|
||||||
, m_runner(new AndroidRunner(this, rc, ProjectExplorer::Constants::NORMAL_RUN_MODE))
|
, m_runner(new AndroidRunner(this, rc, ProjectExplorer::Constants::NORMAL_RUN_MODE))
|
||||||
, m_running(false)
|
|
||||||
{
|
{
|
||||||
setRunnable(m_runner->runnable());
|
setRunnable(m_runner->runnable());
|
||||||
setIcon(Utils::Icons::RUN_SMALL_TOOLBAR);
|
setIcon(Utils::Icons::RUN_SMALL_TOOLBAR);
|
||||||
@@ -54,8 +53,7 @@ AndroidRunControl::~AndroidRunControl()
|
|||||||
|
|
||||||
void AndroidRunControl::start()
|
void AndroidRunControl::start()
|
||||||
{
|
{
|
||||||
m_running = true;
|
reportApplicationStart();
|
||||||
emit started();
|
|
||||||
disconnect(m_runner, 0, this, 0);
|
disconnect(m_runner, 0, this, 0);
|
||||||
|
|
||||||
connect(m_runner, &AndroidRunner::remoteErrorOutput,
|
connect(m_runner, &AndroidRunner::remoteErrorOutput,
|
||||||
@@ -79,8 +77,7 @@ void AndroidRunControl::handleRemoteProcessFinished(const QString &error)
|
|||||||
{
|
{
|
||||||
appendMessage(error, Utils::ErrorMessageFormat);
|
appendMessage(error, Utils::ErrorMessageFormat);
|
||||||
disconnect(m_runner, 0, this, 0);
|
disconnect(m_runner, 0, this, 0);
|
||||||
m_running = false;
|
reportApplicationStop();
|
||||||
emit finished();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidRunControl::handleRemoteOutput(const QString &output)
|
void AndroidRunControl::handleRemoteOutput(const QString &output)
|
||||||
@@ -93,11 +90,6 @@ void AndroidRunControl::handleRemoteErrorOutput(const QString &output)
|
|||||||
appendMessage(output, Utils::StdErrFormatSameLine);
|
appendMessage(output, Utils::StdErrFormatSameLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AndroidRunControl::isRunning() const
|
|
||||||
{
|
|
||||||
return m_running;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString AndroidRunControl::displayName() const
|
QString AndroidRunControl::displayName() const
|
||||||
{
|
{
|
||||||
return m_runner->displayName();
|
return m_runner->displayName();
|
||||||
|
@@ -43,7 +43,6 @@ public:
|
|||||||
|
|
||||||
void start() override;
|
void start() override;
|
||||||
StopResult stop() override;
|
StopResult stop() override;
|
||||||
bool isRunning() const override;
|
|
||||||
QString displayName() const override;
|
QString displayName() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -52,7 +51,6 @@ private:
|
|||||||
void handleRemoteErrorOutput(const QString &output);
|
void handleRemoteErrorOutput(const QString &output);
|
||||||
|
|
||||||
AndroidRunner *const m_runner;
|
AndroidRunner *const m_runner;
|
||||||
bool m_running;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -469,7 +469,7 @@ void ClangStaticAnalyzerRunControl::start()
|
|||||||
m_success = false;
|
m_success = false;
|
||||||
emit starting();
|
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();
|
const Utils::FileName projectFile = m_projectInfo.project()->projectFilePath();
|
||||||
appendMessage(tr("Running Clang Static Analyzer on %1").arg(projectFile.toUserOutput())
|
appendMessage(tr("Running Clang Static Analyzer on %1").arg(projectFile.toUserOutput())
|
||||||
+ QLatin1Char('\n'), Utils::NormalMessageFormat);
|
+ QLatin1Char('\n'), Utils::NormalMessageFormat);
|
||||||
@@ -485,7 +485,7 @@ void ClangStaticAnalyzerRunControl::start()
|
|||||||
appendMessage(errorMessage + QLatin1Char('\n'), Utils::ErrorMessageFormat);
|
appendMessage(errorMessage + QLatin1Char('\n'), Utils::ErrorMessageFormat);
|
||||||
TaskHub::addTask(Task::Error, errorMessage, Debugger::Constants::ANALYZERTASK_ID);
|
TaskHub::addTask(Task::Error, errorMessage, Debugger::Constants::ANALYZERTASK_ID);
|
||||||
TaskHub::requestPopup();
|
TaskHub::requestPopup();
|
||||||
emit finished();
|
reportApplicationStop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,7 +522,7 @@ void ClangStaticAnalyzerRunControl::start()
|
|||||||
appendMessage(errorMessage + QLatin1Char('\n'), Utils::ErrorMessageFormat);
|
appendMessage(errorMessage + QLatin1Char('\n'), Utils::ErrorMessageFormat);
|
||||||
TaskHub::addTask(Task::Error, errorMessage, Debugger::Constants::ANALYZERTASK_ID);
|
TaskHub::addTask(Task::Error, errorMessage, Debugger::Constants::ANALYZERTASK_ID);
|
||||||
TaskHub::requestPopup();
|
TaskHub::requestPopup();
|
||||||
emit finished();
|
reportApplicationStop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_clangLogFileDir = temporaryDir.path();
|
m_clangLogFileDir = temporaryDir.path();
|
||||||
@@ -550,16 +550,15 @@ void ClangStaticAnalyzerRunControl::start()
|
|||||||
qCDebug(LOG) << "Environment:" << m_environment;
|
qCDebug(LOG) << "Environment:" << m_environment;
|
||||||
m_runners.clear();
|
m_runners.clear();
|
||||||
const int parallelRuns = ClangStaticAnalyzerSettings::instance()->simultaneousProcesses();
|
const int parallelRuns = ClangStaticAnalyzerSettings::instance()->simultaneousProcesses();
|
||||||
QTC_ASSERT(parallelRuns >= 1, emit finished(); return);
|
QTC_ASSERT(parallelRuns >= 1, reportApplicationStop(); return);
|
||||||
m_success = true;
|
m_success = true;
|
||||||
m_running = true;
|
|
||||||
|
|
||||||
if (m_unitsToProcess.isEmpty()) {
|
if (m_unitsToProcess.isEmpty()) {
|
||||||
finalize();
|
finalize();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
emit started();
|
reportApplicationStart();
|
||||||
|
|
||||||
while (m_runners.size() < parallelRuns && !m_unitsToProcess.isEmpty())
|
while (m_runners.size() < parallelRuns && !m_unitsToProcess.isEmpty())
|
||||||
analyzeNextFile();
|
analyzeNextFile();
|
||||||
@@ -578,16 +577,10 @@ RunControl::StopResult ClangStaticAnalyzerRunControl::stop()
|
|||||||
appendMessage(tr("Clang Static Analyzer stopped by user.") + QLatin1Char('\n'),
|
appendMessage(tr("Clang Static Analyzer stopped by user.") + QLatin1Char('\n'),
|
||||||
Utils::NormalMessageFormat);
|
Utils::NormalMessageFormat);
|
||||||
m_progress.reportFinished();
|
m_progress.reportFinished();
|
||||||
m_running = false;
|
reportApplicationStop();
|
||||||
emit finished();
|
|
||||||
return RunControl::StoppedSynchronously;
|
return RunControl::StoppedSynchronously;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClangStaticAnalyzerRunControl::isRunning() const
|
|
||||||
{
|
|
||||||
return m_running;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangStaticAnalyzerRunControl::analyzeNextFile()
|
void ClangStaticAnalyzerRunControl::analyzeNextFile()
|
||||||
{
|
{
|
||||||
if (m_progress.isFinished())
|
if (m_progress.isFinished())
|
||||||
@@ -701,8 +694,7 @@ void ClangStaticAnalyzerRunControl::finalize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_progress.reportFinished();
|
m_progress.reportFinished();
|
||||||
m_running = false;
|
reportApplicationStop();
|
||||||
emit finished();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -58,7 +58,6 @@ public:
|
|||||||
|
|
||||||
void start() override;
|
void start() override;
|
||||||
StopResult stop() override;
|
StopResult stop() override;
|
||||||
bool isRunning() const override;
|
|
||||||
|
|
||||||
bool success() const { return m_success; } // For testing.
|
bool success() const { return m_success; } // For testing.
|
||||||
bool supportsReRunning() const override { return false; }
|
bool supportsReRunning() const override { return false; }
|
||||||
@@ -95,7 +94,6 @@ private:
|
|||||||
int m_filesAnalyzed;
|
int m_filesAnalyzed;
|
||||||
int m_filesNotAnalyzed;
|
int m_filesNotAnalyzed;
|
||||||
bool m_success;
|
bool m_success;
|
||||||
bool m_running = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -112,8 +112,7 @@ DebuggerRunControl *createHelper(RunConfiguration *runConfig, Internal::Debugger
|
|||||||
|
|
||||||
DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfig, DebuggerEngine *engine)
|
DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfig, DebuggerEngine *engine)
|
||||||
: RunControl(runConfig, DebugRunMode),
|
: RunControl(runConfig, DebugRunMode),
|
||||||
m_engine(engine),
|
m_engine(engine)
|
||||||
m_running(false)
|
|
||||||
{
|
{
|
||||||
setIcon(ProjectExplorer::Icons::DEBUG_START_SMALL_TOOLBAR);
|
setIcon(ProjectExplorer::Icons::DEBUG_START_SMALL_TOOLBAR);
|
||||||
connect(this, &RunControl::finished, this, &DebuggerRunControl::handleFinished);
|
connect(this, &RunControl::finished, this, &DebuggerRunControl::handleFinished);
|
||||||
@@ -192,8 +191,8 @@ void DebuggerRunControl::start()
|
|||||||
&& m_engine->runParameters().inferior.executable.isEmpty()
|
&& m_engine->runParameters().inferior.executable.isEmpty()
|
||||||
&& m_engine->runParameters().interpreter.isEmpty()) {
|
&& m_engine->runParameters().interpreter.isEmpty()) {
|
||||||
appendMessage(tr("No executable specified.") + QLatin1Char('\n'), ErrorMessageFormat);
|
appendMessage(tr("No executable specified.") + QLatin1Char('\n'), ErrorMessageFormat);
|
||||||
emit started();
|
reportApplicationStart();
|
||||||
emit finished();
|
reportApplicationStop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,20 +225,18 @@ void DebuggerRunControl::start()
|
|||||||
|
|
||||||
// We might get a synchronous startFailed() notification on Windows,
|
// We might get a synchronous startFailed() notification on Windows,
|
||||||
// when launching the process fails. Emit a proper finished() sequence.
|
// when launching the process fails. Emit a proper finished() sequence.
|
||||||
emit started();
|
reportApplicationStart();
|
||||||
m_running = true;
|
|
||||||
|
|
||||||
m_engine->startDebugger(this);
|
m_engine->startDebugger(this);
|
||||||
|
|
||||||
if (m_running)
|
if (isRunning())
|
||||||
appendMessage(tr("Debugging starts") + QLatin1Char('\n'), NormalMessageFormat);
|
appendMessage(tr("Debugging starts") + QLatin1Char('\n'), NormalMessageFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunControl::startFailed()
|
void DebuggerRunControl::startFailed()
|
||||||
{
|
{
|
||||||
appendMessage(tr("Debugging has failed") + QLatin1Char('\n'), NormalMessageFormat);
|
appendMessage(tr("Debugging has failed") + QLatin1Char('\n'), NormalMessageFormat);
|
||||||
m_running = false;
|
reportApplicationStop();
|
||||||
emit finished();
|
|
||||||
m_engine->handleStartFailed();
|
m_engine->handleStartFailed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,8 +285,7 @@ RunControl::StopResult DebuggerRunControl::stop()
|
|||||||
|
|
||||||
void DebuggerRunControl::debuggingFinished()
|
void DebuggerRunControl::debuggingFinished()
|
||||||
{
|
{
|
||||||
m_running = false;
|
reportApplicationStop();
|
||||||
emit finished();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerRunControl::showMessage(const QString &msg, int channel)
|
void DebuggerRunControl::showMessage(const QString &msg, int channel)
|
||||||
@@ -297,11 +293,6 @@ void DebuggerRunControl::showMessage(const QString &msg, int channel)
|
|||||||
m_engine->showMessage(msg, channel);
|
m_engine->showMessage(msg, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DebuggerRunControl::isRunning() const
|
|
||||||
{
|
|
||||||
return m_running;
|
|
||||||
}
|
|
||||||
|
|
||||||
DebuggerStartParameters &DebuggerRunControl::startParameters()
|
DebuggerStartParameters &DebuggerRunControl::startParameters()
|
||||||
{
|
{
|
||||||
return m_engine->runParameters();
|
return m_engine->runParameters();
|
||||||
|
@@ -69,7 +69,6 @@ public:
|
|||||||
void start() override;
|
void start() override;
|
||||||
bool promptToStop(bool *prompt = 0) const override;
|
bool promptToStop(bool *prompt = 0) const override;
|
||||||
StopResult stop() override; // Called from SnapshotWindow.
|
StopResult stop() override; // Called from SnapshotWindow.
|
||||||
bool isRunning() const override;
|
|
||||||
QString displayName() const override;
|
QString displayName() const override;
|
||||||
bool supportsReRunning() const override;
|
bool supportsReRunning() const override;
|
||||||
void handleApplicationOutput(const QString &msg, int channel);
|
void handleApplicationOutput(const QString &msg, int channel);
|
||||||
@@ -104,7 +103,6 @@ private:
|
|||||||
Internal::DebuggerEngine *engine);
|
Internal::DebuggerEngine *engine);
|
||||||
|
|
||||||
Internal::DebuggerEngine *m_engine;
|
Internal::DebuggerEngine *m_engine;
|
||||||
bool m_running;
|
|
||||||
OutputProcessor *m_outputProcessor = 0;
|
OutputProcessor *m_outputProcessor = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -40,7 +40,6 @@ namespace Internal {
|
|||||||
IosRunControl::IosRunControl(IosRunConfiguration *rc)
|
IosRunControl::IosRunControl(IosRunConfiguration *rc)
|
||||||
: RunControl(rc, ProjectExplorer::Constants::NORMAL_RUN_MODE)
|
: RunControl(rc, ProjectExplorer::Constants::NORMAL_RUN_MODE)
|
||||||
, m_runner(new IosRunner(this, rc, false, QmlDebug::NoQmlDebugServices))
|
, m_runner(new IosRunner(this, rc, false, QmlDebug::NoQmlDebugServices))
|
||||||
, m_running(false)
|
|
||||||
{
|
{
|
||||||
setIcon(Utils::Icons::RUN_SMALL_TOOLBAR);
|
setIcon(Utils::Icons::RUN_SMALL_TOOLBAR);
|
||||||
}
|
}
|
||||||
@@ -52,8 +51,7 @@ IosRunControl::~IosRunControl()
|
|||||||
|
|
||||||
void IosRunControl::start()
|
void IosRunControl::start()
|
||||||
{
|
{
|
||||||
m_running = true;
|
reportApplicationStart();
|
||||||
emit started();
|
|
||||||
disconnect(m_runner, 0, this, 0);
|
disconnect(m_runner, 0, this, 0);
|
||||||
|
|
||||||
connect(m_runner, &IosRunner::errorMsg,
|
connect(m_runner, &IosRunner::errorMsg,
|
||||||
@@ -79,8 +77,7 @@ void IosRunControl::handleRemoteProcessFinished(bool cleanEnd)
|
|||||||
else
|
else
|
||||||
appendMessage(tr("Run ended."), Utils::NormalMessageFormat);
|
appendMessage(tr("Run ended."), Utils::NormalMessageFormat);
|
||||||
disconnect(m_runner, 0, this, 0);
|
disconnect(m_runner, 0, this, 0);
|
||||||
m_running = false;
|
reportApplicationStop();
|
||||||
emit finished();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IosRunControl::handleRemoteOutput(const QString &output)
|
void IosRunControl::handleRemoteOutput(const QString &output)
|
||||||
@@ -93,11 +90,6 @@ void IosRunControl::handleRemoteErrorOutput(const QString &output)
|
|||||||
appendMessage(output, Utils::StdErrFormat);
|
appendMessage(output, Utils::StdErrFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IosRunControl::isRunning() const
|
|
||||||
{
|
|
||||||
return m_running;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString IosRunControl::displayName() const
|
QString IosRunControl::displayName() const
|
||||||
{
|
{
|
||||||
return m_runner->displayName();
|
return m_runner->displayName();
|
||||||
|
@@ -44,7 +44,6 @@ public:
|
|||||||
|
|
||||||
void start() override;
|
void start() override;
|
||||||
StopResult stop() override;
|
StopResult stop() override;
|
||||||
bool isRunning() const override;
|
|
||||||
QString displayName() const override;
|
QString displayName() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -53,7 +52,6 @@ private:
|
|||||||
void handleRemoteErrorOutput(const QString &output);
|
void handleRemoteErrorOutput(const QString &output);
|
||||||
|
|
||||||
IosRunner *const m_runner;
|
IosRunner *const m_runner;
|
||||||
bool m_running;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -39,7 +39,6 @@ namespace Nim {
|
|||||||
|
|
||||||
NimRunControl::NimRunControl(NimRunConfiguration *rc, Core::Id mode)
|
NimRunControl::NimRunControl(NimRunConfiguration *rc, Core::Id mode)
|
||||||
: RunControl(rc, mode)
|
: RunControl(rc, mode)
|
||||||
, m_running(false)
|
|
||||||
, m_runnable(rc->runnable().as<StandardRunnable>())
|
, m_runnable(rc->runnable().as<StandardRunnable>())
|
||||||
{
|
{
|
||||||
connect(&m_applicationLauncher, &ApplicationLauncher::appendMessage,
|
connect(&m_applicationLauncher, &ApplicationLauncher::appendMessage,
|
||||||
@@ -54,8 +53,7 @@ NimRunControl::NimRunControl(NimRunConfiguration *rc, Core::Id mode)
|
|||||||
|
|
||||||
void NimRunControl::start()
|
void NimRunControl::start()
|
||||||
{
|
{
|
||||||
emit started();
|
reportApplicationStart();
|
||||||
m_running = true;
|
|
||||||
m_applicationLauncher.start(m_runnable);
|
m_applicationLauncher.start(m_runnable);
|
||||||
setApplicationProcessHandle(ProcessHandle(m_applicationLauncher.applicationPID()));
|
setApplicationProcessHandle(ProcessHandle(m_applicationLauncher.applicationPID()));
|
||||||
}
|
}
|
||||||
@@ -66,11 +64,6 @@ ProjectExplorer::RunControl::StopResult NimRunControl::stop()
|
|||||||
return StoppedSynchronously;
|
return StoppedSynchronously;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NimRunControl::isRunning() const
|
|
||||||
{
|
|
||||||
return m_running;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NimRunControl::processStarted()
|
void NimRunControl::processStarted()
|
||||||
{
|
{
|
||||||
// Console processes only know their pid after being started
|
// Console processes only know their pid after being started
|
||||||
@@ -79,7 +72,6 @@ void NimRunControl::processStarted()
|
|||||||
|
|
||||||
void NimRunControl::processExited(int exitCode, QProcess::ExitStatus status)
|
void NimRunControl::processExited(int exitCode, QProcess::ExitStatus status)
|
||||||
{
|
{
|
||||||
m_running = false;
|
|
||||||
setApplicationProcessHandle(ProcessHandle());
|
setApplicationProcessHandle(ProcessHandle());
|
||||||
QString msg;
|
QString msg;
|
||||||
if (status == QProcess::CrashExit) {
|
if (status == QProcess::CrashExit) {
|
||||||
@@ -90,7 +82,7 @@ void NimRunControl::processExited(int exitCode, QProcess::ExitStatus status)
|
|||||||
.arg(QDir::toNativeSeparators(m_runnable.executable)).arg(exitCode);
|
.arg(QDir::toNativeSeparators(m_runnable.executable)).arg(exitCode);
|
||||||
}
|
}
|
||||||
appendMessage(msg + QLatin1Char('\n'), NormalMessageFormat);
|
appendMessage(msg + QLatin1Char('\n'), NormalMessageFormat);
|
||||||
emit finished();
|
reportApplicationStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NimRunControl::slotAppendMessage(const QString &err, OutputFormat format)
|
void NimRunControl::slotAppendMessage(const QString &err, OutputFormat format)
|
||||||
|
@@ -43,7 +43,6 @@ public:
|
|||||||
|
|
||||||
void start() override;
|
void start() override;
|
||||||
StopResult stop() override;
|
StopResult stop() override;
|
||||||
bool isRunning() const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void processStarted();
|
void processStarted();
|
||||||
@@ -51,7 +50,6 @@ private:
|
|||||||
void slotAppendMessage(const QString &err, Utils::OutputFormat isError);
|
void slotAppendMessage(const QString &err, Utils::OutputFormat isError);
|
||||||
|
|
||||||
ProjectExplorer::ApplicationLauncher m_applicationLauncher;
|
ProjectExplorer::ApplicationLauncher m_applicationLauncher;
|
||||||
bool m_running;
|
|
||||||
ProjectExplorer::StandardRunnable m_runnable;
|
ProjectExplorer::StandardRunnable m_runnable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -50,14 +50,12 @@ public:
|
|||||||
|
|
||||||
void start() override;
|
void start() override;
|
||||||
StopResult stop() override;
|
StopResult stop() override;
|
||||||
bool isRunning() const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void processStarted();
|
void processStarted();
|
||||||
void processExited(int exitCode, QProcess::ExitStatus status);
|
void processExited(int exitCode, QProcess::ExitStatus status);
|
||||||
|
|
||||||
ApplicationLauncher m_applicationLauncher;
|
ApplicationLauncher m_applicationLauncher;
|
||||||
bool m_running = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
LocalApplicationRunControl::LocalApplicationRunControl(RunConfiguration *rc, Core::Id mode)
|
LocalApplicationRunControl::LocalApplicationRunControl(RunConfiguration *rc, Core::Id mode)
|
||||||
@@ -79,17 +77,16 @@ void LocalApplicationRunControl::start()
|
|||||||
{
|
{
|
||||||
QTC_ASSERT(runnable().is<StandardRunnable>(), return);
|
QTC_ASSERT(runnable().is<StandardRunnable>(), return);
|
||||||
auto r = runnable().as<StandardRunnable>();
|
auto r = runnable().as<StandardRunnable>();
|
||||||
emit started();
|
reportApplicationStart();
|
||||||
if (r.executable.isEmpty()) {
|
if (r.executable.isEmpty()) {
|
||||||
appendMessage(tr("No executable specified.") + QLatin1Char('\n'), Utils::ErrorMessageFormat);
|
appendMessage(tr("No executable specified.") + QLatin1Char('\n'), Utils::ErrorMessageFormat);
|
||||||
emit finished();
|
reportApplicationStop();
|
||||||
} else if (!QFileInfo::exists(r.executable)) {
|
} else if (!QFileInfo::exists(r.executable)) {
|
||||||
appendMessage(tr("Executable %1 does not exist.")
|
appendMessage(tr("Executable %1 does not exist.")
|
||||||
.arg(QDir::toNativeSeparators(r.executable)) + QLatin1Char('\n'),
|
.arg(QDir::toNativeSeparators(r.executable)) + QLatin1Char('\n'),
|
||||||
Utils::ErrorMessageFormat);
|
Utils::ErrorMessageFormat);
|
||||||
emit finished();
|
reportApplicationStop();
|
||||||
} else {
|
} else {
|
||||||
m_running = true;
|
|
||||||
QString msg = tr("Starting %1...").arg(QDir::toNativeSeparators(r.executable)) + QLatin1Char('\n');
|
QString msg = tr("Starting %1...").arg(QDir::toNativeSeparators(r.executable)) + QLatin1Char('\n');
|
||||||
appendMessage(msg, Utils::NormalMessageFormat);
|
appendMessage(msg, Utils::NormalMessageFormat);
|
||||||
m_applicationLauncher.start(r);
|
m_applicationLauncher.start(r);
|
||||||
@@ -103,11 +100,6 @@ LocalApplicationRunControl::StopResult LocalApplicationRunControl::stop()
|
|||||||
return StoppedSynchronously;
|
return StoppedSynchronously;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LocalApplicationRunControl::isRunning() const
|
|
||||||
{
|
|
||||||
return m_running;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LocalApplicationRunControl::processStarted()
|
void LocalApplicationRunControl::processStarted()
|
||||||
{
|
{
|
||||||
// Console processes only know their pid after being started
|
// Console processes only know their pid after being started
|
||||||
@@ -116,8 +108,6 @@ void LocalApplicationRunControl::processStarted()
|
|||||||
|
|
||||||
void LocalApplicationRunControl::processExited(int exitCode, QProcess::ExitStatus status)
|
void LocalApplicationRunControl::processExited(int exitCode, QProcess::ExitStatus status)
|
||||||
{
|
{
|
||||||
m_running = false;
|
|
||||||
setApplicationProcessHandle(ProcessHandle());
|
|
||||||
QString msg;
|
QString msg;
|
||||||
QString exe = runnable().as<StandardRunnable>().executable;
|
QString exe = runnable().as<StandardRunnable>().executable;
|
||||||
if (status == QProcess::CrashExit)
|
if (status == QProcess::CrashExit)
|
||||||
@@ -125,7 +115,7 @@ void LocalApplicationRunControl::processExited(int exitCode, QProcess::ExitStatu
|
|||||||
else
|
else
|
||||||
msg = tr("%1 exited with code %2").arg(QDir::toNativeSeparators(exe)).arg(exitCode);
|
msg = tr("%1 exited with code %2").arg(QDir::toNativeSeparators(exe)).arg(exitCode);
|
||||||
appendMessage(msg + QLatin1Char('\n'), Utils::NormalMessageFormat);
|
appendMessage(msg + QLatin1Char('\n'), Utils::NormalMessageFormat);
|
||||||
emit finished();
|
reportApplicationStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// LocalApplicationRunControlFactory
|
// LocalApplicationRunControlFactory
|
||||||
|
@@ -37,6 +37,7 @@
|
|||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/outputformatter.h>
|
#include <utils/outputformatter.h>
|
||||||
#include <utils/checkablemessagebox.h>
|
#include <utils/checkablemessagebox.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
@@ -534,10 +535,12 @@ public:
|
|||||||
// A handle to the actual application process.
|
// A handle to the actual application process.
|
||||||
Utils::ProcessHandle applicationProcessHandle;
|
Utils::ProcessHandle applicationProcessHandle;
|
||||||
|
|
||||||
|
bool isRunning = false;
|
||||||
|
|
||||||
#ifdef Q_OS_OSX
|
#ifdef Q_OS_OSX
|
||||||
//these two are used to bring apps in the foreground on Mac
|
//these two are used to bring apps in the foreground on Mac
|
||||||
qint64 internalPid;
|
|
||||||
int foregroundCount;
|
int foregroundCount;
|
||||||
|
qint64 internalPid;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -662,7 +665,7 @@ void RunControl::setApplicationProcessHandle(const ProcessHandle &handle)
|
|||||||
{
|
{
|
||||||
if (d->applicationProcessHandle != handle) {
|
if (d->applicationProcessHandle != handle) {
|
||||||
d->applicationProcessHandle = handle;
|
d->applicationProcessHandle = handle;
|
||||||
emit applicationProcessHandleChanged();
|
emit applicationProcessHandleChanged(QPrivateSignal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -685,6 +688,11 @@ bool RunControl::promptToStop(bool *optionalPrompt) const
|
|||||||
optionalPrompt);
|
optionalPrompt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RunControl::isRunning() const
|
||||||
|
{
|
||||||
|
return d->isRunning;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Prompts to terminate the application with the \gui {Do not ask again}
|
Prompts to terminate the application with the \gui {Do not ask again}
|
||||||
checkbox.
|
checkbox.
|
||||||
@@ -732,6 +740,20 @@ void RunControl::bringApplicationToForeground(qint64 pid)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RunControl::reportApplicationStart()
|
||||||
|
{
|
||||||
|
d->isRunning = true;
|
||||||
|
emit started(QPrivateSignal());
|
||||||
|
}
|
||||||
|
|
||||||
|
void RunControl::reportApplicationStop()
|
||||||
|
{
|
||||||
|
d->isRunning = false;
|
||||||
|
QTC_CHECK(d->applicationProcessHandle.isValid());
|
||||||
|
setApplicationProcessHandle(Utils::ProcessHandle());
|
||||||
|
emit finished(QPrivateSignal());
|
||||||
|
}
|
||||||
|
|
||||||
void RunControl::bringApplicationToForegroundInternal()
|
void RunControl::bringApplicationToForegroundInternal()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_OSX
|
#ifdef Q_OS_OSX
|
||||||
|
@@ -361,12 +361,14 @@ public:
|
|||||||
|
|
||||||
virtual bool promptToStop(bool *optionalPrompt = nullptr) const;
|
virtual bool promptToStop(bool *optionalPrompt = nullptr) const;
|
||||||
virtual StopResult stop() = 0;
|
virtual StopResult stop() = 0;
|
||||||
virtual bool isRunning() const = 0;
|
|
||||||
virtual bool supportsReRunning() const { return true; }
|
virtual bool supportsReRunning() const { return true; }
|
||||||
|
|
||||||
|
|
||||||
virtual QString displayName() const;
|
virtual QString displayName() const;
|
||||||
void setDisplayName(const QString &displayName);
|
void setDisplayName(const QString &displayName);
|
||||||
|
|
||||||
|
bool isRunning() const;
|
||||||
|
|
||||||
void setIcon(const Utils::Icon &icon);
|
void setIcon(const Utils::Icon &icon);
|
||||||
Utils::Icon icon() const;
|
Utils::Icon icon() const;
|
||||||
|
|
||||||
@@ -396,11 +398,14 @@ public slots:
|
|||||||
signals:
|
signals:
|
||||||
void appendMessageRequested(ProjectExplorer::RunControl *runControl,
|
void appendMessageRequested(ProjectExplorer::RunControl *runControl,
|
||||||
const QString &msg, Utils::OutputFormat format);
|
const QString &msg, Utils::OutputFormat format);
|
||||||
void started();
|
void started(QPrivateSignal); // Use reportApplicationStart!
|
||||||
void finished();
|
void finished(QPrivateSignal); // Use reportApplicationStop!
|
||||||
void applicationProcessHandleChanged();
|
void applicationProcessHandleChanged(QPrivateSignal); // Use setApplicationProcessHandle
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void reportApplicationStart(); // Call this when the application starts to run
|
||||||
|
void reportApplicationStop(); // Call this when the application has stopped for any reason
|
||||||
|
|
||||||
bool showPromptToStopDialog(const QString &title, const QString &text,
|
bool showPromptToStopDialog(const QString &title, const QString &text,
|
||||||
const QString &stopButtonText = QString(),
|
const QString &stopButtonText = QString(),
|
||||||
const QString &cancelButtonText = QString(),
|
const QString &cancelButtonText = QString(),
|
||||||
|
@@ -225,7 +225,6 @@ public:
|
|||||||
|
|
||||||
void start() override;
|
void start() override;
|
||||||
StopResult stop() override;
|
StopResult stop() override;
|
||||||
bool isRunning() const override { return m_running; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void processStarted();
|
void processStarted();
|
||||||
@@ -238,7 +237,6 @@ private:
|
|||||||
QString m_commandLineArguments;
|
QString m_commandLineArguments;
|
||||||
Utils::Environment m_environment;
|
Utils::Environment m_environment;
|
||||||
ApplicationLauncher::Mode m_runMode;
|
ApplicationLauncher::Mode m_runMode;
|
||||||
bool m_running;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
@@ -756,7 +754,7 @@ RunControl *PythonRunControlFactory::create(RunConfiguration *runConfiguration,
|
|||||||
// PythonRunControl
|
// PythonRunControl
|
||||||
|
|
||||||
PythonRunControl::PythonRunControl(PythonRunConfiguration *rc, Core::Id mode)
|
PythonRunControl::PythonRunControl(PythonRunConfiguration *rc, Core::Id mode)
|
||||||
: RunControl(rc, mode), m_running(false)
|
: RunControl(rc, mode)
|
||||||
{
|
{
|
||||||
setIcon(Utils::Icons::RUN_SMALL_TOOLBAR);
|
setIcon(Utils::Icons::RUN_SMALL_TOOLBAR);
|
||||||
|
|
||||||
@@ -778,16 +776,15 @@ PythonRunControl::PythonRunControl(PythonRunConfiguration *rc, Core::Id mode)
|
|||||||
|
|
||||||
void PythonRunControl::start()
|
void PythonRunControl::start()
|
||||||
{
|
{
|
||||||
emit started();
|
reportApplicationStart();
|
||||||
if (m_interpreter.isEmpty()) {
|
if (m_interpreter.isEmpty()) {
|
||||||
appendMessage(tr("No Python interpreter specified.") + '\n', Utils::ErrorMessageFormat);
|
appendMessage(tr("No Python interpreter specified.") + '\n', Utils::ErrorMessageFormat);
|
||||||
emit finished();
|
reportApplicationStop();
|
||||||
} else if (!QFileInfo::exists(m_interpreter)) {
|
} else if (!QFileInfo::exists(m_interpreter)) {
|
||||||
appendMessage(tr("Python interpreter %1 does not exist.").arg(QDir::toNativeSeparators(m_interpreter)) + '\n',
|
appendMessage(tr("Python interpreter %1 does not exist.").arg(QDir::toNativeSeparators(m_interpreter)) + '\n',
|
||||||
Utils::ErrorMessageFormat);
|
Utils::ErrorMessageFormat);
|
||||||
emit finished();
|
reportApplicationStop();
|
||||||
} else {
|
} else {
|
||||||
m_running = true;
|
|
||||||
QString msg = tr("Starting %1...").arg(QDir::toNativeSeparators(m_interpreter)) + '\n';
|
QString msg = tr("Starting %1...").arg(QDir::toNativeSeparators(m_interpreter)) + '\n';
|
||||||
appendMessage(msg, Utils::NormalMessageFormat);
|
appendMessage(msg, Utils::NormalMessageFormat);
|
||||||
|
|
||||||
@@ -822,8 +819,6 @@ void PythonRunControl::processStarted()
|
|||||||
|
|
||||||
void PythonRunControl::processExited(int exitCode, QProcess::ExitStatus status)
|
void PythonRunControl::processExited(int exitCode, QProcess::ExitStatus status)
|
||||||
{
|
{
|
||||||
m_running = false;
|
|
||||||
setApplicationProcessHandle(ProcessHandle());
|
|
||||||
QString msg;
|
QString msg;
|
||||||
if (status == QProcess::CrashExit) {
|
if (status == QProcess::CrashExit) {
|
||||||
msg = tr("%1 crashed")
|
msg = tr("%1 crashed")
|
||||||
@@ -833,7 +828,7 @@ void PythonRunControl::processExited(int exitCode, QProcess::ExitStatus status)
|
|||||||
.arg(QDir::toNativeSeparators(m_interpreter)).arg(exitCode);
|
.arg(QDir::toNativeSeparators(m_interpreter)).arg(exitCode);
|
||||||
}
|
}
|
||||||
appendMessage(msg + '\n', Utils::NormalMessageFormat);
|
appendMessage(msg + '\n', Utils::NormalMessageFormat);
|
||||||
emit finished();
|
reportApplicationStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonRunConfigurationWidget::setInterpreter(const QString &interpreter)
|
void PythonRunConfigurationWidget::setInterpreter(const QString &interpreter)
|
||||||
|
@@ -70,7 +70,6 @@ public:
|
|||||||
Internal::QmlProfilerTool *m_tool = 0;
|
Internal::QmlProfilerTool *m_tool = 0;
|
||||||
QmlProfilerStateManager *m_profilerState = 0;
|
QmlProfilerStateManager *m_profilerState = 0;
|
||||||
QTimer m_noDebugOutputTimer;
|
QTimer m_noDebugOutputTimer;
|
||||||
bool m_running = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -96,17 +95,18 @@ QmlProfilerRunControl::QmlProfilerRunControl(RunConfiguration *runConfiguration,
|
|||||||
|
|
||||||
QmlProfilerRunControl::~QmlProfilerRunControl()
|
QmlProfilerRunControl::~QmlProfilerRunControl()
|
||||||
{
|
{
|
||||||
if (d->m_running && d->m_profilerState)
|
if (isRunning() && d->m_profilerState)
|
||||||
stop();
|
stop();
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerRunControl::start()
|
void QmlProfilerRunControl::start()
|
||||||
{
|
{
|
||||||
|
reportApplicationStart();
|
||||||
d->m_tool->finalizeRunControl(this);
|
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>();
|
auto conn = connection().as<AnalyzerConnection>();
|
||||||
|
|
||||||
if (conn.analyzerPort.isValid())
|
if (conn.analyzerPort.isValid())
|
||||||
@@ -115,13 +115,11 @@ void QmlProfilerRunControl::start()
|
|||||||
d->m_noDebugOutputTimer.start();
|
d->m_noDebugOutputTimer.start();
|
||||||
|
|
||||||
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppRunning);
|
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppRunning);
|
||||||
d->m_running = true;
|
|
||||||
emit starting();
|
emit starting();
|
||||||
}
|
}
|
||||||
|
|
||||||
RunControl::StopResult QmlProfilerRunControl::stop()
|
RunControl::StopResult QmlProfilerRunControl::stop()
|
||||||
{
|
{
|
||||||
d->m_running = false;
|
|
||||||
QTC_ASSERT(d->m_profilerState, return RunControl::StoppedSynchronously);
|
QTC_ASSERT(d->m_profilerState, return RunControl::StoppedSynchronously);
|
||||||
|
|
||||||
switch (d->m_profilerState->currentState()) {
|
switch (d->m_profilerState->currentState()) {
|
||||||
@@ -147,11 +145,6 @@ RunControl::StopResult QmlProfilerRunControl::stop()
|
|||||||
return RunControl::StoppedSynchronously;
|
return RunControl::StoppedSynchronously;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlProfilerRunControl::isRunning() const
|
|
||||||
{
|
|
||||||
return d->m_running;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlProfilerRunControl::notifyRemoteFinished()
|
void QmlProfilerRunControl::notifyRemoteFinished()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(d->m_profilerState, return);
|
QTC_ASSERT(d->m_profilerState, return);
|
||||||
@@ -159,8 +152,7 @@ void QmlProfilerRunControl::notifyRemoteFinished()
|
|||||||
switch (d->m_profilerState->currentState()) {
|
switch (d->m_profilerState->currentState()) {
|
||||||
case QmlProfilerStateManager::AppRunning:
|
case QmlProfilerStateManager::AppRunning:
|
||||||
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying);
|
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying);
|
||||||
d->m_running = false;
|
reportApplicationStop();
|
||||||
emit finished();
|
|
||||||
break;
|
break;
|
||||||
case QmlProfilerStateManager::Idle:
|
case QmlProfilerStateManager::Idle:
|
||||||
break;
|
break;
|
||||||
@@ -189,8 +181,7 @@ void QmlProfilerRunControl::cancelProcess()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d->m_running = false;
|
reportApplicationStop();
|
||||||
emit finished();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerRunControl::notifyRemoteSetupFailed(const QString &errorMessage)
|
void QmlProfilerRunControl::notifyRemoteSetupFailed(const QString &errorMessage)
|
||||||
@@ -213,8 +204,7 @@ void QmlProfilerRunControl::notifyRemoteSetupFailed(const QString &errorMessage)
|
|||||||
// KILL
|
// KILL
|
||||||
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying);
|
d->m_profilerState->setCurrentState(QmlProfilerStateManager::AppDying);
|
||||||
d->m_noDebugOutputTimer.stop();
|
d->m_noDebugOutputTimer.stop();
|
||||||
d->m_running = false;
|
reportApplicationStop();
|
||||||
emit finished();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlProfilerRunControl::wrongSetupMessageBoxFinished(int button)
|
void QmlProfilerRunControl::wrongSetupMessageBoxFinished(int button)
|
||||||
@@ -256,8 +246,7 @@ void QmlProfilerRunControl::profilerStateChanged()
|
|||||||
{
|
{
|
||||||
switch (d->m_profilerState->currentState()) {
|
switch (d->m_profilerState->currentState()) {
|
||||||
case QmlProfilerStateManager::Idle:
|
case QmlProfilerStateManager::Idle:
|
||||||
d->m_running = false;
|
reportApplicationStop();
|
||||||
emit finished();
|
|
||||||
d->m_noDebugOutputTimer.stop();
|
d->m_noDebugOutputTimer.stop();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@@ -49,7 +49,6 @@ public:
|
|||||||
void notifyRemoteSetupFailed(const QString &errorMessage) override;
|
void notifyRemoteSetupFailed(const QString &errorMessage) override;
|
||||||
void start() override;
|
void start() override;
|
||||||
StopResult stop() override;
|
StopResult stop() override;
|
||||||
bool isRunning() const override;
|
|
||||||
void cancelProcess();
|
void cancelProcess();
|
||||||
void notifyRemoteFinished() override;
|
void notifyRemoteFinished() override;
|
||||||
bool supportsReRunning() const override { return false; }
|
bool supportsReRunning() const override { return false; }
|
||||||
|
@@ -36,7 +36,6 @@ namespace RemoteLinux {
|
|||||||
class RemoteLinuxRunControl::RemoteLinuxRunControlPrivate
|
class RemoteLinuxRunControl::RemoteLinuxRunControlPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool running;
|
|
||||||
DeviceApplicationRunner runner;
|
DeviceApplicationRunner runner;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -45,8 +44,6 @@ RemoteLinuxRunControl::RemoteLinuxRunControl(RunConfiguration *rc)
|
|||||||
{
|
{
|
||||||
setIcon(Utils::Icons::RUN_SMALL_TOOLBAR);
|
setIcon(Utils::Icons::RUN_SMALL_TOOLBAR);
|
||||||
setRunnable(rc->runnable());
|
setRunnable(rc->runnable());
|
||||||
|
|
||||||
d->running = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteLinuxRunControl::~RemoteLinuxRunControl()
|
RemoteLinuxRunControl::~RemoteLinuxRunControl()
|
||||||
@@ -56,8 +53,7 @@ RemoteLinuxRunControl::~RemoteLinuxRunControl()
|
|||||||
|
|
||||||
void RemoteLinuxRunControl::start()
|
void RemoteLinuxRunControl::start()
|
||||||
{
|
{
|
||||||
d->running = true;
|
reportApplicationStart();
|
||||||
emit started();
|
|
||||||
d->runner.disconnect(this);
|
d->runner.disconnect(this);
|
||||||
connect(&d->runner, &DeviceApplicationRunner::reportError,
|
connect(&d->runner, &DeviceApplicationRunner::reportError,
|
||||||
this, &RemoteLinuxRunControl::handleErrorMessage);
|
this, &RemoteLinuxRunControl::handleErrorMessage);
|
||||||
@@ -103,16 +99,10 @@ void RemoteLinuxRunControl::handleProgressReport(const QString &progressString)
|
|||||||
appendMessage(progressString + QLatin1Char('\n'), Utils::NormalMessageFormat);
|
appendMessage(progressString + QLatin1Char('\n'), Utils::NormalMessageFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemoteLinuxRunControl::isRunning() const
|
|
||||||
{
|
|
||||||
return d->running;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RemoteLinuxRunControl::setFinished()
|
void RemoteLinuxRunControl::setFinished()
|
||||||
{
|
{
|
||||||
d->runner.disconnect(this);
|
d->runner.disconnect(this);
|
||||||
d->running = false;
|
reportApplicationStop();
|
||||||
emit finished();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace RemoteLinux
|
} // namespace RemoteLinux
|
||||||
|
@@ -40,7 +40,6 @@ public:
|
|||||||
|
|
||||||
virtual void start() override;
|
virtual void start() override;
|
||||||
virtual StopResult stop() override;
|
virtual StopResult stop() override;
|
||||||
virtual bool isRunning() const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleErrorMessage(const QString &error);
|
void handleErrorMessage(const QString &error);
|
||||||
|
@@ -70,6 +70,7 @@ ValgrindRunControl::ValgrindRunControl(RunConfiguration *runConfiguration, Core:
|
|||||||
|
|
||||||
void ValgrindRunControl::start()
|
void ValgrindRunControl::start()
|
||||||
{
|
{
|
||||||
|
reportApplicationStart();
|
||||||
emit starting();
|
emit starting();
|
||||||
FutureProgress *fp = ProgressManager::addTimedTask(m_progress, progressTitle(), "valgrind", 100);
|
FutureProgress *fp = ProgressManager::addTimedTask(m_progress, progressTitle(), "valgrind", 100);
|
||||||
fp->setKeepOnFinish(FutureProgress::HideOnFinish);
|
fp->setKeepOnFinish(FutureProgress::HideOnFinish);
|
||||||
@@ -101,12 +102,9 @@ void ValgrindRunControl::start()
|
|||||||
|
|
||||||
if (!run->start()) {
|
if (!run->start()) {
|
||||||
m_progress.cancel();
|
m_progress.cancel();
|
||||||
emit finished();
|
reportApplicationStop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_isRunning = true;
|
|
||||||
emit started();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RunControl::StopResult ValgrindRunControl::stop()
|
RunControl::StopResult ValgrindRunControl::stop()
|
||||||
@@ -116,11 +114,6 @@ RunControl::StopResult ValgrindRunControl::stop()
|
|||||||
return AsynchronousStop;
|
return AsynchronousStop;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ValgrindRunControl::isRunning() const
|
|
||||||
{
|
|
||||||
return m_isRunning;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ValgrindRunControl::executable() const
|
QString ValgrindRunControl::executable() const
|
||||||
{
|
{
|
||||||
return runnable().as<StandardRunnable>().executable;
|
return runnable().as<StandardRunnable>().executable;
|
||||||
@@ -161,10 +154,8 @@ void ValgrindRunControl::handleProgressFinished()
|
|||||||
|
|
||||||
void ValgrindRunControl::runnerFinished()
|
void ValgrindRunControl::runnerFinished()
|
||||||
{
|
{
|
||||||
m_isRunning = false;
|
|
||||||
|
|
||||||
appendMessage(tr("Analyzing finished.") + QLatin1Char('\n'), NormalMessageFormat);
|
appendMessage(tr("Analyzing finished.") + QLatin1Char('\n'), NormalMessageFormat);
|
||||||
emit finished();
|
reportApplicationStop();
|
||||||
|
|
||||||
m_progress.reportFinished();
|
m_progress.reportFinished();
|
||||||
|
|
||||||
|
@@ -47,7 +47,6 @@ public:
|
|||||||
|
|
||||||
void start() override;
|
void start() override;
|
||||||
StopResult stop() override;
|
StopResult stop() override;
|
||||||
bool isRunning() const override;
|
|
||||||
bool supportsReRunning() const override { return false; }
|
bool supportsReRunning() const override { return false; }
|
||||||
|
|
||||||
QString executable() const;
|
QString executable() const;
|
||||||
@@ -71,7 +70,6 @@ private:
|
|||||||
QStringList genericToolArguments() const;
|
QStringList genericToolArguments() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_isRunning = false;
|
|
||||||
bool m_isStopping = false;
|
bool m_isStopping = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -63,6 +63,8 @@ void WinRtRunControl::start()
|
|||||||
return;
|
return;
|
||||||
if (!startWinRtRunner())
|
if (!startWinRtRunner())
|
||||||
m_state = StoppedState;
|
m_state = StoppedState;
|
||||||
|
else
|
||||||
|
reportApplicationStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
RunControl::StopResult WinRtRunControl::stop()
|
RunControl::StopResult WinRtRunControl::stop()
|
||||||
@@ -74,16 +76,10 @@ RunControl::StopResult WinRtRunControl::stop()
|
|||||||
return AsynchronousStop;
|
return AsynchronousStop;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WinRtRunControl::isRunning() const
|
|
||||||
{
|
|
||||||
return m_state == StartedState;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WinRtRunControl::onProcessStarted()
|
void WinRtRunControl::onProcessStarted()
|
||||||
{
|
{
|
||||||
QTC_CHECK(m_state == StartingState);
|
QTC_CHECK(m_state == StartingState);
|
||||||
m_state = StartedState;
|
m_state = StartedState;
|
||||||
emit started();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinRtRunControl::onProcessFinished()
|
void WinRtRunControl::onProcessFinished()
|
||||||
@@ -99,7 +95,7 @@ void WinRtRunControl::onProcessError()
|
|||||||
m_runner->deleteLater();
|
m_runner->deleteLater();
|
||||||
m_runner = 0;
|
m_runner = 0;
|
||||||
m_state = StoppedState;
|
m_state = StoppedState;
|
||||||
emit finished();
|
reportApplicationStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WinRtRunControl::startWinRtRunner()
|
bool WinRtRunControl::startWinRtRunner()
|
||||||
|
@@ -52,7 +52,6 @@ public:
|
|||||||
|
|
||||||
void start() override;
|
void start() override;
|
||||||
StopResult stop() override;
|
StopResult stop() override;
|
||||||
bool isRunning() const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum State { StartingState, StartedState, StoppedState };
|
enum State { StartingState, StartedState, StoppedState };
|
||||||
|
Reference in New Issue
Block a user