Uniform ApplicationLauncher API: get rid of remoteProcessStarted()

Use existing processStarted() signal instead.
Replace isRemoteRunning() with isLocal().

Change-Id: I58d0204888116c00e793fa43f969707013db06eb
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2021-11-09 17:54:01 +01:00
parent 02dbed75b4
commit 971b1b2269
5 changed files with 16 additions and 26 deletions

View File

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

View File

@@ -86,7 +86,6 @@ public:
void bringToForeground();
qint64 applicationPID() const;
bool isRunning() const;
bool isRemoteRunning() const;
// Remote
void doReportError(const QString &message);
@@ -229,9 +228,9 @@ bool ApplicationLauncher::isRunning() const
return d->isRunning();
}
bool ApplicationLauncher::isRemoteRunning() const
bool ApplicationLauncher::isLocal() const
{
return d->isRemoteRunning();
return d->m_isLocal;
}
bool ApplicationLauncherPrivate::isRunning() const
@@ -241,11 +240,6 @@ bool ApplicationLauncherPrivate::isRunning() const
return m_guiProcess.state() != QProcess::NotRunning;
}
bool ApplicationLauncherPrivate::isRemoteRunning() const
{
return m_isLocal ? false : m_deviceProcess->state() == QProcess::Running;
}
ProcessHandle ApplicationLauncher::applicationPID() const
{
return ProcessHandle(d->applicationPID());
@@ -433,7 +427,7 @@ void ApplicationLauncherPrivate::start(const Runnable &runnable, const IDevice::
m_deviceProcess = device->createProcess(this);
m_deviceProcess->setRunInTerminal(m_useTerminal);
connect(m_deviceProcess, &DeviceProcess::started,
q, &ApplicationLauncher::remoteProcessStarted);
q, &ApplicationLauncher::processStarted);
connect(m_deviceProcess, &DeviceProcess::readyReadStandardOutput,
this, &ApplicationLauncherPrivate::handleRemoteStdout);
connect(m_deviceProcess, &DeviceProcess::readyReadStandardError,

View File

@@ -60,7 +60,7 @@ public:
void stop();
bool isRunning() const;
Utils::ProcessHandle applicationPID() const;
bool isRemoteRunning() const;
bool isLocal() const;
QString errorString() const;
QProcess::ProcessError processError() const;
@@ -75,7 +75,6 @@ signals:
void error(QProcess::ProcessError error);
void reportError(const QString &errorOutput);
void remoteProcessStarted();
void finished(bool success);
private:

View File

@@ -1263,11 +1263,7 @@ void SimpleTargetRunner::doStart(const Runnable &runnable, const IDevice::ConstP
reportStopped();
});
connect(&m_launcher, &ApplicationLauncher::processStarted,
this, [this] {
appendMessage("Application launcher started", Utils::NormalMessageFormat);
// reportStarted();
});
connect(&m_launcher, &ApplicationLauncher::processStarted, this, &RunWorker::reportStarted);
connect(&m_launcher, &ApplicationLauncher::processExited,
this, [this] {
@@ -1275,11 +1271,6 @@ void SimpleTargetRunner::doStart(const Runnable &runnable, const IDevice::ConstP
reportStopped();
});
connect(&m_launcher, &ApplicationLauncher::remoteProcessStarted,
this, [this] {
reportStarted();
});
connect(&m_launcher, &ApplicationLauncher::appendMessage, this, &RunWorker::appendMessage);
m_launcher.start(runnable, device);

View File

@@ -49,6 +49,7 @@ public:
bool run();
void closed(bool success);
void processStarted();
void localProcessStarted();
void remoteProcessStarted();
void findPidOutputReceived(const QString &out, Utils::OutputFormat format);
@@ -117,7 +118,7 @@ bool ValgrindRunner::Private::run()
connect(&m_valgrindProcess, &ApplicationLauncher::processExited,
this, &ValgrindRunner::Private::closed);
connect(&m_valgrindProcess, &ApplicationLauncher::processStarted,
this, &ValgrindRunner::Private::localProcessStarted);
this, &ValgrindRunner::Private::processStarted);
connect(&m_valgrindProcess, &ApplicationLauncher::error,
q, &ValgrindRunner::processError);
connect(&m_valgrindProcess, &ApplicationLauncher::appendMessage,
@@ -125,9 +126,6 @@ bool ValgrindRunner::Private::run()
connect(&m_valgrindProcess, &ApplicationLauncher::finished,
q, &ValgrindRunner::finished);
connect(&m_valgrindProcess, &ApplicationLauncher::remoteProcessStarted,
this, &ValgrindRunner::Private::remoteProcessStarted);
if (HostOsInfo::isMacHost())
// May be slower to start but without it we get no filenames for symbols.
cmd.addArg("--dsymutil=yes");
@@ -154,6 +152,14 @@ bool ValgrindRunner::Private::run()
return true;
}
void ValgrindRunner::Private::processStarted()
{
if (m_valgrindProcess.isLocal())
localProcessStarted();
else
remoteProcessStarted();
}
void ValgrindRunner::Private::localProcessStarted()
{
qint64 pid = m_valgrindProcess.applicationPID().pid();