SSH: Use Qt5-style connects

The heavy lifting was done by clazy.

Change-Id: I04261849c92c54990f9f142fe541d984c5fb21d3
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2016-06-07 22:04:26 +03:00
committed by Orgad Shaneh
parent 4cb94be1b5
commit 35036110ce
10 changed files with 50 additions and 47 deletions

View File

@@ -100,14 +100,14 @@ SshConnection::SshConnection(const SshConnectionParameters &serverInfo, QObject
qRegisterMetaType<QList <QSsh::SftpFileInfo> >("QList<QSsh::SftpFileInfo>");
d = new Internal::SshConnectionPrivate(this, serverInfo);
connect(d, SIGNAL(connected()), this, SIGNAL(connected()),
connect(d, &Internal::SshConnectionPrivate::connected, this, &SshConnection::connected,
Qt::QueuedConnection);
connect(d, SIGNAL(dataAvailable(QString)), this,
SIGNAL(dataAvailable(QString)), Qt::QueuedConnection);
connect(d, SIGNAL(disconnected()), this, SIGNAL(disconnected()),
connect(d, &Internal::SshConnectionPrivate::dataAvailable, this,
&SshConnection::dataAvailable, Qt::QueuedConnection);
connect(d, &Internal::SshConnectionPrivate::disconnected, this, &SshConnection::disconnected,
Qt::QueuedConnection);
connect(d, SIGNAL(error(QSsh::SshError)), this,
SIGNAL(error(QSsh::SshError)), Qt::QueuedConnection);
connect(d, &Internal::SshConnectionPrivate::error, this,
&SshConnection::error, Qt::QueuedConnection);
}
void SshConnection::connectToHost()
@@ -135,7 +135,7 @@ SshConnection::State SshConnection::state() const
SshError SshConnection::errorState() const
{
return d->error();
return d->errorState();
}
QString SshConnection::errorString() const
@@ -227,7 +227,8 @@ SshConnectionPrivate::SshConnectionPrivate(SshConnection *conn,
m_timeoutTimer.setInterval(m_connParams.timeout * 1000);
m_keepAliveTimer.setSingleShot(true);
m_keepAliveTimer.setInterval(10000);
connect(m_channelManager, SIGNAL(timeout()), this, SLOT(handleTimeout()));
connect(m_channelManager, &SshChannelManager::timeout,
this, &SshConnectionPrivate::handleTimeout);
}
SshConnectionPrivate::~SshConnectionPrivate()
@@ -589,7 +590,7 @@ void SshConnectionPrivate::handleUserAuthSuccessPacket()
m_timeoutTimer.stop();
emit connected();
m_lastInvalidMsgSeqNr = InvalidSeqNr;
connect(&m_keepAliveTimer, SIGNAL(timeout()), SLOT(sendKeepAlivePacket()));
connect(&m_keepAliveTimer, &QTimer::timeout, this, &SshConnectionPrivate::sendKeepAlivePacket);
m_keepAliveTimer.start();
}
@@ -767,13 +768,16 @@ void SshConnectionPrivate::connectToHost()
return;
}
connect(m_socket, SIGNAL(connected()), this, SLOT(handleSocketConnected()));
connect(m_socket, SIGNAL(readyRead()), this, SLOT(handleIncomingData()));
connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this,
SLOT(handleSocketError()));
connect(m_socket, SIGNAL(disconnected()), this,
SLOT(handleSocketDisconnected()));
connect(&m_timeoutTimer, SIGNAL(timeout()), this, SLOT(handleTimeout()));
connect(m_socket, &QAbstractSocket::connected,
this, &SshConnectionPrivate::handleSocketConnected);
connect(m_socket, &QIODevice::readyRead,
this, &SshConnectionPrivate::handleIncomingData);
connect(m_socket,
static_cast<void (QAbstractSocket::*)(QAbstractSocket::SocketError)>(&QAbstractSocket::error),
this, &SshConnectionPrivate::handleSocketError);
connect(m_socket, &QAbstractSocket::disconnected,
this, &SshConnectionPrivate::handleSocketDisconnected);
connect(&m_timeoutTimer, &QTimer::timeout, this, &SshConnectionPrivate::handleTimeout);
m_state = SocketConnecting;
m_keyExchangeState = NoKeyExchange;
m_timeoutTimer.start();