ApplicationLauncher: Unify API

Make the API more similar to QtcProcess API.
Rename:
  processStarted() -> started()
  error() -> errorOccurred()
  processError() -> error()

Change-Id: I86d650d55a643f5999fc91e56b985f699e2d7245
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-03-01 13:35:15 +01:00
parent 14d39b871d
commit ff0ce27c1f
9 changed files with 18 additions and 18 deletions

View File

@@ -82,7 +82,7 @@ public:
{ {
connect(&m_appRunner, &ApplicationLauncher::appendMessage, this, connect(&m_appRunner, &ApplicationLauncher::appendMessage, this,
&DeviceApplicationObserver::handleAppendMessage); &DeviceApplicationObserver::handleAppendMessage);
connect(&m_appRunner, &ApplicationLauncher::error, this, connect(&m_appRunner, &ApplicationLauncher::errorOccurred, this,
[this] { m_error = m_appRunner.errorString(); }); [this] { m_error = m_appRunner.errorString(); });
connect(&m_appRunner, &ApplicationLauncher::finished, this, connect(&m_appRunner, &ApplicationLauncher::finished, this,
&DeviceApplicationObserver::handleFinished); &DeviceApplicationObserver::handleFinished);

View File

@@ -55,7 +55,7 @@ public:
{ {
setId("QdbDebuggeeRunner"); setId("QdbDebuggeeRunner");
connect(&m_launcher, &ApplicationLauncher::processStarted, connect(&m_launcher, &ApplicationLauncher::started,
this, &RunWorker::reportStarted); this, &RunWorker::reportStarted);
connect(&m_launcher, &ApplicationLauncher::finished, connect(&m_launcher, &ApplicationLauncher::finished,
this, &RunWorker::reportStopped); this, &RunWorker::reportStopped);

View File

@@ -88,7 +88,7 @@ void QdbStopApplicationService::handleAppendMessage(const QString &message, Util
void QdbStopApplicationService::doDeploy() void QdbStopApplicationService::doDeploy()
{ {
connect(&d->applicationLauncher, &ProjectExplorer::ApplicationLauncher::error, connect(&d->applicationLauncher, &ProjectExplorer::ApplicationLauncher::errorOccurred,
this, [this] { emit stdErrData(d->applicationLauncher.errorString()); }); this, [this] { emit stdErrData(d->applicationLauncher.errorString()); });
connect(&d->applicationLauncher, &ProjectExplorer::ApplicationLauncher::finished, connect(&d->applicationLauncher, &ProjectExplorer::ApplicationLauncher::finished,
this, &QdbStopApplicationService::handleProcessFinished); this, &QdbStopApplicationService::handleProcessFinished);

View File

@@ -273,7 +273,7 @@ QmlEngine::QmlEngine()
this, &QmlEngine::disconnected); this, &QmlEngine::disconnected);
connect(&d->applicationLauncher, &ApplicationLauncher::appendMessage, connect(&d->applicationLauncher, &ApplicationLauncher::appendMessage,
this, &QmlEngine::appMessage); this, &QmlEngine::appMessage);
connect(&d->applicationLauncher, &ApplicationLauncher::processStarted, connect(&d->applicationLauncher, &ApplicationLauncher::started,
this, &QmlEngine::handleLauncherStarted); this, &QmlEngine::handleLauncherStarted);
debuggerConsole()->populateFileFinder(); debuggerConsole()->populateFileFinder();

View File

@@ -237,7 +237,7 @@ QString ApplicationLauncher::errorString() const
return d->m_remoteErrorString; return d->m_remoteErrorString;
} }
QProcess::ProcessError ApplicationLauncher::processError() const QProcess::ProcessError ApplicationLauncher::error() const
{ {
if (d->m_isLocal) if (d->m_isLocal)
return d->m_process ? d->m_process->error() : QProcess::UnknownError; return d->m_process ? d->m_process->error() : QProcess::UnknownError;
@@ -274,7 +274,7 @@ void ApplicationLauncherPrivate::localProcessError(QProcess::ProcessError error)
emit q->finished(); emit q->finished();
} }
} }
emit q->error(error); emit q->errorOccurred(error);
} }
void ApplicationLauncherPrivate::handleStandardOutput() void ApplicationLauncherPrivate::handleStandardOutput()
@@ -416,7 +416,7 @@ void ApplicationLauncherPrivate::start()
// The local bit affects only WinDebugInterface. // The local bit affects only WinDebugInterface.
if (m_isLocal) if (m_isLocal)
m_listeningPid = applicationPID(); m_listeningPid = applicationPID();
emit q->processStarted(); emit q->started();
}); });
m_process->setProcessChannelMode(m_processChannelMode); m_process->setProcessChannelMode(m_processChannelMode);
@@ -467,7 +467,7 @@ void ApplicationLauncherPrivate::doReportError(const QString &message, QProcess:
m_remoteErrorString = message; m_remoteErrorString = message;
m_remoteError = error; m_remoteError = error;
m_exitStatus = QProcess::CrashExit; m_exitStatus = QProcess::CrashExit;
emit q->error(error); emit q->errorOccurred(error);
} }
} // namespace ProjectExplorer } // namespace ProjectExplorer

