From b24d5394a580930919d207683c03954aaafd0e54 Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle Date: Fri, 14 Dec 2018 19:41:55 +0100 Subject: fixed build process below Qt 5.6 (#57) --- singleapplication_p.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/singleapplication_p.cpp b/singleapplication_p.cpp index 1edd2b8..c1bdff4 100644 --- a/singleapplication_p.cpp +++ b/singleapplication_p.cpp @@ -207,7 +207,11 @@ void SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType conne // Notify the parent that a new instance had been started; QByteArray initMsg; QDataStream writeStream(&initMsg, QIODevice::WriteOnly); + +#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) writeStream.setVersion(QDataStream::Qt_5_6); +#endif + writeStream << blockServerName.toLatin1(); writeStream << static_cast(connectionType); writeStream << instanceNumber; @@ -217,7 +221,10 @@ void SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType conne // The header indicates the message length that follows QByteArray header; QDataStream headerStream(&header, QIODevice::WriteOnly); + +#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) headerStream.setVersion(QDataStream::Qt_5_6); +#endif headerStream << static_cast ( initMsg.length() ); socket->write( header ); @@ -300,7 +307,10 @@ void SingleApplicationPrivate::readInitMessageHeader( QLocalSocket *sock ) } QDataStream headerStream( sock ); + +#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) headerStream.setVersion( QDataStream::Qt_5_6 ); +#endif // Read the header to know the message length quint64 msgLen = 0; @@ -330,7 +340,10 @@ void SingleApplicationPrivate::readInitMessageBody( QLocalSocket *sock ) // Read the message body QByteArray msgBytes = sock->read(info.msgLen); QDataStream readStream(msgBytes); + +#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) readStream.setVersion( QDataStream::Qt_5_6 ); +#endif // server name QByteArray latin1Name; -- cgit v1.2.1