summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2022-10-31 15:53:01 +0100
committerSimon Rettberg2022-10-31 15:53:01 +0100
commiteb2bafc3d2b36f7bbb7012bee3a21bacb8cf50e2 (patch)
tree76d336d9ab2538db4c87fd4eb63b9a8b687c01d3
parentRemove incomplete languages (diff)
downloadpvs2-eb2bafc3d2b36f7bbb7012bee3a21bacb8cf50e2.tar.gz
pvs2-eb2bafc3d2b36f7bbb7012bee3a21bacb8cf50e2.tar.xz
pvs2-eb2bafc3d2b36f7bbb7012bee3a21bacb8cf50e2.zip
Add a few hacks to make it compile on Qt 5.12 again
-rw-r--r--src/client/main.cpp8
-rw-r--r--src/client/net/serverconnection.cpp3
-rw-r--r--src/client/vnc/vncserver.cpp3
-rw-r--r--src/server/net/certmanager.cpp2
-rw-r--r--src/server/net/client.cpp2
-rw-r--r--src/shared/util.h5
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<QAbstractSocket::SocketError>::of(&QSslSocket::errorOccurred),
+ this, &ServerConnection::sock_error);
connect(_socket, QOverload<const QList<QSslError> &>::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 <QHash>
#include <QDir>
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<QAbstractSocket::SocketError>::of(&QTcpSocket::errorOccurred),
this, &Client::disconnect);
auto *ssl = qobject_cast<QSslSocket*>(_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 <QByteArray>
#include <QRandomGenerator>
+// 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);