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 <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2021-11-09 14:29:44 +01:00
parent 9a859de175
commit 9739ded573
5 changed files with 15 additions and 8 deletions

View File

@@ -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"}};

View File

@@ -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); }

View File

@@ -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();

View File

@@ -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);

View File

@@ -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);