Skip to content

Commit

Permalink
Fix compilation on Qt 5.15
Browse files Browse the repository at this point in the history
  • Loading branch information
dantti committed Nov 1, 2020
1 parent befc8ef commit 163927a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ add_definitions(
-DQT_USE_QSTRINGBUILDER
-DQT_NO_SIGNALS_SLOTS_KEYWORDS
-DQT_USE_FAST_OPERATOR_PLUS
-DQT_DISABLE_DEPRECATED_BEFORE=0x050c00
-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00
)

include_directories(
Expand Down
8 changes: 6 additions & 2 deletions src/sender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,13 @@ void Sender::setConnectionType(ConnectionType connectionType)
connect(static_cast<QSslSocket*>(d->socket), static_cast<void(QSslSocket::*)(const QList<QSslError> &)>(&QSslSocket::sslErrors),this, &Sender::sslErrors, Qt::DirectConnection);
}
connect(d->socket, &QTcpSocket::stateChanged, this, &Sender::socketStateChanged);
connect(d->socket, static_cast<void(QTcpSocket::*)(QTcpSocket::SocketError)>(&QTcpSocket::error),
this, &Sender::socketError);
connect(d->socket, &QTcpSocket::readyRead, this, &Sender::socketReadyRead);

#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
connect(d->socket, &QTcpSocket::errorOccurred, this, &Sender::socketError);
#else
connect(d->socket, static_cast<void(QTcpSocket::*)(QTcpSocket::SocketError)>(&QTcpSocket::error), this, &Sender::socketError);
#endif
}

QString Sender::user() const
Expand Down
10 changes: 7 additions & 3 deletions src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ void ServerPrivate::createSocket()
state = WaitingForServiceReady220;
});

q->connect(socket, static_cast<void(QTcpSocket::*)(QTcpSocket::SocketError)>(&QTcpSocket::error),
q, [=] (QAbstractSocket::SocketError error) {
auto erroFn = [=] (QAbstractSocket::SocketError error) {
qCDebug(SIMPLEMAIL_SERVER) << "SocketError" << error << socket->readAll();
if (!queue.isEmpty()) {
ServerReplyContainer &cont = queue[0];
Expand All @@ -247,7 +246,12 @@ void ServerPrivate::createSocket()
queue.removeFirst();
}
}
});
};
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
q->connect(socket, &QTcpSocket::errorOccurred, q, erroFn);
#else
q->connect(socket, static_cast<void(QTcpSocket::*)(QTcpSocket::SocketError)>(&QTcpSocket::error), q, erroFn);
#endif

q->connect(socket, &QTcpSocket::readyRead, q, [=] {
qCDebug(SIMPLEMAIL_SERVER) << "readyRead" << socket->bytesAvailable();
Expand Down

0 comments on commit 163927a

Please sign in to comment.