From eb2bafc3d2b36f7bbb7012bee3a21bacb8cf50e2 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 31 Oct 2022 15:53:01 +0100 Subject: Add a few hacks to make it compile on Qt 5.12 again --- src/client/main.cpp | 8 ++++++-- src/client/net/serverconnection.cpp | 3 ++- src/client/vnc/vncserver.cpp | 3 +++ src/server/net/certmanager.cpp | 2 ++ src/server/net/client.cpp | 2 +- src/shared/util.h | 5 +++++ 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/client/main.cpp b/src/client/main.cpp index cb7aea6..6a7c2a0 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -2,6 +2,10 @@ #include "clientapp/clientapp.h" #include "util/util.h" +// Remove when we don't support Ubuntu 20.04 anymore +#if QT_VERSION >= QT_VERSION_CHECK(5,14,0) +#define endl Qt::endl +#endif /* instantiates the ClientApp, handles some extra parameters and starts the * main-loop of ClientApp */ @@ -13,12 +17,12 @@ int main(int argc, char** argv) /* here we handle the arguments that were not handled by ClientApp */ for (const auto &a : app.arguments()) { if (a == "--usage" || a == "--help") { - qStdout() << "Usage: pvsclient [--exam-mode] [--auto|--session=xxx|\"\"]" << Qt::endl; + qStdout() << "Usage: pvsclient [--exam-mode] [--auto|--session=xxx|\"\"]" << endl; exit(0); } else if (a.contains("pvsclient")) { /* do nothing */ } else { - qStdout() << "Unknown argument: " << a << Qt::endl; + qStdout() << "Unknown argument: " << a << endl; exit(1); } } diff --git a/src/client/net/serverconnection.cpp b/src/client/net/serverconnection.cpp index e500528..aae7538 100644 --- a/src/client/net/serverconnection.cpp +++ b/src/client/net/serverconnection.cpp @@ -25,7 +25,8 @@ ServerConnection::ServerConnection(const QString& host, const quint16 port, cons connect(_socket, &QSslSocket::encrypted, this, &ServerConnection::sock_connected); connect(_socket, &QSslSocket::readyRead, this, &ServerConnection::sock_dataArrival); connect(_socket, &QSslSocket::disconnected, this, &ServerConnection::sock_closed); - connect(_socket, &QSslSocket::errorOccurred, this, &ServerConnection::sock_error); + connect(_socket, QOverload::of(&QSslSocket::errorOccurred), + this, &ServerConnection::sock_error); connect(_socket, QOverload &>::of(&QSslSocket::sslErrors), this, &ServerConnection::sslErrors ); diff --git a/src/client/vnc/vncserver.cpp b/src/client/vnc/vncserver.cpp index 4c2363e..7db8423 100644 --- a/src/client/vnc/vncserver.cpp +++ b/src/client/vnc/vncserver.cpp @@ -13,6 +13,9 @@ #include "../util/util.h" #include "../../shared/util.h" +// Remove in future - see util.h +#undef errorOccurred + VncServer* VncServer::me = nullptr; /** diff --git a/src/server/net/certmanager.cpp b/src/server/net/certmanager.cpp index 968535a..5a4f904 100644 --- a/src/server/net/certmanager.cpp +++ b/src/server/net/certmanager.cpp @@ -19,6 +19,8 @@ #include "certmanager.h" #include "../../shared/util.h" +// Remove in future - see comment in util.h +#undef errorOccurred #include #include diff --git a/src/server/net/client.cpp b/src/server/net/client.cpp index 08dfc9a..bf1ad25 100644 --- a/src/server/net/client.cpp +++ b/src/server/net/client.cpp @@ -31,7 +31,7 @@ Client::Client(QTcpSocket* socket) // Connect important signals connect(_socket, &QTcpSocket::disconnected, this, &Client::disconnect); - connect(_socket, &QTcpSocket::errorOccurred, + connect(_socket, QOverload::of(&QTcpSocket::errorOccurred), this, &Client::disconnect); auto *ssl = qobject_cast(_socket); if (ssl != nullptr) { diff --git a/src/shared/util.h b/src/shared/util.h index c25f778..2637419 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -11,6 +11,11 @@ #include #include +// Remove after we drop Ubuntu 20.04 +#if QT_VERSION < QT_VERSION_CHECK(5,15,0) +#define errorOccurred error +#endif + #define slxrand() (QRandomGenerator::system()->generate()) QByteArray genSha1(const QByteArray *a, const QByteArray *b = nullptr, const QByteArray *c = nullptr, const QByteArray *d = nullptr, const QByteArray *e = nullptr); -- cgit v1.2.3-55-g7522