Skip to content

Commit

Permalink
Replace deprecated QAbstractSocket::error
Browse files Browse the repository at this point in the history
See #1198.
  • Loading branch information
lmoureaux committed Jan 1, 2023
1 parent 0387a5b commit ecdc27e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
19 changes: 8 additions & 11 deletions client/clinet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,14 @@ static int try_to_connect(const QUrl &url, char *errbuf, int errbufsize)
// Connect
if (!client.conn.sock) {
client.conn.sock = new QTcpSocket;
QObject::connect(
client.conn.sock,
QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error),
[] {
if (client.conn.sock != nullptr) {
log_debug("%s", qUtf8Printable(client.conn.sock->errorString()));
output_window_append(
ftc_client, qUtf8Printable(client.conn.sock->errorString()));
}
client.conn.used = false;
});
QObject::connect(client.conn.sock, &QAbstractSocket::errorOccurred, [] {
if (client.conn.sock != nullptr) {
log_debug("%s", qUtf8Printable(client.conn.sock->errorString()));
output_window_append(
ftc_client, qUtf8Printable(client.conn.sock->errorString()));
}
client.conn.used = false;
});
QObject::connect(client.conn.sock, &QAbstractSocket::disconnected,
[] { client.conn.used = false; });
}
Expand Down
6 changes: 2 additions & 4 deletions client/servers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ fcUdpScan::fcUdpScan(QObject *parent) : QUdpSocket(parent)
fcudp_scan = nullptr;
connect(this, &QUdpSocket::readyRead, this,
&fcUdpScan::readPendingDatagrams);
connect(
this,
QOverload<QAbstractSocket::SocketError>::of(&QAbstractSocket::error),
this, &fcUdpScan::sockError);
connect(this, &QAbstractSocket::errorOccurred, this,
&fcUdpScan::sockError);
}

/**
Expand Down
6 changes: 2 additions & 4 deletions server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,8 @@ void server::accept_connections()
if (server_make_connection(socket, remote) == 0) {
// Success making the connection, connect signals
connect(socket, &QIODevice::readyRead, this, &server::input_on_socket);
connect(socket,
QOverload<QAbstractSocket::SocketError>::of(
&QAbstractSocket::error),
this, &server::error_on_socket);
connect(socket, &QAbstractSocket::errorOccurred, this,
&server::error_on_socket);

// Prevents quitidle from firing immediately
m_someone_ever_connected = true;
Expand Down

0 comments on commit ecdc27e

Please sign in to comment.