diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-11-01 12:24:03 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-11-19 09:13:00 +0000 |
commit | d775c26bcd072252075dc82dc35bf22d53c6b7f7 (patch) | |
tree | 6ef9ec25db26306858675b9d479ec94f3ddbd22f /src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp | |
parent | 424923817cd018767671e0e88b90deef3fd4917a (diff) |
RemoteLinux: Offer X11 forwarding in run configurations
Change-Id: I736d76e072a97fa148286c30c4ca36bf4c1253e2
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp')
-rw-r--r-- | src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp b/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp index cf123de580..9feb7e7166 100644 --- a/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp +++ b/src/plugins/projectexplorer/devicesupport/sshdeviceprocess.cpp @@ -60,6 +60,11 @@ public: void setState(State newState); void doSignal(QSsh::SshRemoteProcess::Signal signal); + + QString displayName() const + { + return runnable.extraData.value("Ssh.X11ForwardToDisplay").toString(); + } }; SshDeviceProcess::SshDeviceProcess(const IDevice::ConstPtr &device, QObject *parent) @@ -82,6 +87,12 @@ void SshDeviceProcess::start(const Runnable &runnable) d->exitCode = -1; d->runnable = runnable; d->connection = QSsh::acquireConnection(device()->sshParameters()); + const QString displayName = d->displayName(); + const QString connDisplayName = d->connection->x11DisplayName(); + if (!displayName.isEmpty() && !connDisplayName.isEmpty() && connDisplayName != displayName) { + QSsh::releaseConnection(d->connection); + d->connection = new QSsh::SshConnection(device()->sshParameters(), this); + } connect(d->connection, &QSsh::SshConnection::error, this, &SshDeviceProcess::handleConnectionError); connect(d->connection, &QSsh::SshConnection::disconnected, @@ -183,6 +194,9 @@ void SshDeviceProcess::handleConnected() const Utils::Environment env = d->runnable.environment; for (Utils::Environment::const_iterator it = env.constBegin(); it != env.constEnd(); ++it) d->process->addToEnvironment(env.key(it).toUtf8(), env.value(it).toUtf8()); + const QString display = d->displayName(); + if (!display.isEmpty()) + d->process->requestX11Forwarding(display); d->process->start(); } @@ -346,7 +360,10 @@ void SshDeviceProcess::SshDeviceProcessPrivate::setState(SshDeviceProcess::SshDe process->disconnect(q); if (connection) { connection->disconnect(q); - QSsh::releaseConnection(connection); + if (connection->parent() == q) + connection->deleteLater(); + else + QSsh::releaseConnection(connection); connection = nullptr; } } |