diff options
author | hjk <hjk@qt.io> | 2022-02-11 17:38:16 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2022-02-14 15:10:12 +0000 |
commit | 95c9579c58d8cd9dfacbeee70f84920ab9cf87e7 (patch) | |
tree | ecb272ad7451830ca0e8046aaa7cb8ec80018d48 /src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp | |
parent | 380d952221a1f87ed47b860a7eb5ed5f51cbf70e (diff) |
ProjectExplorer: Normalize DeviceProcess::start() signature
Change-Id: I2915be34d4a1eed64567874dcf0263b7583cc142
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp')
-rw-r--r-- | src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp b/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp index e88aa414d1..da1281d7e6 100644 --- a/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp +++ b/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp @@ -54,7 +54,8 @@ public: bool ignoreSelfSignals = true; QSsh::SshConnection *connection = nullptr; QSsh::SshRemoteProcessPtr remoteProcess; - Runnable runnable; + QString processName; + QString displayName; QString errorMessage; QProcess::ExitStatus exitStatus = QProcess::NormalExit; DeviceProcessSignalOperation::Ptr killOperation; @@ -63,11 +64,6 @@ public: void setState(State newState); void doSignal(Signal signal); - - QString displayName() const - { - return runnable.extraData.value("Ssh.X11ForwardToDisplay").toString(); - } }; SshDeviceProcess::SshDeviceProcess(const IDevice::ConstPtr &device, QObject *parent) @@ -95,17 +91,19 @@ SshDeviceProcess::~SshDeviceProcess() d->setState(SshDeviceProcessPrivate::Inactive); } -void SshDeviceProcess::start(const Runnable &runnable) +void SshDeviceProcess::start() { QTC_ASSERT(d->state == SshDeviceProcessPrivate::Inactive, return); - QTC_ASSERT(usesTerminal() || !runnable.command.isEmpty(), return); + QTC_ASSERT(usesTerminal() || !commandLine().isEmpty(), return); d->setState(SshDeviceProcessPrivate::Connecting); d->errorMessage.clear(); d->exitStatus = QProcess::NormalExit; - d->runnable = runnable; + d->processName = commandLine().executable().toString(); + d->displayName = extraData("Ssh.X11ForwardToDisplay").toString(); + QSsh::SshConnectionParameters params = device()->sshParameters(); - params.x11DisplayName = d->displayName(); + params.x11DisplayName = d->displayName; d->connection = QSsh::SshConnectionManager::acquireConnection(params); connect(d->connection, &QSsh::SshConnection::errorOccurred, this, &SshDeviceProcess::handleConnectionError); @@ -191,10 +189,10 @@ void SshDeviceProcess::handleConnected() QTC_ASSERT(d->state == SshDeviceProcessPrivate::Connecting, return); d->setState(SshDeviceProcessPrivate::Connected); - d->remoteProcess = usesTerminal() && d->runnable.command.isEmpty() + d->remoteProcess = usesTerminal() && d->processName.isEmpty() ? d->connection->createRemoteShell() - : d->connection->createRemoteProcess(fullCommandLine(d->runnable)); - const QString display = d->displayName(); + : d->connection->createRemoteProcess(fullCommandLine()); + const QString display = d->displayName; if (!display.isEmpty()) d->remoteProcess->requestX11Forwarding(display); d->ignoreSelfSignals = !usesTerminal(); @@ -280,18 +278,14 @@ void SshDeviceProcess::handleKillOperationTimeout() emit finished(); } -QString SshDeviceProcess::fullCommandLine(const Runnable &runnable) const +QString SshDeviceProcess::fullCommandLine() const { - QString cmdLine = runnable.command.executable().toString(); - // FIXME: That quotes wrongly. - if (!runnable.command.arguments().isEmpty()) - cmdLine.append(QLatin1Char(' ')).append(runnable.command.arguments()); - return cmdLine; + return commandLine().toUserOutput(); } void SshDeviceProcess::SshDeviceProcessPrivate::doSignal(Signal signal) { - if (runnable.command.isEmpty()) + if (processName.isEmpty()) return; switch (state) { case SshDeviceProcessPrivate::Inactive: @@ -310,7 +304,7 @@ void SshDeviceProcess::SshDeviceProcessPrivate::doSignal(Signal signal) if (processId != 0) signalOperation->interruptProcess(processId); else - signalOperation->interruptProcess(runnable.command.executable().toString()); + signalOperation->interruptProcess(processName); } else { if (killOperation) // We are already in the process of killing the app. return; @@ -321,7 +315,7 @@ void SshDeviceProcess::SshDeviceProcessPrivate::doSignal(Signal signal) if (processId != 0) signalOperation->killProcess(processId); else - signalOperation->killProcess(runnable.command.executable().toString()); + signalOperation->killProcess(processName); } break; } |