Skip to content

Commit 4e24f07

Browse files
committed
Further corrections and compatibility for Qt lower than Qt 5.15
1 parent 4912ca1 commit 4e24f07

File tree

12 files changed

+35
-18
lines changed

12 files changed

+35
-18
lines changed

bin/create_release.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,4 @@ tar --create --gzip --absolute-names --show-transformed-names --ignore-failed-re
2929
"$builddir/bin/hyperion"* \
3030
"$repodir/bin/service/hyperion.init" \
3131
"$repodir/bin/service/hyperion.systemd" \
32-
"$repodir/bin/service/hyperion.initctl" \
33-
"$repodir/config/hyperion.config.json.default"
34-
32+
"$repodir/bin/service/hyperion.initctl"

libsrc/api/JsonAPI.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ void JsonAPI::handleImageCommand(const QJsonObject &message, const JsonApiComman
446446

447447
void JsonAPI::handleEffectCommand(const QJsonObject &message, const JsonApiCommand& cmd)
448448
{
449-
#if not defined(ENABLE_EFFECTENGINE)
449+
#if !defined(ENABLE_EFFECTENGINE)
450450
sendErrorReply("Effects are not supported by this installation!", cmd);
451451
#else
452452
emit forwardJsonMessage(message, _currInstanceIndex);
@@ -470,7 +470,7 @@ void JsonAPI::handleEffectCommand(const QJsonObject &message, const JsonApiComma
470470

471471
void JsonAPI::handleCreateEffectCommand(const QJsonObject &message, const JsonApiCommand& cmd)
472472
{
473-
#if not defined(ENABLE_EFFECTENGINE)
473+
#if !defined(ENABLE_EFFECTENGINE)
474474
sendErrorReply("Effects are not supported by this installation!", cmd);
475475
#else
476476
const QString resultMsg = EffectFileHandler::getInstance()->saveEffect(message);
@@ -480,7 +480,7 @@ void JsonAPI::handleCreateEffectCommand(const QJsonObject &message, const JsonAp
480480

481481
void JsonAPI::handleDeleteEffectCommand(const QJsonObject &message, const JsonApiCommand& cmd)
482482
{
483-
#if not defined(ENABLE_EFFECTENGINE)
483+
#if !defined(ENABLE_EFFECTENGINE)
484484
sendErrorReply("Effects are not supported by this installation!", cmd);
485485
#else
486486
const QString resultMsg = EffectFileHandler::getInstance()->deleteEffect(message["name"].toString());

src/hyperion-aml/hyperion-aml.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ int main(int argc, char ** argv)
5757
QObject::connect(&errorManager, &ErrorManager::errorOccurred, [&](const QString& error) {
5858
Error(log, "Error occured: %s", QSTRING_CSTR(error));
5959
Logger::deleteInstance();
60-
QTimer::singleShot(0, &app, &QCoreApplication::quit);
60+
QTimer::singleShot(0, [&app]() { app.quit(); });
6161
});
6262

6363
// create the option parser and initialize all parser

src/hyperion-dispmanx/hyperion-dispmanx.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ int main(int argc, char ** argv)
5959
QObject::connect(&errorManager, &ErrorManager::errorOccurred, [&](const QString& error) {
6060
Error(log, "Error occured: %s", QSTRING_CSTR(error));
6161
Logger::deleteInstance();
62-
QTimer::singleShot(0, &app, &QCoreApplication::quit);
62+
QTimer::singleShot(0, [&app]() { app.quit(); });
6363
});
6464

6565
// create the option parser and initialize all parameters

src/hyperion-framebuffer/hyperion-framebuffer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int main(int argc, char ** argv)
5858
QObject::connect(&errorManager, &ErrorManager::errorOccurred, [&](const QString& error) {
5959
Error(log, "Error occured: %s", QSTRING_CSTR(error));
6060
Logger::deleteInstance();
61-
QTimer::singleShot(0, &app, &QCoreApplication::quit);
61+
QTimer::singleShot(0, [&app]() { app.quit(); });
6262
});
6363

6464
// create the option parser and initialize all parameters

src/hyperion-osx/hyperion-osx.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ int main(int argc, char ** argv)
5858
QObject::connect(&errorManager, &ErrorManager::errorOccurred, [&](const QString& error) {
5959
Error(log, "Error occured: %s", QSTRING_CSTR(error));
6060
Logger::deleteInstance();
61-
QTimer::singleShot(0, &app, &QCoreApplication::quit);
61+
QTimer::singleShot(0, [&app]() { app.quit(); });
6262
});
6363

6464
// create the option parser and initialize all parameters

src/hyperion-qt/hyperion-qt.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ int main(int argc, char ** argv)
5757
QObject::connect(&errorManager, &ErrorManager::errorOccurred, [&](const QString& error) {
5858
Error(log, "Error occured: %s", QSTRING_CSTR(error));
5959
Logger::deleteInstance();
60-
QTimer::singleShot(0, &app, &QGuiApplication::quit);
60+
QTimer::singleShot(0, [&app]() { app.quit(); });
6161
});
6262

6363
// create the option parser and initialize all parameters

src/hyperion-remote/JsonConnection.cpp

+22-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@ JsonConnection::JsonConnection(const QHostAddress& host, bool printJson , quint1
3838
QObject::connect(_socket.get(), &QTcpSocket::connected, this, &JsonConnection::onConnected);
3939
QObject::connect(_socket.get(), &QTcpSocket::readyRead, this, &JsonConnection::onReadyRead);
4040
QObject::connect(_socket.get(), &QTcpSocket::disconnected, this, &JsonConnection::onDisconnected);
41+
42+
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
4143
QObject::connect(_socket.get(), &QTcpSocket::errorOccurred, this, &JsonConnection::onErrorOccured);
44+
#else
45+
QObject::connect(_socket.get(),
46+
QOverload<QTcpSocket::SocketError>::of(&QTcpSocket::error),
47+
this,
48+
&JsonConnection::onErrorOccured);
49+
#endif
4250

4351
// init connect
4452
connectToRemoteHost();
@@ -588,17 +596,28 @@ QJsonObject JsonConnection::sendMessageSync(const QJsonObject &message, const QJ
588596

589597
// Ensure no duplicate connections by disconnecting previous ones
590598
QObject::disconnect(this, &JsonConnection::isMessageReceived, nullptr, nullptr);
591-
QObject::disconnect(_socket.get(), &QTcpSocket::bytesWritten, nullptr, nullptr);
599+
600+
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
592601
QObject::disconnect(_socket.get(), &QTcpSocket::errorOccurred, nullptr, nullptr);
602+
#else
603+
QObject::disconnect(_socket.get(),
604+
QOverload<QTcpSocket::SocketError>::of(&QTcpSocket::error),
605+
nullptr, nullptr);
606+
#endif
593607

594608
// Capture response when received
595-
connect(this, &JsonConnection::isMessageReceived, this, [&](const QJsonObject &reply) {
609+
QObject::connect(this, &JsonConnection::isMessageReceived, this, [&](const QJsonObject &reply) {
596610
response = reply;
597611
received = true;
598612
loop.quit(); // Exit event loop when response arrives
599613
});
600614

601-
connect(_socket.get(), &QTcpSocket::errorOccurred, this, [&loop](QAbstractSocket::SocketError /*error*/) {
615+
#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
616+
QObject::connect(_socket.get(), &QTcpSocket::errorOccurred, this, [&loop](QTcpSocket::SocketError /*error*/) {
617+
#else
618+
QObject::connect(_socket.get(), QOverload<QTcpSocket::SocketError>::of(&QTcpSocket::error),
619+
[&loop](QTcpSocket::SocketError /*error*/) {
620+
#endif
602621
loop.quit();
603622
});
604623

src/hyperion-remote/hyperion-remote.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ int main(int argc, char * argv[])
9393
QObject::connect(&errorManager, &ErrorManager::errorOccurred, [&](const QString& error) {
9494
Error(log, "Error occured: %s", QSTRING_CSTR(error));
9595
Logger::deleteInstance();
96-
QTimer::singleShot(0, &app, &QCoreApplication::quit);
96+
QTimer::singleShot(0, [&app]() { app.quit(); });
9797
});
9898

9999
// force the locale

src/hyperion-v4l2/hyperion-v4l2.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ int main(int argc, char** argv)
6161
QObject::connect(&errorManager, &ErrorManager::errorOccurred, [&](const QString& error) {
6262
Error(log, "Error occured: %s", QSTRING_CSTR(error));
6363
Logger::deleteInstance();
64-
QTimer::singleShot(0, &app, &QCoreApplication::quit);
64+
QTimer::singleShot(0, [&app]() { app.quit(); });
6565
});
6666

6767
// force the locale

src/hyperion-x11/hyperion-x11.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ int main(int argc, char ** argv)
5757
QObject::connect(&errorManager, &ErrorManager::errorOccurred, [&](const QString& error) {
5858
Error(log, "Error occured: %s", QSTRING_CSTR(error));
5959
Logger::deleteInstance();
60-
QTimer::singleShot(0, &app, &QCoreApplication::quit);
60+
QTimer::singleShot(0, [&app]() { app.quit(); });
6161
});
6262

6363
// create the option parser and initialize all parameters

src/hyperion-xcb/hyperion-xcb.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ int main(int argc, char ** argv)
5757
QObject::connect(&errorManager, &ErrorManager::errorOccurred, [&](const QString& error) {
5858
Error(log, "Error occured: %s", QSTRING_CSTR(error));
5959
Logger::deleteInstance();
60-
QTimer::singleShot(0, &app, &QCoreApplication::quit);
60+
QTimer::singleShot(0, [&app]() { app.quit(); });
6161
});
6262
// create the option parser and initialize all parameters
6363
Parser parser( CAPTURE_TYPE + " capture application for Hyperion. Will automatically search a Hyperion server if -a option is not used. Please note that if you have more than one server running it's more or less random which one will be used.");

0 commit comments

Comments
 (0)