ProjectExplorer: Base DeviceProcess on QtcProcess

... instead of having a member.

Change-Id: I75e8d7600eb17c7528fe9525d2e1aa871b282ad9
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2022-01-27 19:09:06 +01:00
parent 330dfa7e84
commit 9ec997b376
7 changed files with 33 additions and 183 deletions

View File

@@ -192,15 +192,11 @@ void SshDeviceProcess::handleConnected()
if (!display.isEmpty())
d->remoteProcess->requestX11Forwarding(display);
if (runInTerminal()) {
connect(process(), &QtcProcess::errorOccurred,
this, &DeviceProcess::errorOccurred);
connect(process(), &QtcProcess::started,
this, &SshDeviceProcess::handleProcessStarted);
connect(process(), &QtcProcess::finished,
this, [this] { handleProcessFinished(process()->errorString()); });
process()->setAbortOnMetaChars(false);
process()->setCommand(d->remoteProcess->fullLocalCommandLine(true));
process()->start();
connect(this, &QtcProcess::finished,
this, [this] { handleProcessFinished(errorString()); });
setAbortOnMetaChars(false);
setCommand(d->remoteProcess->fullLocalCommandLine(true));
QtcProcess::start();
} else {
connect(d->remoteProcess.get(), &QSsh::SshRemoteProcess::started,
this, &SshDeviceProcess::handleProcessStarted);
@@ -251,7 +247,7 @@ void SshDeviceProcess::handleProcessStarted()
void SshDeviceProcess::handleProcessFinished(const QString &error)
{
d->errorMessage = error;
d->exitCode = runInTerminal() ? process()->exitCode() : d->remoteProcess->exitCode();
d->exitCode = runInTerminal() ? QtcProcess::exitCode() : d->remoteProcess->exitCode();
if (d->killOperation && error.isEmpty())
d->errorMessage = tr("The process was ended forcefully.");
d->setState(SshDeviceProcessPrivate::Inactive);
@@ -356,10 +352,10 @@ void SshDeviceProcess::SshDeviceProcessPrivate::setState(SshDeviceProcess::SshDe
killOperation->disconnect(q);
killOperation.clear();
if (q->runInTerminal())
QMetaObject::invokeMethod(q->process(), &QtcProcess::stopProcess, Qt::QueuedConnection);
QMetaObject::invokeMethod(q, &QtcProcess::stopProcess, Qt::QueuedConnection);
}
killTimer.stop();
q->process()->disconnect();
q->disconnect();
if (remoteProcess)
remoteProcess->disconnect(q);
if (connection) {