View File

@@ -64,7 +64,7 @@ public:
bool isLocal() const; bool isLocal() const;
QString errorString() const; QString errorString() const;
QProcess::ProcessError processError() const; QProcess::ProcessError error() const;
static QString msgWinCannotRetrieveDebuggingOutput(); static QString msgWinCannotRetrieveDebuggingOutput();
@@ -73,9 +73,9 @@ public:
signals: signals:
void appendMessage(const QString &message, Utils::OutputFormat format, bool appendNewLine = true); void appendMessage(const QString &message, Utils::OutputFormat format, bool appendNewLine = true);
void processStarted(); void started();
void finished(); void finished();
void error(QProcess::ProcessError error); void errorOccurred(QProcess::ProcessError error);
private: private:
std::unique_ptr<Internal::ApplicationLauncherPrivate> d; std::unique_ptr<Internal::ApplicationLauncherPrivate> d;

View File

@@ -1219,7 +1219,7 @@ void SimpleTargetRunner::doStart(const Runnable &runnable)
reportStopped(); reportStopped();
}); });
connect(&m_launcher, &ApplicationLauncher::error, connect(&m_launcher, &ApplicationLauncher::errorOccurred,
this, [this, runnable](QProcess::ProcessError error) { this, [this, runnable](QProcess::ProcessError error) {
if (m_stopReported) if (m_stopReported)
return; return;
@@ -1237,7 +1237,7 @@ void SimpleTargetRunner::doStart(const Runnable &runnable)
const bool isDesktop = runnable.device.isNull() const bool isDesktop = runnable.device.isNull()
|| runnable.device.dynamicCast<const DesktopDevice>(); || runnable.device.dynamicCast<const DesktopDevice>();
if (isDesktop) { if (isDesktop) {
connect(&m_launcher, &ApplicationLauncher::processStarted, this, [this] { connect(&m_launcher, &ApplicationLauncher::started, this, [this] {
// Console processes only know their pid after being started // Console processes only know their pid after being started
ProcessHandle pid = m_launcher.applicationPID(); ProcessHandle pid = m_launcher.applicationPID();
runControl()->setApplicationProcessHandle(pid); runControl()->setApplicationProcessHandle(pid);
@@ -1250,7 +1250,7 @@ void SimpleTargetRunner::doStart(const Runnable &runnable)
return; return;
} }
} else { } else {
connect(&m_launcher, &ApplicationLauncher::processStarted, this, &RunWorker::reportStarted); connect(&m_launcher, &ApplicationLauncher::started, this, &RunWorker::reportStarted);
} }
m_launcher.setRunnable(runnable); m_launcher.setRunnable(runnable);
m_launcher.start(); m_launcher.start();

View File

@@ -119,7 +119,7 @@ void CallgrindController::run(Option option)
#endif #endif
connect(m_controllerProcess, &ApplicationLauncher::finished, connect(m_controllerProcess, &ApplicationLauncher::finished,
this, &CallgrindController::controllerProcessFinished); this, &CallgrindController::controllerProcessFinished);
connect(m_controllerProcess, &ApplicationLauncher::error, connect(m_controllerProcess, &ApplicationLauncher::errorOccurred,
this, &CallgrindController::handleControllerProcessError); this, &CallgrindController::handleControllerProcessError);
Runnable controller = m_valgrindRunnable; Runnable controller = m_valgrindRunnable;

View File

@@ -116,9 +116,9 @@ bool ValgrindRunner::Private::run()
connect(&m_valgrindProcess, &ApplicationLauncher::finished, connect(&m_valgrindProcess, &ApplicationLauncher::finished,
q, &ValgrindRunner::processFinished); q, &ValgrindRunner::processFinished);
connect(&m_valgrindProcess, &ApplicationLauncher::processStarted, connect(&m_valgrindProcess, &ApplicationLauncher::started,
this, &ValgrindRunner::Private::processStarted); this, &ValgrindRunner::Private::processStarted);
connect(&m_valgrindProcess, &ApplicationLauncher::error, connect(&m_valgrindProcess, &ApplicationLauncher::errorOccurred,
q, &ValgrindRunner::processError); q, &ValgrindRunner::processError);
connect(&m_valgrindProcess, &ApplicationLauncher::appendMessage, connect(&m_valgrindProcess, &ApplicationLauncher::appendMessage,
q, &ValgrindRunner::processOutputReceived); q, &ValgrindRunner::processOutputReceived);
@@ -300,7 +300,7 @@ void ValgrindRunner::processFinished()
emit finished(); emit finished();
if (d->m_valgrindProcess.exitCode() != 0 || d->m_valgrindProcess.exitStatus() == QProcess::CrashExit) if (d->m_valgrindProcess.exitCode() != 0 || d->m_valgrindProcess.exitStatus() == QProcess::CrashExit)
emit processErrorReceived(errorString(), d->m_valgrindProcess.processError()); emit processErrorReceived(errorString(), d->m_valgrindProcess.error());
} }
QString ValgrindRunner::errorString() const QString ValgrindRunner::errorString() const