forked from qt-creator/qt-creator
Ssh: Rename SshConnectionParameters into SshParameters
Move it to its own header. Get rid of SshConnection and SshConnectionManager, as they are not used anymore. Change-Id: I52fe20d7816ea57e7a7158ab2ae9565d50a76e21 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
#include <projectexplorer/devicesupport/sshdeviceprocesslist.h>
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
|
||||
#include <ssh/sshconnection.h>
|
||||
#include <ssh/sshparameters.h>
|
||||
#include <ssh/sshsettings.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
@@ -86,10 +86,10 @@ class SshSharedConnection : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SshSharedConnection(const SshConnectionParameters &sshParameters, QObject *parent = nullptr);
|
||||
explicit SshSharedConnection(const SshParameters &sshParameters, QObject *parent = nullptr);
|
||||
~SshSharedConnection() override;
|
||||
|
||||
SshConnectionParameters sshParameters() const { return m_sshParameters; }
|
||||
SshParameters sshParameters() const { return m_sshParameters; }
|
||||
void ref();
|
||||
void deref();
|
||||
void makeStale();
|
||||
@@ -122,7 +122,7 @@ private:
|
||||
QStringList connectionArgs(const FilePath &binary) const
|
||||
{ return connectionOptions(binary) << m_sshParameters.host(); }
|
||||
|
||||
const SshConnectionParameters m_sshParameters;
|
||||
const SshParameters m_sshParameters;
|
||||
std::unique_ptr<QtcProcess> m_masterProcess;
|
||||
std::unique_ptr<QTemporaryDir> m_masterSocketDir;
|
||||
QTimer m_timer;
|
||||
@@ -131,7 +131,7 @@ private:
|
||||
QProcess::ProcessState m_state = QProcess::NotRunning;
|
||||
};
|
||||
|
||||
SshSharedConnection::SshSharedConnection(const SshConnectionParameters &sshParameters, QObject *parent)
|
||||
SshSharedConnection::SshSharedConnection(const SshParameters &sshParameters, QObject *parent)
|
||||
: QObject(parent), m_sshParameters(sshParameters)
|
||||
{
|
||||
}
|
||||
@@ -189,7 +189,7 @@ void SshSharedConnection::connectToHost()
|
||||
}
|
||||
|
||||
m_masterProcess.reset(new QtcProcess);
|
||||
SshConnectionParameters::setupSshEnvironment(m_masterProcess.get());
|
||||
SshParameters::setupSshEnvironment(m_masterProcess.get());
|
||||
m_timer.setSingleShot(true);
|
||||
connect(&m_timer, &QTimer::timeout, this, &SshSharedConnection::autoDestructRequested);
|
||||
connect(m_masterProcess.get(), &QtcProcess::readyReadStandardOutput, [this] {
|
||||
@@ -383,7 +383,7 @@ public:
|
||||
QByteArray outputForRunInShell(const QString &cmd);
|
||||
QByteArray outputForRunInShell(const CommandLine &cmd);
|
||||
void attachToSharedConnection(SshConnectionHandle *connectionHandle,
|
||||
const SshConnectionParameters &sshParameters);
|
||||
const SshParameters &sshParameters);
|
||||
|
||||
LinuxDevice *q = nullptr;
|
||||
QThread m_shellThread;
|
||||
@@ -426,7 +426,7 @@ public:
|
||||
LinuxDevicePrivate *m_devicePrivate = nullptr;
|
||||
|
||||
QString m_socketFilePath;
|
||||
SshConnectionParameters m_sshParameters;
|
||||
SshParameters m_sshParameters;
|
||||
bool m_connecting = false;
|
||||
bool m_killed = false;
|
||||
|
||||
@@ -720,7 +720,7 @@ void SshProcessInterfacePrivate::doStart()
|
||||
m_process.setTerminalMode(q->m_setup.m_terminalMode);
|
||||
m_process.setWriteData(q->m_setup.m_writeData);
|
||||
// TODO: what about other fields from m_setup?
|
||||
SshConnectionParameters::setupSshEnvironment(&m_process);
|
||||
SshParameters::setupSshEnvironment(&m_process);
|
||||
if (!m_sshParameters.x11DisplayName.isEmpty()) {
|
||||
Environment env = m_process.controlEnvironment();
|
||||
// Note: it seems this is no-op when shared connection is used.
|
||||
@@ -760,9 +760,9 @@ CommandLine SshProcessInterfacePrivate::fullLocalCommandLine() const
|
||||
|
||||
// ShellThreadHandler
|
||||
|
||||
static SshConnectionParameters displayless(const SshConnectionParameters &sshParameters)
|
||||
static SshParameters displayless(const SshParameters &sshParameters)
|
||||
{
|
||||
SshConnectionParameters parameters = sshParameters;
|
||||
SshParameters parameters = sshParameters;
|
||||
parameters.x11DisplayName.clear();
|
||||
return parameters;
|
||||
}
|
||||
@@ -786,13 +786,13 @@ public:
|
||||
}
|
||||
|
||||
// Call me with shell mutex locked
|
||||
bool start(const SshConnectionParameters ¶meters)
|
||||
bool start(const SshParameters ¶meters)
|
||||
{
|
||||
closeShell();
|
||||
setSshParameters(parameters);
|
||||
m_shell.reset(new QtcProcess);
|
||||
|
||||
SshConnectionParameters::setupSshEnvironment(m_shell.get());
|
||||
SshParameters::setupSshEnvironment(m_shell.get());
|
||||
|
||||
const FilePath sshPath = SshSettings::sshFilePath();
|
||||
CommandLine cmd { sshPath };
|
||||
@@ -871,10 +871,10 @@ public:
|
||||
return output;
|
||||
}
|
||||
|
||||
void setSshParameters(const SshConnectionParameters &sshParameters)
|
||||
void setSshParameters(const SshParameters &sshParameters)
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
const SshConnectionParameters displaylessSshParameters = displayless(sshParameters);
|
||||
const SshParameters displaylessSshParameters = displayless(sshParameters);
|
||||
|
||||
if (m_displaylessSshParameters == displaylessSshParameters)
|
||||
return;
|
||||
@@ -888,7 +888,7 @@ public:
|
||||
}
|
||||
|
||||
QString attachToSharedConnection(SshConnectionHandle *connectionHandle,
|
||||
const SshConnectionParameters &sshParameters)
|
||||
const SshParameters &sshParameters)
|
||||
{
|
||||
setSshParameters(sshParameters);
|
||||
|
||||
@@ -938,7 +938,7 @@ public:
|
||||
}
|
||||
|
||||
// Call me with shell mutex locked, called from other thread
|
||||
bool isRunning(const SshConnectionParameters &sshParameters) const
|
||||
bool isRunning(const SshParameters &sshParameters) const
|
||||
{
|
||||
if (!m_shell)
|
||||
return false;
|
||||
@@ -949,7 +949,7 @@ public:
|
||||
}
|
||||
private:
|
||||
mutable QMutex m_mutex;
|
||||
SshConnectionParameters m_displaylessSshParameters;
|
||||
SshParameters m_displaylessSshParameters;
|
||||
QList<SshSharedConnection *> m_connections;
|
||||
std::unique_ptr<QtcProcess> m_shell;
|
||||
};
|
||||
@@ -1143,7 +1143,7 @@ LinuxDevicePrivate::~LinuxDevicePrivate()
|
||||
// Call me with shell mutex locked
|
||||
bool LinuxDevicePrivate::setupShell()
|
||||
{
|
||||
const SshConnectionParameters sshParameters = q->sshParameters();
|
||||
const SshParameters sshParameters = q->sshParameters();
|
||||
if (m_handler->isRunning(sshParameters))
|
||||
return true;
|
||||
|
||||
@@ -1186,7 +1186,7 @@ QByteArray LinuxDevicePrivate::outputForRunInShell(const CommandLine &cmd)
|
||||
}
|
||||
|
||||
void LinuxDevicePrivate::attachToSharedConnection(SshConnectionHandle *connectionHandle,
|
||||
const SshConnectionParameters &sshParameters)
|
||||
const SshParameters &sshParameters)
|
||||
{
|
||||
QString socketFilePath;
|
||||
QMetaObject::invokeMethod(m_handler, [this, connectionHandle, sshParameters] {
|
||||
@@ -1481,7 +1481,7 @@ protected:
|
||||
: m_method(method)
|
||||
, m_process(this)
|
||||
{
|
||||
SshConnectionParameters::setupSshEnvironment(&m_process);
|
||||
SshParameters::setupSshEnvironment(&m_process);
|
||||
connect(&m_process, &QtcProcess::readyReadStandardOutput, this, [this] {
|
||||
emit progress(QString::fromLocal8Bit(m_process.readAllStandardOutput()));
|
||||
});
|
||||
@@ -1583,7 +1583,7 @@ private:
|
||||
m_process.setStandardInputFile(m_batchFile->fileName());
|
||||
|
||||
// TODO: Add support for shared ssh connection
|
||||
const SshConnectionParameters params = displayless(m_device->sshParameters());
|
||||
const SshParameters params = displayless(m_device->sshParameters());
|
||||
m_process.setCommand(CommandLine(sftpBinary,
|
||||
params.connectionOptions(sftpBinary) << params.host()));
|
||||
m_process.start();
|
||||
@@ -1625,7 +1625,7 @@ private:
|
||||
{
|
||||
m_process.close();
|
||||
|
||||
const SshConnectionParameters parameters = displayless(m_device->sshParameters());
|
||||
const SshParameters parameters = displayless(m_device->sshParameters());
|
||||
const QStringList connectionOptions // TODO: add shared connection here
|
||||
= parameters.connectionOptions(SshSettings::sshFilePath());
|
||||
const QString sshCmdLine = ProcessArgs::joinArgs(
|
||||
|
||||
Reference in New Issue
Block a user