From 9739ded5731770893f8649c504e3f5b163f6b874 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Tue, 9 Nov 2021 14:29:44 +0100 Subject: [PATCH] Uniform ApplicationLauncher API: get rid of reportProgress() Use existing appendMessage() for this purpose with NormalMessageFormat. In case when device process is used in ApplicationLauncher no appendMessage() was emitted so far. Change-Id: I96041ad19fe16066ea31d92f52253e0aa864f96d Reviewed-by: hjk --- src/plugins/boot2qt/qdbstopapplicationservice.cpp | 9 +++++++-- src/plugins/boot2qt/qdbstopapplicationservice.h | 1 + src/plugins/projectexplorer/applicationlauncher.cpp | 6 ++++-- src/plugins/projectexplorer/applicationlauncher.h | 1 - src/plugins/projectexplorer/runcontrol.cpp | 6 +++--- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/plugins/boot2qt/qdbstopapplicationservice.cpp b/src/plugins/boot2qt/qdbstopapplicationservice.cpp index 8aa78aab7fd..f1043462868 100644 --- a/src/plugins/boot2qt/qdbstopapplicationservice.cpp +++ b/src/plugins/boot2qt/qdbstopapplicationservice.cpp @@ -88,6 +88,11 @@ void QdbStopApplicationService::handleStdout(const QString &output) emit stdOutData(output); } +void QdbStopApplicationService::handleAppendMessage(const QString &message) +{ + emit stdOutData(message); +} + void QdbStopApplicationService::doDeploy() { connect(&d->applicationLauncher, &ProjectExplorer::ApplicationLauncher::reportError, @@ -98,8 +103,8 @@ void QdbStopApplicationService::doDeploy() this, &QdbStopApplicationService::handleStdout); connect(&d->applicationLauncher, &ProjectExplorer::ApplicationLauncher::finished, this, &QdbStopApplicationService::handleProcessFinished); - connect(&d->applicationLauncher, &ProjectExplorer::ApplicationLauncher::reportProgress, - this, &QdbStopApplicationService::stdOutData); + connect(&d->applicationLauncher, &ProjectExplorer::ApplicationLauncher::appendMessage, + this, &QdbStopApplicationService::handleAppendMessage); ProjectExplorer::Runnable runnable; runnable.command = {Constants::AppcontrollerFilepath, {"--stop"}}; diff --git a/src/plugins/boot2qt/qdbstopapplicationservice.h b/src/plugins/boot2qt/qdbstopapplicationservice.h index 9e925ade4eb..a29205ab6c0 100644 --- a/src/plugins/boot2qt/qdbstopapplicationservice.h +++ b/src/plugins/boot2qt/qdbstopapplicationservice.h @@ -43,6 +43,7 @@ private: void handleProcessFinished(bool success); void handleStderr(const QString &output); void handleStdout(const QString &output); + void handleAppendMessage(const QString &message); bool isDeploymentNecessary() const final { return true; } void doDeviceSetup() final { handleDeviceSetupDone(true); } diff --git a/src/plugins/projectexplorer/applicationlauncher.cpp b/src/plugins/projectexplorer/applicationlauncher.cpp index 5fec002d8bb..bff194563a0 100644 --- a/src/plugins/projectexplorer/applicationlauncher.cpp +++ b/src/plugins/projectexplorer/applicationlauncher.cpp @@ -212,7 +212,8 @@ void ApplicationLauncherPrivate::stop() return; m_stopRequested = true; m_success = false; - emit q->reportProgress(ApplicationLauncher::tr("User requested stop. Shutting down...")); + emit q->appendMessage(ApplicationLauncher::tr("User requested stop. Shutting down..."), + Utils::NormalMessageFormat); switch (m_state) { case Run: m_deviceProcess->terminate(); @@ -480,7 +481,8 @@ void ApplicationLauncherPrivate::handleApplicationFinished() if (exitCode != 0) { doReportError(ApplicationLauncher::tr("Application finished with exit code %1.").arg(exitCode)); } else { - emit q->reportProgress(ApplicationLauncher::tr("Application finished with exit code 0.")); + emit q->appendMessage(ApplicationLauncher::tr("Application finished with exit code 0."), + Utils::NormalMessageFormat); } } setFinished(); diff --git a/src/plugins/projectexplorer/applicationlauncher.h b/src/plugins/projectexplorer/applicationlauncher.h index ca93c69abd8..3cba409f9cf 100644 --- a/src/plugins/projectexplorer/applicationlauncher.h +++ b/src/plugins/projectexplorer/applicationlauncher.h @@ -76,7 +76,6 @@ signals: void remoteStdout(const QString &output); void remoteStderr(const QString &output); - void reportProgress(const QString &progressOutput); void reportError(const QString &errorOutput); void remoteProcessStarted(); void finished(bool success); diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp index e30aeb70647..02a8ce542d2 100644 --- a/src/plugins/projectexplorer/runcontrol.cpp +++ b/src/plugins/projectexplorer/runcontrol.cpp @@ -1290,9 +1290,9 @@ void SimpleTargetRunner::doStart(const Runnable &runnable, const IDevice::ConstP reportStarted(); }); - connect(&m_launcher, &ApplicationLauncher::reportProgress, - this, [this](const QString &progressString) { - appendMessage(progressString, Utils::NormalMessageFormat); + connect(&m_launcher, &ApplicationLauncher::appendMessage, + this, [this](const QString &progressString, Utils::OutputFormat format) { + appendMessage(progressString, format); }); m_launcher.start(runnable, device);