From 6595738d64ad4dd9a8caedec7b6708f3d56f996c Mon Sep 17 00:00:00 2001 From: Syping Date: Thu, 9 May 2024 21:27:58 +0200 Subject: [PATCH] restore compatibility with older Qt --- SMSubServer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SMSubServer.cpp b/SMSubServer.cpp index 8548165..aa1cf6e 100644 --- a/SMSubServer.cpp +++ b/SMSubServer.cpp @@ -46,7 +46,9 @@ SMSubServer::SMSubServer(SMSubServerSettings *serverSettings, const QString &soc SMSubServer::SMSubServer(SMSubServerSettings *serverSettings, const QString &serverName, const quint16 &port) : serverSettings(serverSettings) { QWebSocketServer *webSocketServer = new QWebSocketServer(serverName, QWebSocketServer::NonSecureMode, this); +#if QT_VERSION >= 0x060400 webSocketServer->setSupportedSubprotocols(QStringList() << "smsub" << "smsub_json"); +#endif webSocketServer->listen(QHostAddress::LocalHost, port); QObject::connect(webSocketServer, &QWebSocketServer::newConnection, this, &SMSubServer::newConnection); @@ -88,8 +90,10 @@ void SMSubServer::newConnection() socket = webSocket; QTextStream(stderr) << QString("WebSocket %1:%2 connected!").arg(webSocket->peerAddress().toString(), QString::number(webSocket->peerPort())) << smsub_endl; +#if QT_VERSION >= 0x060400 if (webSocket->subprotocol() == "smsub_json") socket->setProperty("ReceiveJson", true); +#endif } else { // Just for being sure