fixed build process below Qt 5.6 (#57)

This commit is contained in:
Patrizio Bekerle 2018-12-14 19:41:55 +01:00 committed by Itay Grudev
parent 2fac2a3804
commit b24d5394a5

View File

@ -207,7 +207,11 @@ void SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType conne
// Notify the parent that a new instance had been started; // Notify the parent that a new instance had been started;
QByteArray initMsg; QByteArray initMsg;
QDataStream writeStream(&initMsg, QIODevice::WriteOnly); QDataStream writeStream(&initMsg, QIODevice::WriteOnly);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
writeStream.setVersion(QDataStream::Qt_5_6); writeStream.setVersion(QDataStream::Qt_5_6);
#endif
writeStream << blockServerName.toLatin1(); writeStream << blockServerName.toLatin1();
writeStream << static_cast<quint8>(connectionType); writeStream << static_cast<quint8>(connectionType);
writeStream << instanceNumber; writeStream << instanceNumber;
@ -217,7 +221,10 @@ void SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType conne
// The header indicates the message length that follows // The header indicates the message length that follows
QByteArray header; QByteArray header;
QDataStream headerStream(&header, QIODevice::WriteOnly); QDataStream headerStream(&header, QIODevice::WriteOnly);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
headerStream.setVersion(QDataStream::Qt_5_6); headerStream.setVersion(QDataStream::Qt_5_6);
#endif
headerStream << static_cast <quint64>( initMsg.length() ); headerStream << static_cast <quint64>( initMsg.length() );
socket->write( header ); socket->write( header );
@ -300,7 +307,10 @@ void SingleApplicationPrivate::readInitMessageHeader( QLocalSocket *sock )
} }
QDataStream headerStream( sock ); QDataStream headerStream( sock );
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
headerStream.setVersion( QDataStream::Qt_5_6 ); headerStream.setVersion( QDataStream::Qt_5_6 );
#endif
// Read the header to know the message length // Read the header to know the message length
quint64 msgLen = 0; quint64 msgLen = 0;
@ -330,7 +340,10 @@ void SingleApplicationPrivate::readInitMessageBody( QLocalSocket *sock )
// Read the message body // Read the message body
QByteArray msgBytes = sock->read(info.msgLen); QByteArray msgBytes = sock->read(info.msgLen);
QDataStream readStream(msgBytes); QDataStream readStream(msgBytes);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
readStream.setVersion( QDataStream::Qt_5_6 ); readStream.setVersion( QDataStream::Qt_5_6 );
#endif
// server name // server name
QByteArray latin1Name; QByteArray latin1Name;