From 61ba1f392a0ddf9f800cbb54c73adc70f570febe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gro=C3=9F?= Date: Thu, 30 Dec 2021 19:12:01 +0100 Subject: [PATCH 1/5] Reinstate partial backwards compatibility with Qt 5.12.3 --- .../src/audio/AvatarAudioStream.h | 5 ++ assignment-client/src/avatars/AvatarMixer.cpp | 4 ++ interface/src/Application.cpp | 20 ++++++++ interface/src/Application.h | 8 ++++ interface/src/avatar/MyHead.h | 5 ++ interface/src/graphics/GraphicsEngine.h | 4 ++ interface/src/ui/overlays/Overlays.h | 4 ++ libraries/animation/src/AnimNodeLoader.h | 5 ++ libraries/animation/src/AnimRandomSwitch.h | 10 ++++ libraries/animation/src/AnimStateMachine.h | 10 ++++ libraries/audio/src/AudioInjectorManager.h | 5 ++ libraries/audio/src/InjectedAudioStream.h | 5 ++ libraries/avatars/src/AvatarData.h | 5 ++ libraries/avatars/src/HeadData.h | 5 ++ .../src/controllers/UserInputMapper.cpp | 13 +++++ .../src/display-plugins/CompositorHelper.h | 4 ++ .../embedded-webserver/src/HTTPConnection.cpp | 6 +++ libraries/entities/src/EntitySimulation.h | 8 ++++ libraries/entities/src/EntityTree.cpp | 6 ++- .../model-baker/src/model-baker/Baker.cpp | 28 +++++++++++ .../CalculateBlendshapeNormalsTask.cpp | 4 ++ .../CalculateBlendshapeTangentsTask.cpp | 4 ++ .../model-baker/CalculateMeshNormalsTask.cpp | 4 ++ .../model-baker/CalculateMeshTangentsTask.cpp | 4 ++ .../model-serializers/src/GLTFSerializer.cpp | 4 ++ libraries/networking/src/AccountManager.h | 5 ++ .../networking/src/AssetResourceRequest.cpp | 4 ++ libraries/networking/src/HMACAuth.h | 4 ++ libraries/networking/src/LimitedNodeList.cpp | 5 ++ libraries/networking/src/NLPacketList.h | 12 ++++- libraries/networking/src/Node.h | 5 ++ libraries/networking/src/NodeList.h | 11 ++++- .../networking/src/udt/CongestionControl.h | 17 ++++--- libraries/networking/src/udt/ControlPacket.h | 22 ++++++--- libraries/networking/src/udt/PacketList.h | 45 +++++++++-------- libraries/networking/src/udt/SendQueue.h | 43 +++++++++-------- libraries/octree/src/OctreeEditPacketSender.h | 4 ++ .../physics/src/PhysicalEntitySimulation.h | 4 ++ libraries/render-utils/src/Model.cpp | 4 ++ libraries/render-utils/src/Model.h | 4 ++ libraries/script-engine/src/ScriptEngine.cpp | 22 +++++++-- libraries/shared/src/DependencyManager.h | 4 ++ libraries/shared/src/shared/FileUtils.cpp | 6 +++ libraries/shared/src/shared/FileUtils.h | 4 ++ libraries/ui/src/VrMenu.cpp | 4 ++ tools/ac-client/src/ACClientApp.cpp | 4 ++ tools/atp-client/src/ATPClientApp.cpp | 4 ++ tools/ice-client/src/ICEClientApp.cpp | 4 ++ tools/nitpick/src/TestCreator.cpp | 48 +++++++++++++++++++ tools/skeleton-dump/src/SkeletonDumpApp.cpp | 4 ++ tools/vhacd-util/src/VHACDUtilApp.cpp | 4 ++ 51 files changed, 417 insertions(+), 60 deletions(-) mode change 100755 => 100644 libraries/avatars/src/AvatarData.h mode change 100755 => 100644 libraries/controllers/src/controllers/UserInputMapper.cpp diff --git a/assignment-client/src/audio/AvatarAudioStream.h b/assignment-client/src/audio/AvatarAudioStream.h index e445dafa5cc..b7d310377f0 100644 --- a/assignment-client/src/audio/AvatarAudioStream.h +++ b/assignment-client/src/audio/AvatarAudioStream.h @@ -23,7 +23,12 @@ class AvatarAudioStream : public PositionalAudioStream { AvatarAudioStream(bool isStereo, int numStaticJitterFrames = -1); private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + AvatarAudioStream(const AvatarAudioStream&); + AvatarAudioStream& operator= (const AvatarAudioStream&); +#else Q_DISABLE_COPY(AvatarAudioStream) +#endif int parseStreamProperties(PacketType type, const QByteArray& packetAfterSeqNum, int& numAudioSamples) override; }; diff --git a/assignment-client/src/avatars/AvatarMixer.cpp b/assignment-client/src/avatars/AvatarMixer.cpp index 2d249ac8763..607b7d6b7c4 100644 --- a/assignment-client/src/avatars/AvatarMixer.cpp +++ b/assignment-client/src/avatars/AvatarMixer.cpp @@ -1062,7 +1062,11 @@ void AvatarMixer::parseDomainServerSettings(const QJsonObject& domainSettings) { static const QString AVATAR_WHITELIST_OPTION = "avatar_whitelist"; _slaveSharedData.skeletonURLWhitelist = avatarMixerGroupObject[AVATAR_WHITELIST_OPTION] +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + .toString().split(',', QString::KeepEmptyParts); +#else .toString().split(',', Qt::KeepEmptyParts); +#endif static const QString REPLACEMENT_AVATAR_OPTION = "replacement_avatar"; _slaveSharedData.skeletonReplacementURL = avatarMixerGroupObject[REPLACEMENT_AVATAR_OPTION] diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d3c10d2ea42..ddbcf08724e 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3261,12 +3261,20 @@ void Application::initializeUi() { auto newValidator = [=](const QUrl& url) -> bool { QString whitelistPrefix = "[WHITELIST ENTITY SCRIPTS]"; QList safeURLS = { "" }; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + safeURLS += qEnvironmentVariable("EXTRA_WHITELIST").trimmed().split(QRegExp("\\s*,\\s*"), QString::SkipEmptyParts); +#else safeURLS += qEnvironmentVariable("EXTRA_WHITELIST").trimmed().split(QRegExp("\\s*,\\s*"), Qt::SkipEmptyParts); +#endif // PULL SAFEURLS FROM INTERFACE.JSON Settings QVariant raw = Setting::Handle("private/settingsSafeURLS").get(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + QStringList settingsSafeURLS = raw.toString().trimmed().split(QRegExp("\\s*[,\r\n]+\\s*"), QString::SkipEmptyParts); +#else QStringList settingsSafeURLS = raw.toString().trimmed().split(QRegExp("\\s*[,\r\n]+\\s*"), Qt::SkipEmptyParts); +#endif safeURLS += settingsSafeURLS; // END PULL SAFEURLS FROM INTERFACE.JSON Settings @@ -8843,19 +8851,31 @@ void Application::initPlugins(const QStringList& arguments) { parser.parse(arguments); if (parser.isSet(display)) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + auto preferredDisplays = parser.value(display).split(',', QString::SkipEmptyParts); +#else auto preferredDisplays = parser.value(display).split(',', Qt::SkipEmptyParts); +#endif qInfo() << "Setting prefered display plugins:" << preferredDisplays; PluginManager::getInstance()->setPreferredDisplayPlugins(preferredDisplays); } if (parser.isSet(disableDisplays)) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + auto disabledDisplays = parser.value(disableDisplays).split(',', QString::SkipEmptyParts); +#else auto disabledDisplays = parser.value(disableDisplays).split(',', Qt::SkipEmptyParts); +#endif qInfo() << "Disabling following display plugins:" << disabledDisplays; PluginManager::getInstance()->disableDisplays(disabledDisplays); } if (parser.isSet(disableInputs)) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + auto disabledInputs = parser.value(disableInputs).split(',', QString::SkipEmptyParts); +#else auto disabledInputs = parser.value(disableInputs).split(',', Qt::SkipEmptyParts); +#endif qInfo() << "Disabling following input plugins:" << disabledInputs; PluginManager::getInstance()->disableInputs(disabledInputs); } diff --git a/interface/src/Application.h b/interface/src/Application.h index 215473ddfbc..0a7d9faebfe 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -648,7 +648,11 @@ private slots: EntityTreePointer _entityClipboard; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + mutable QMutex _viewMutex { QMutex::Recursive }; +#else mutable QRecursiveMutex _viewMutex; +#endif ViewFrustum _viewFrustum; // current state of view frustum, perspective, orientation, etc. ViewFrustum _displayViewFrustum; @@ -774,7 +778,11 @@ private slots: bool _isMissingSequenceNumbers { false }; void checkChangeCursor(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + mutable QMutex _changeCursorLock { QMutex::Recursive }; +#else mutable QRecursiveMutex _changeCursorLock; +#endif Qt::CursorShape _desiredCursor{ Qt::BlankCursor }; bool _cursorNeedsChanging { false }; diff --git a/interface/src/avatar/MyHead.h b/interface/src/avatar/MyHead.h index 31543ccf5cc..c39d600e11a 100644 --- a/interface/src/avatar/MyHead.h +++ b/interface/src/avatar/MyHead.h @@ -22,7 +22,12 @@ class MyHead : public Head { void simulate(float deltaTime) override; private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + MyHead(const Head&); + MyHead& operator= (const MyHead&); +#else Q_DISABLE_COPY(MyHead) +#endif }; #endif // hifi_MyHead_h diff --git a/interface/src/graphics/GraphicsEngine.h b/interface/src/graphics/GraphicsEngine.h index a5e9286bc7c..a1064925161 100644 --- a/interface/src/graphics/GraphicsEngine.h +++ b/interface/src/graphics/GraphicsEngine.h @@ -69,7 +69,11 @@ class GraphicsEngine { protected: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + mutable QMutex _renderArgsMutex{ QMutex::Recursive }; +#else mutable QRecursiveMutex _renderArgsMutex; +#endif AppRenderArgs _appRenderArgs; RateCounter<500> _renderLoopCounter; diff --git a/interface/src/ui/overlays/Overlays.h b/interface/src/ui/overlays/Overlays.h index e59880c6d98..94132ad554a 100644 --- a/interface/src/ui/overlays/Overlays.h +++ b/interface/src/ui/overlays/Overlays.h @@ -746,7 +746,11 @@ public slots: private: void cleanupOverlaysToDelete(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + mutable QMutex _mutex { QMutex::Recursive }; +#else mutable QRecursiveMutex _mutex; +#endif QMap _overlays; QList _overlaysToDelete; diff --git a/libraries/animation/src/AnimNodeLoader.h b/libraries/animation/src/AnimNodeLoader.h index ac27402cf71..537735789a6 100644 --- a/libraries/animation/src/AnimNodeLoader.h +++ b/libraries/animation/src/AnimNodeLoader.h @@ -45,7 +45,12 @@ protected slots: QSharedPointer _resource; private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + AnimNodeLoader(const AnimNodeLoader&) = delete; + AnimNodeLoader& operator=(const AnimNodeLoader&) = delete; +#else Q_DISABLE_COPY(AnimNodeLoader) +#endif }; #endif // hifi_AnimNodeLoader diff --git a/libraries/animation/src/AnimRandomSwitch.h b/libraries/animation/src/AnimRandomSwitch.h index a047be732dc..65cfb75afe5 100644 --- a/libraries/animation/src/AnimRandomSwitch.h +++ b/libraries/animation/src/AnimRandomSwitch.h @@ -120,7 +120,12 @@ class AnimRandomSwitch : public AnimNode { std::vector _transitions; private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + RandomSwitchState(const RandomSwitchState&) = delete; + RandomSwitchState& operator=(const RandomSwitchState&) = delete; +#else Q_DISABLE_COPY(RandomSwitchState) +#endif }; public: @@ -179,7 +184,12 @@ class AnimRandomSwitch : public AnimNode { QString _lastPlayedState; private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + AnimRandomSwitch(const AnimRandomSwitch&) = delete; + AnimRandomSwitch& operator=(const AnimRandomSwitch&) = delete; +#else Q_DISABLE_COPY(AnimRandomSwitch) +#endif }; #endif // hifi_AnimRandomSwitch_h diff --git a/libraries/animation/src/AnimStateMachine.h b/libraries/animation/src/AnimStateMachine.h index 0a34fc4ebcb..b8991f41787 100644 --- a/libraries/animation/src/AnimStateMachine.h +++ b/libraries/animation/src/AnimStateMachine.h @@ -107,7 +107,12 @@ class AnimStateMachine : public AnimNode { std::vector _transitions; private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + State(const State&) = delete; + State& operator=(const State&) = delete; +#else Q_DISABLE_COPY(State) +#endif }; public: @@ -150,7 +155,12 @@ class AnimStateMachine : public AnimNode { QString _currentStateVar; private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + AnimStateMachine(const AnimStateMachine&) = delete; + AnimStateMachine& operator=(const AnimStateMachine&) = delete; +#else Q_DISABLE_COPY(AnimStateMachine) +#endif }; #endif // hifi_AnimStateMachine_h diff --git a/libraries/audio/src/AudioInjectorManager.h b/libraries/audio/src/AudioInjectorManager.h index 8fac2b37f25..cf8aa4e6748 100644 --- a/libraries/audio/src/AudioInjectorManager.h +++ b/libraries/audio/src/AudioInjectorManager.h @@ -72,7 +72,12 @@ private slots: bool wouldExceedLimits(); AudioInjectorManager() { createThread(); } +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + AudioInjectorManager(const AudioInjectorManager&) = delete; + AudioInjectorManager& operator=(const AudioInjectorManager&) = delete; +#else Q_DISABLE_COPY(AudioInjectorManager) +#endif void createThread(); diff --git a/libraries/audio/src/InjectedAudioStream.h b/libraries/audio/src/InjectedAudioStream.h index 467c499fa61..421a993ca7b 100644 --- a/libraries/audio/src/InjectedAudioStream.h +++ b/libraries/audio/src/InjectedAudioStream.h @@ -28,7 +28,12 @@ class InjectedAudioStream : public PositionalAudioStream { virtual const QUuid& getStreamIdentifier() const override { return _streamIdentifier; } private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + InjectedAudioStream(const InjectedAudioStream&); + InjectedAudioStream& operator= (const InjectedAudioStream&); +#else Q_DISABLE_COPY(InjectedAudioStream) +#endif AudioStreamStats getAudioStreamStats() const override; int parseStreamProperties(PacketType type, const QByteArray& packetAfterSeqNum, int& numAudioSamples) override; diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h old mode 100755 new mode 100644 index 70f20caa26f..a791e46132b --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -1887,7 +1887,12 @@ public slots: virtual void clearAvatarGrabData(const QUuid& grabID); private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + AvatarData(const AvatarData&); + AvatarData& operator= (const AvatarData&); +#else Q_DISABLE_COPY(AvatarData) +#endif friend void avatarStateFromFrame(const QByteArray& frameData, AvatarData* _avatar); static QUrl _defaultFullAvatarModelUrl; diff --git a/libraries/avatars/src/HeadData.h b/libraries/avatars/src/HeadData.h index 3ab756ce425..94b3ea04f81 100644 --- a/libraries/avatars/src/HeadData.h +++ b/libraries/avatars/src/HeadData.h @@ -128,7 +128,12 @@ class HeadData { AvatarData* _owningAvatar; private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + HeadData(const HeadData&); + HeadData& operator= (const HeadData&); +#else Q_DISABLE_COPY(HeadData) +#endif void setHeadOrientation(const glm::quat& orientation); }; diff --git a/libraries/controllers/src/controllers/UserInputMapper.cpp b/libraries/controllers/src/controllers/UserInputMapper.cpp old mode 100755 new mode 100644 index 6a46dea7d94..573a4e9a734 --- a/libraries/controllers/src/controllers/UserInputMapper.cpp +++ b/libraries/controllers/src/controllers/UserInputMapper.cpp @@ -738,7 +738,11 @@ Mapping::Pointer UserInputMapper::newMapping(const QString& mappingName) { // if (request->getResult() == ResourceRequest::Success) { // result = parseMapping(QString(request->getData())); // } else { +// #if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) +// qCWarning(controllers) << "Failed to load mapping url <" << jsonUrl << ">" << endl; +// #else // qCWarning(controllers) << "Failed to load mapping url <" << jsonUrl << ">" << Qt::endl; +// #endif // } // request->deleteLater(); // } @@ -1177,13 +1181,22 @@ Mapping::Pointer UserInputMapper::parseMapping(const QString& json) { if (doc.isNull()) { qCDebug(controllers) << "Invalid JSON...\n"; qCDebug(controllers) << error.errorString(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + qCDebug(controllers) << "JSON was:\n" << json << endl; +#else qCDebug(controllers) << "JSON was:\n" << json << Qt::endl; +#endif return Mapping::Pointer(); } if (!doc.isObject()) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + qWarning() << "Mapping json Document is not an object" << endl; + qCDebug(controllers) << "JSON was:\n" << json << endl; +#else qWarning() << "Mapping json Document is not an object" << Qt::endl; qCDebug(controllers) << "JSON was:\n" << json << Qt::endl; +#endif return Mapping::Pointer(); } return parseMapping(doc.object()); diff --git a/libraries/display-plugins/src/display-plugins/CompositorHelper.h b/libraries/display-plugins/src/display-plugins/CompositorHelper.h index 389d49929e5..5e05b8a0905 100644 --- a/libraries/display-plugins/src/display-plugins/CompositorHelper.h +++ b/libraries/display-plugins/src/display-plugins/CompositorHelper.h @@ -161,7 +161,11 @@ protected slots: // application specific position, when it's in desktop mode, the reticle position will simply move // the system mouse. glm::vec2 _reticlePositionInHMD { 0.0f, 0.0f }; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + mutable QMutex _reticleLock { QMutex::Recursive }; +#else mutable QRecursiveMutex _reticleLock; +#endif QPointF _lastKnownRealMouse; bool _ignoreMouseMove { false }; diff --git a/libraries/embedded-webserver/src/HTTPConnection.cpp b/libraries/embedded-webserver/src/HTTPConnection.cpp index a386fc7535b..5cdb20bbd7c 100644 --- a/libraries/embedded-webserver/src/HTTPConnection.cpp +++ b/libraries/embedded-webserver/src/HTTPConnection.cpp @@ -124,9 +124,15 @@ HTTPConnection::HTTPConnection(QTcpSocket* socket, HTTPManager* parentManager) : _socket->setParent(this); // connect initial slots +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + connect(socket, SIGNAL(readyRead()), SLOT(readRequest())); + connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(deleteLater())); + connect(socket, SIGNAL(disconnected()), SLOT(deleteLater())); +#else connect(socket, &QAbstractSocket::readyRead, this, &HTTPConnection::readRequest); connect(socket, &QAbstractSocket::errorOccurred, this, &HTTPConnection::deleteLater); connect(socket, &QAbstractSocket::disconnected, this, &HTTPConnection::deleteLater); +#endif } HTTPConnection::~HTTPConnection() { diff --git a/libraries/entities/src/EntitySimulation.h b/libraries/entities/src/EntitySimulation.h index 5d5f4741d3f..f4b290e5c00 100644 --- a/libraries/entities/src/EntitySimulation.h +++ b/libraries/entities/src/EntitySimulation.h @@ -44,7 +44,11 @@ const int DIRTY_SIMULATION_FLAGS = class EntitySimulation : public QObject, public std::enable_shared_from_this { public: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + EntitySimulation() : _mutex(QMutex::Recursive), _nextExpiry(std::numeric_limits::max()), _entityTree(nullptr) { } +#else EntitySimulation() : _mutex(), _nextExpiry(std::numeric_limits::max()), _entityTree(nullptr) { } +#endif virtual ~EntitySimulation() { setEntityTree(nullptr); } inline EntitySimulationPointer getThisPointer() const { @@ -90,7 +94,11 @@ class EntitySimulation : public QObject, public std::enable_shared_from_thismeshes.toStdVector(); +#else output.edit0() = std::vector(hfmModelIn->meshes.begin(), hfmModelIn->meshes.end()); +#endif output.edit1() = hfmModelIn->originalURL; output.edit2() = hfmModelIn->meshIndicesToModelNames; auto& blendshapesPerMesh = output.edit3(); blendshapesPerMesh.reserve(hfmModelIn->meshes.size()); for (int i = 0; i < hfmModelIn->meshes.size(); i++) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + blendshapesPerMesh.push_back(hfmModelIn->meshes[i].blendshapes.toStdVector()); +#else auto &blendshapes = hfmModelIn->meshes[i].blendshapes; blendshapesPerMesh.push_back(std::vector(blendshapes.begin(), blendshapes.end())); +#endif } +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + output.edit4() = hfmModelIn->joints.toStdVector(); +#else output.edit4() = std::vector(hfmModelIn->joints.begin(), hfmModelIn->joints.end()); +#endif } }; @@ -67,8 +79,13 @@ namespace baker { const auto& normals = safeGet(normalsPerBlendshape, j); const auto& tangents = safeGet(tangentsPerBlendshape, j); auto& blendshape = blendshapesOut[j]; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + blendshape.normals = QVector::fromStdVector(normals); + blendshape.tangents = QVector::fromStdVector(tangents); +#else blendshape.normals = QVector(normals.begin(), normals.end()); blendshape.tangents = QVector(tangents.begin(), tangents.end()); +#endif } } } @@ -92,6 +109,11 @@ namespace baker { for (int i = 0; i < numMeshes; i++) { auto& meshOut = meshesOut[i]; meshOut._mesh = safeGet(graphicsMeshesIn, i); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + meshOut.normals = QVector::fromStdVector(safeGet(normalsPerMeshIn, i)); + meshOut.tangents = QVector::fromStdVector(safeGet(tangentsPerMeshIn, i)); + meshOut.blendshapes = QVector::fromStdVector(safeGet(blendshapesPerMeshIn, i)); +#else auto stdNormals = safeGet(normalsPerMeshIn, i); auto stdTangents = safeGet(tangentsPerMeshIn, i); auto stdBlendshapes = safeGet(blendshapesPerMeshIn, i); @@ -99,6 +121,7 @@ namespace baker { meshOut.normals = QVector(stdNormals.begin(), stdNormals.end()); meshOut.tangents = QVector(stdTangents.begin(), stdTangents.end()); meshOut.blendshapes = QVector(stdBlendshapes.begin(), stdBlendshapes.end()); +#endif } output = meshesOut; } @@ -112,10 +135,15 @@ namespace baker { void run(const BakeContextPointer& context, const Input& input, Output& output) { auto hfmModelOut = input.get0(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + hfmModelOut->meshes = QVector::fromStdVector(input.get1()); + hfmModelOut->joints = QVector::fromStdVector(input.get2()); +#else auto stdMeshes = input.get1(); auto stdJoints = input.get2(); hfmModelOut->meshes = QVector(stdMeshes.begin(), stdMeshes.end()); hfmModelOut->joints = QVector(stdJoints.begin(), stdJoints.end()); +#endif hfmModelOut->jointRotationOffsets = input.get3(); hfmModelOut->jointIndices = input.get4(); hfmModelOut->flowData = input.get5(); diff --git a/libraries/model-baker/src/model-baker/CalculateBlendshapeNormalsTask.cpp b/libraries/model-baker/src/model-baker/CalculateBlendshapeNormalsTask.cpp index fae51a237a1..50687cc1bf0 100644 --- a/libraries/model-baker/src/model-baker/CalculateBlendshapeNormalsTask.cpp +++ b/libraries/model-baker/src/model-baker/CalculateBlendshapeNormalsTask.cpp @@ -31,7 +31,11 @@ void CalculateBlendshapeNormalsTask::run(const baker::BakeContextPointer& contex const auto& normalsIn = blendshape.normals; // Check if normals are already defined. Otherwise, calculate them from existing blendshape vertices. if (!normalsIn.empty()) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + normalsPerBlendshapeOut.push_back(normalsIn.toStdVector()); +#else normalsPerBlendshapeOut.push_back(std::vector(normalsIn.begin(), normalsIn.end())); +#endif } else { // Create lookup to get index in blendshape from vertex index in mesh std::vector reverseIndices; diff --git a/libraries/model-baker/src/model-baker/CalculateBlendshapeTangentsTask.cpp b/libraries/model-baker/src/model-baker/CalculateBlendshapeTangentsTask.cpp index 5cabdceb599..02ef181322a 100644 --- a/libraries/model-baker/src/model-baker/CalculateBlendshapeTangentsTask.cpp +++ b/libraries/model-baker/src/model-baker/CalculateBlendshapeTangentsTask.cpp @@ -38,7 +38,11 @@ void CalculateBlendshapeTangentsTask::run(const baker::BakeContextPointer& conte // Check if we already have tangents if (!tangentsIn.empty()) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + tangentsOut = tangentsIn.toStdVector(); +#else tangentsOut = std::vector(tangentsIn.begin(), tangentsIn.end()); +#endif continue; } diff --git a/libraries/model-baker/src/model-baker/CalculateMeshNormalsTask.cpp b/libraries/model-baker/src/model-baker/CalculateMeshNormalsTask.cpp index 8f7ead584dc..6b493a2f74d 100644 --- a/libraries/model-baker/src/model-baker/CalculateMeshNormalsTask.cpp +++ b/libraries/model-baker/src/model-baker/CalculateMeshNormalsTask.cpp @@ -24,7 +24,11 @@ void CalculateMeshNormalsTask::run(const baker::BakeContextPointer& context, con auto& normalsOut = normalsPerMeshOut[normalsPerMeshOut.size()-1]; // Only calculate normals if this mesh doesn't already have them if (!mesh.normals.empty()) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + normalsOut = mesh.normals.toStdVector(); +#else normalsOut = std::vector(mesh.normals.begin(), mesh.normals.end()); +#endif } else { normalsOut.resize(mesh.vertices.size()); baker::calculateNormals(mesh, diff --git a/libraries/model-baker/src/model-baker/CalculateMeshTangentsTask.cpp b/libraries/model-baker/src/model-baker/CalculateMeshTangentsTask.cpp index eb3cd1863a8..6a5b8da649d 100644 --- a/libraries/model-baker/src/model-baker/CalculateMeshTangentsTask.cpp +++ b/libraries/model-baker/src/model-baker/CalculateMeshTangentsTask.cpp @@ -29,7 +29,11 @@ void CalculateMeshTangentsTask::run(const baker::BakeContextPointer& context, co // Check if we already have tangents and therefore do not need to do any calculation // Otherwise confirm if we have the normals and texcoords needed if (!tangentsIn.empty()) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + tangentsOut = tangentsIn.toStdVector(); +#else tangentsOut = std::vector(tangentsIn.begin(), tangentsIn.end()); +#endif } else if (!normals.empty() && mesh.vertices.size() == mesh.texCoords.size()) { tangentsOut.resize(normals.size()); baker::calculateTangents(mesh, diff --git a/libraries/model-serializers/src/GLTFSerializer.cpp b/libraries/model-serializers/src/GLTFSerializer.cpp index 01de57d9809..fc239424606 100755 --- a/libraries/model-serializers/src/GLTFSerializer.cpp +++ b/libraries/model-serializers/src/GLTFSerializer.cpp @@ -815,7 +815,11 @@ void GLTFSerializer::getSkinInverseBindMatrices(std::vector>& GLTFAccessor& indicesAccessor = _file.accessors[skin.inverseBindMatrices]; QVector matrices; addArrayFromAccessor(indicesAccessor, matrices); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + inverseBindMatrixValues.push_back(matrices.toStdVector()); +#else inverseBindMatrixValues.push_back(std::vector(matrices.begin(), matrices.end())); +#endif } } diff --git a/libraries/networking/src/AccountManager.h b/libraries/networking/src/AccountManager.h index bd318e3af5b..0e318e244e0 100644 --- a/libraries/networking/src/AccountManager.h +++ b/libraries/networking/src/AccountManager.h @@ -163,7 +163,12 @@ private slots: void postAccountSettingsError(QNetworkReply::NetworkError error); private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + AccountManager(AccountManager const& other) = delete; + void operator=(AccountManager const& other) = delete; +#else Q_DISABLE_COPY(AccountManager); +#endif void persistAccountToFile(); diff --git a/libraries/networking/src/AssetResourceRequest.cpp b/libraries/networking/src/AssetResourceRequest.cpp index 5419424f46b..fb5b79ad849 100644 --- a/libraries/networking/src/AssetResourceRequest.cpp +++ b/libraries/networking/src/AssetResourceRequest.cpp @@ -59,7 +59,11 @@ void AssetResourceRequest::doSend() { // We'll either have a hash or an ATP path to a file (that maps to a hash) if (urlIsAssetHash(_url)) { // We've detected that this is a hash - simply use AssetClient to request that asset +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + auto parts = _url.path().split(".", QString::SkipEmptyParts); +#else auto parts = _url.path().split(".", Qt::SkipEmptyParts); +#endif auto hash = parts.length() > 0 ? parts[0] : ""; requestHash(hash); diff --git a/libraries/networking/src/HMACAuth.h b/libraries/networking/src/HMACAuth.h index 92953af3a3a..69eaffd52b8 100644 --- a/libraries/networking/src/HMACAuth.h +++ b/libraries/networking/src/HMACAuth.h @@ -39,7 +39,11 @@ class HMACAuth { HMACHash result(); private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + QMutex _lock { QMutex::Recursive }; +#else QRecursiveMutex _lock; +#endif struct hmac_ctx_st* _hmacContext; AuthMethod _authMethod; }; diff --git a/libraries/networking/src/LimitedNodeList.cpp b/libraries/networking/src/LimitedNodeList.cpp index 2b487b8b2c0..c2b5789bda5 100644 --- a/libraries/networking/src/LimitedNodeList.cpp +++ b/libraries/networking/src/LimitedNodeList.cpp @@ -1237,7 +1237,12 @@ void LimitedNodeList::updateLocalSocket() { QTcpSocket* localIPTestSocket = new QTcpSocket; connect(localIPTestSocket, &QTcpSocket::connected, this, &LimitedNodeList::connectedForLocalSocketTest); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + connect(localIPTestSocket, static_cast(&QTcpSocket::error), + this, &LimitedNodeList::errorTestingLocalSocket); +#else connect(localIPTestSocket, &QTcpSocket::errorOccurred, this, &LimitedNodeList::errorTestingLocalSocket); +#endif // attempt to connect to our reliable host localIPTestSocket->connectToHost(RELIABLE_LOCAL_IP_CHECK_HOST, RELIABLE_LOCAL_IP_CHECK_PORT); diff --git a/libraries/networking/src/NLPacketList.h b/libraries/networking/src/NLPacketList.h index 76939bb4a0d..f367befab5f 100644 --- a/libraries/networking/src/NLPacketList.h +++ b/libraries/networking/src/NLPacketList.h @@ -21,17 +21,25 @@ class NLPacketList : public udt::PacketList { public: static std::unique_ptr create(PacketType packetType, QByteArray extendedHeader = QByteArray(), bool isReliable = false, bool isOrdered = false); - + PacketVersion getVersion() const { return _packetVersion; } NLPacket::LocalID getSourceID() const { return _sourceID; } qint64 getMaxSegmentSize() const override { return NLPacket::maxPayloadSize(_packetType, _isOrdered); } - + private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + NLPacketList(PacketType packetType, QByteArray extendedHeader = QByteArray(), bool isReliable = false, + bool isOrdered = false); + NLPacketList(udt::PacketList&& packetList); + NLPacketList(const NLPacketList& other) = delete; + NLPacketList& operator=(const NLPacketList& other) = delete; +#else Q_DISABLE_COPY(NLPacketList) NLPacketList(PacketType packetType, QByteArray extendedHeader = QByteArray(), bool isReliable = false, bool isOrdered = false); NLPacketList(udt::PacketList&& packetList); +#endif virtual std::unique_ptr createPacket() override; diff --git a/libraries/networking/src/Node.h b/libraries/networking/src/Node.h index 70473c678cf..a463d4d513f 100644 --- a/libraries/networking/src/Node.h +++ b/libraries/networking/src/Node.h @@ -109,7 +109,12 @@ class Node : public NetworkPeer { float getOutboundKbps() const; private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + Node(const Node &otherNode); + Node& operator=(Node otherNode); +#else Q_DISABLE_COPY(Node) +#endif NodeType_t _type; diff --git a/libraries/networking/src/NodeList.h b/libraries/networking/src/NodeList.h index 5ba982aec54..fc6bd0c40d8 100644 --- a/libraries/networking/src/NodeList.h +++ b/libraries/networking/src/NodeList.h @@ -156,11 +156,20 @@ private slots: void maybeSendIgnoreSetToNode(SharedNodePointer node); private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + NodeList() : LimitedNodeList(INVALID_PORT, INVALID_PORT) { + assert(false); // Not implemented, needed for DependencyManager templates compile + } + NodeList(char ownerType, int socketListenPort = INVALID_PORT, int dtlsListenPort = INVALID_PORT); + NodeList(NodeList const&) = delete; // Don't implement, needed to avoid copies of singleton + void operator=(NodeList const&) = delete; // Don't implement, needed to avoid copies of singleton +#else Q_DISABLE_COPY(NodeList) - NodeList() : LimitedNodeList(INVALID_PORT, INVALID_PORT) { + NodeList() : LimitedNodeList(INVALID_PORT, INVALID_PORT) { assert(false); // Not implemented, needed for DependencyManager templates compile } NodeList(char ownerType, int socketListenPort = INVALID_PORT, int dtlsListenPort = INVALID_PORT); +#endif void processDomainServerAuthRequest(const QByteArray& packet); void requestAuthForDomainServer(); diff --git a/libraries/networking/src/udt/CongestionControl.h b/libraries/networking/src/udt/CongestionControl.h index f52e6461243..8c2ea3ae6a4 100644 --- a/libraries/networking/src/udt/CongestionControl.h +++ b/libraries/networking/src/udt/CongestionControl.h @@ -54,24 +54,29 @@ class CongestionControl { virtual void setInitialSendSequenceNumber(SequenceNumber seqNum) = 0; void setSendCurrentSequenceNumber(SequenceNumber seqNum) { _sendCurrSeqNum = seqNum; } void setPacketSendPeriod(double newSendPeriod); // call this internally to ensure send period doesn't go past max bandwidth - + double _packetSendPeriod { 1.0 }; // Packet sending period, in microseconds int _congestionWindowSize { 16 }; // Congestion window size, in packets std::atomic _maxBandwidth { -1 }; // Maximum desired bandwidth, bits per second - + int _mss { 0 }; // Maximum Packet Size, including all packet headers SequenceNumber _sendCurrSeqNum; // current maximum seq num sent out - + private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + CongestionControl(const CongestionControl& other) = delete; + CongestionControl& operator=(const CongestionControl& other) = delete; +#else Q_DISABLE_COPY(CongestionControl); +#endif }; - - + + class CongestionControlVirtualFactory { public: virtual ~CongestionControlVirtualFactory() {} - + virtual std::unique_ptr create() = 0; }; diff --git a/libraries/networking/src/udt/ControlPacket.h b/libraries/networking/src/udt/ControlPacket.h index d47f05062b7..ccc1afaf368 100644 --- a/libraries/networking/src/udt/ControlPacket.h +++ b/libraries/networking/src/udt/ControlPacket.h @@ -43,25 +43,35 @@ class ControlPacket : public BasePacket { static int totalHeaderSize(); // The maximum payload size this packet can use to fit in MTU static int maxPayloadSize(); - + Type getType() const { return _type; } void setType(Type type); - + private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + ControlPacket(Type type, qint64 size = -1); + ControlPacket(std::unique_ptr data, qint64 size, const SockAddr& senderSockAddr); + ControlPacket(ControlPacket&& other); + ControlPacket(const ControlPacket& other) = delete; + + ControlPacket& operator=(ControlPacket&& other); + ControlPacket& operator=(const ControlPacket& other) = delete; +#else Q_DISABLE_COPY(ControlPacket) ControlPacket(Type type, qint64 size = -1); ControlPacket(std::unique_ptr data, qint64 size, const SockAddr& senderSockAddr); ControlPacket(ControlPacket&& other); - + ControlPacket& operator=(ControlPacket&& other); - +#endif + // Header read/write void readType(); void writeType(); - + Type _type; }; - + } // namespace udt diff --git a/libraries/networking/src/udt/PacketList.h b/libraries/networking/src/udt/PacketList.h index f8e3c54d047..379ab97332c 100644 --- a/libraries/networking/src/udt/PacketList.h +++ b/libraries/networking/src/udt/PacketList.h @@ -30,88 +30,93 @@ class PacketList : public ExtendedIODevice { public: using MessageNumber = uint32_t; using PacketPointer = std::unique_ptr; - + static std::unique_ptr create(PacketType packetType, QByteArray extendedHeader = QByteArray(), bool isReliable = false, bool isOrdered = false); static std::unique_ptr fromReceivedPackets(std::list>&& packets); - + PacketType getType() const { return _packetType; } bool isReliable() const { return _isReliable; } bool isOrdered() const { return _isOrdered; } - + size_t getNumPackets() const { return _packets.size() + (_currentPacket ? 1 : 0); } size_t getDataSize() const; size_t getMessageSize() const; QByteArray getMessage() const; - + QByteArray getExtendedHeader() const { return _extendedHeader; } - + void startSegment(); void endSegment(); virtual qint64 getMaxSegmentSize() const { return Packet::maxPayloadSize(_isOrdered); } SockAddr getSenderSockAddr() const; - + void closeCurrentPacket(bool shouldSendEmpty = false); // QIODevice virtual functions virtual bool isSequential() const override { return false; } virtual qint64 size() const override { return getDataSize(); } - + qint64 writeString(const QString& string); p_high_resolution_clock::time_point getFirstPacketReceiveTime() const; - - + + protected: PacketList(PacketType packetType, QByteArray extendedHeader = QByteArray(), bool isReliable = false, bool isOrdered = false); PacketList(PacketList&& other); - + void preparePackets(MessageNumber messageNumber); virtual qint64 writeData(const char* data, qint64 maxSize) override; // Not implemented, added an assert so that it doesn't get used by accident virtual qint64 readData(char* data, qint64 maxSize) override { Q_ASSERT(false); return 0; } - + PacketType _packetType; std::list> _packets; bool _isOrdered = false; - + private: friend class ::LimitedNodeList; friend class PacketQueue; friend class SendQueue; friend class Socket; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + PacketList(const PacketList& other) = delete; + PacketList& operator=(const PacketList& other) = delete; +#else Q_DISABLE_COPY(PacketList) - +#endif + // Takes the first packet of the list and returns it. template std::unique_ptr takeFront(); - + // Creates a new packet, can be overriden to change return underlying type virtual std::unique_ptr createPacket(); std::unique_ptr createPacketWithExtendedHeader(); - + Packet::MessageNumber _messageNumber; bool _isReliable = false; - + std::unique_ptr _currentPacket; - + int _segmentStartIndex = -1; - + QByteArray _extendedHeader; }; template std::unique_ptr PacketList::takeFront() { static_assert(std::is_base_of::value, "T must derive from Packet."); - + auto packet = std::move(_packets.front()); _packets.pop_front(); return std::unique_ptr(dynamic_cast(packet.release())); } - + } Q_DECLARE_METATYPE(udt::PacketList*); diff --git a/libraries/networking/src/udt/SendQueue.h b/libraries/networking/src/udt/SendQueue.h index bd75cbbb7fc..20de294d8ac 100644 --- a/libraries/networking/src/udt/SendQueue.h +++ b/libraries/networking/src/udt/SendQueue.h @@ -81,63 +81,68 @@ public slots: signals: void packetSent(int wireSize, int payloadSize, SequenceNumber seqNum, p_high_resolution_clock::time_point timePoint); void packetRetransmitted(int wireSize, int payloadSize, SequenceNumber seqNum, p_high_resolution_clock::time_point timePoint); - + void queueInactive(); void timeout(); - + private slots: void run(); - + private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + SendQueue(SendQueue& other) = delete; + SendQueue(SendQueue&& other) = delete; +#else Q_DISABLE_COPY_MOVE(SendQueue) +#endif SendQueue(Socket* socket, SockAddr dest, SequenceNumber currentSequenceNumber, MessageNumber currentMessageNumber, bool hasReceivedHandshakeACK); - + void sendHandshake(); - + int sendPacket(const Packet& packet); bool sendNewPacketAndAddToSentList(std::unique_ptr newPacket, SequenceNumber sequenceNumber); - + int maybeSendNewPacket(); // Figures out what packet to send next bool maybeResendPacket(); // Determines whether to resend a packet and which one - + bool isInactive(bool attemptedToSendPacket); void deactivate(); // makes the queue inactive and cleans it up bool isFlowWindowFull() const; - + // Increments current sequence number and return it SequenceNumber getNextSequenceNumber(); - + PacketQueue _packets; - + Socket* _socket { nullptr }; // Socket to send packet on SockAddr _destination; // Destination addr - + std::atomic _lastACKSequenceNumber { 0 }; // Last ACKed sequence number - + SequenceNumber _currentSequenceNumber { 0 }; // Last sequence number sent out std::atomic _atomicCurrentSequenceNumber { 0 }; // Atomic for last sequence number sent out - + std::atomic _packetSendPeriod { 0 }; // Interval between two packet send event in microseconds, set from CC std::atomic _state { State::NotStarted }; - + std::atomic _estimatedTimeout { 0 }; // Estimated timeout, set from CC - + std::atomic _flowWindowSize { 0 }; // Flow control window size (number of packets that can be on wire) - set from CC - + mutable std::mutex _naksLock; // Protects the naks list. LossList _naks; // Sequence numbers of packets to resend - + mutable QReadWriteLock _sentLock; // Protects the sent packet list using PacketResendPair = std::pair>; // Number of resend + packet ptr std::unordered_map _sentPackets; // Packets waiting for ACK. - + std::mutex _handshakeMutex; // Protects the handshake ACK condition_variable std::atomic _hasReceivedHandshakeACK { false }; // flag for receipt of handshake ACK from client std::condition_variable _handshakeACKCondition; - + std::condition_variable_any _emptyCondition; std::chrono::high_resolution_clock::time_point _lastPacketSentAt; diff --git a/libraries/octree/src/OctreeEditPacketSender.h b/libraries/octree/src/OctreeEditPacketSender.h index ee1849ec312..40e1a3bb584 100644 --- a/libraries/octree/src/OctreeEditPacketSender.h +++ b/libraries/octree/src/OctreeEditPacketSender.h @@ -93,7 +93,11 @@ public slots: int _maxPendingMessages; bool _releaseQueuedMessagesPending; QMutex _pendingPacketsLock; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + QMutex _packetsQueueLock{ QMutex::Recursive }; +#else QRecursiveMutex _packetsQueueLock; // don't let different threads release the queue while another thread is writing to it +#endif std::list _preServerEdits; // these will get packed into other larger packets std::list> _preServerSingleMessagePackets; // these will go out as is diff --git a/libraries/physics/src/PhysicalEntitySimulation.h b/libraries/physics/src/PhysicalEntitySimulation.h index 1e8c65c6395..0fb3f4b2db9 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.h +++ b/libraries/physics/src/PhysicalEntitySimulation.h @@ -129,7 +129,11 @@ class PhysicalEntitySimulation : public EntitySimulation { QList _dynamicsToAdd; QSet _dynamicsToRemove; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + QMutex _dynamicsMutex { QMutex::Recursive }; +#else QRecursiveMutex _dynamicsMutex; +#endif workload::SpacePointer _space; uint64_t _nextBidExpiry; diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 22b8c757bbb..3b88c800b9d 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -1637,7 +1637,11 @@ std::set Model::getMeshIDsFromMaterialID(QString parentMaterialNam }; if (parentMaterialName.length() > 2 && parentMaterialName.startsWith("[") && parentMaterialName.endsWith("]")) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + QStringList list = parentMaterialName.split(",", QString::SkipEmptyParts); +#else QStringList list = parentMaterialName.split(",", Qt::SkipEmptyParts); +#endif for (int i = 0; i < list.length(); i++) { auto& target = list[i]; if (i == 0) { diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index af477a2f09c..e39a33f8d78 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -444,7 +444,11 @@ public slots: QVector _blendedBlendshapeCoefficients; int _blendNumber { 0 }; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + mutable QMutex _mutex{ QMutex::Recursive }; +#else mutable QRecursiveMutex _mutex; +#endif bool _overrideModelTransform { false }; bool _triangleSetsValid { false }; diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index c1578265e3a..cae491ae488 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -187,7 +187,11 @@ void inputControllerFromScriptValue(const QScriptValue &object, controller::Inpu // // Extract the url portion of a url that has been encoded with encodeEntityIdIntoEntityUrl(...) QString extractUrlFromEntityUrl(const QString& url) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + auto parts = url.split(' ', QString::SkipEmptyParts); +#else auto parts = url.split(' ', Qt::SkipEmptyParts); +#endif if (parts.length() > 0) { return parts[0]; } else { @@ -2386,29 +2390,37 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co bool passList = false; // assume unsafe QString whitelistPrefix = "[WHITELIST ENTITY SCRIPTS]"; QList safeURLPrefixes = { "file:///", "atp:", "cache:" }; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + safeURLPrefixes += qEnvironmentVariable("EXTRA_WHITELIST").trimmed().split(QRegExp("\\s*,\\s*"), QString::SkipEmptyParts); +#else safeURLPrefixes += qEnvironmentVariable("EXTRA_WHITELIST").trimmed().split(QRegExp("\\s*,\\s*"), Qt::SkipEmptyParts); +#endif // Entity Script Whitelist toggle check. Setting::Handle whitelistEnabled {"private/whitelistEnabled", false }; - + if (!whitelistEnabled.get()) { passList = true; } - + // Pull SAFEURLS from the Interface.JSON settings. QVariant raw = Setting::Handle("private/settingsSafeURLS").get(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + QStringList settingsSafeURLS = raw.toString().trimmed().split(QRegExp("\\s*[,\r\n]+\\s*"), QString::SkipEmptyParts); +#else QStringList settingsSafeURLS = raw.toString().trimmed().split(QRegExp("\\s*[,\r\n]+\\s*"), Qt::SkipEmptyParts); +#endif safeURLPrefixes += settingsSafeURLS; // END Pull SAFEURLS from the Interface.JSON settings. - + // Get current domain whitelist bypass, in case an entire domain is whitelisted. QString currentDomain = DependencyManager::get()->getDomainURL().host(); - + QString domainSafeIP = nodeList->getDomainHandler().getHostname(); QString domainSafeURL = URL_SCHEME_VIRCADIA + "://" + currentDomain; for (const auto& str : safeURLPrefixes) { if (domainSafeURL.startsWith(str) || domainSafeIP.startsWith(str)) { - qCDebug(scriptengine) << whitelistPrefix << "Whitelist Bypassed, entire domain is whitelisted. Current Domain Host: " + qCDebug(scriptengine) << whitelistPrefix << "Whitelist Bypassed, entire domain is whitelisted. Current Domain Host: " << nodeList->getDomainHandler().getHostname() << "Current Domain: " << currentDomain; passList = true; diff --git a/libraries/shared/src/DependencyManager.h b/libraries/shared/src/DependencyManager.h index eda8b60e9f8..79ba32db1e7 100644 --- a/libraries/shared/src/DependencyManager.h +++ b/libraries/shared/src/DependencyManager.h @@ -89,7 +89,11 @@ class DependencyManager { QHash> _instanceHash; QHash _inheritanceHash; +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + mutable QMutex _instanceHashMutex { QMutex::Recursive }; +#else mutable QRecursiveMutex _instanceHashMutex; +#endif mutable QMutex _inheritanceHashMutex; bool _exiting { false }; diff --git a/libraries/shared/src/shared/FileUtils.cpp b/libraries/shared/src/shared/FileUtils.cpp index 14ac78bfbd9..c23a262f681 100644 --- a/libraries/shared/src/shared/FileUtils.cpp +++ b/libraries/shared/src/shared/FileUtils.cpp @@ -67,9 +67,15 @@ QString FileUtils::readFile(const QString& filename) { return result; } +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) +QStringList FileUtils::readLines(const QString& filename, QString::SplitBehavior splitBehavior) { + return readFile(filename).split(QRegularExpression("[\\r\\n]"), QString::SkipEmptyParts); +} +#else QStringList FileUtils::readLines(const QString& filename, Qt::SplitBehavior splitBehavior) { return readFile(filename).split(QRegularExpression("[\\r\\n]"), Qt::SkipEmptyParts); } +#endif void FileUtils::locateFile(const QString& filePath) { diff --git a/libraries/shared/src/shared/FileUtils.h b/libraries/shared/src/shared/FileUtils.h index 5b3b9377ac2..9c0237456c9 100644 --- a/libraries/shared/src/shared/FileUtils.h +++ b/libraries/shared/src/shared/FileUtils.h @@ -24,7 +24,11 @@ class FileUtils { static bool isRelative(const QString& fileName); static QString standardPath(QString subfolder); static QString readFile(const QString& filename); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + static QStringList readLines(const QString& filename, QString::SplitBehavior splitBehavior = QString::KeepEmptyParts); +#else static QStringList readLines(const QString& filename, Qt::SplitBehavior splitBehavior = Qt::KeepEmptyParts); +#endif static QString replaceDateTimeTokens(const QString& path); static QString computeDocumentPath(const QString& path); static bool canCreateFile(const QString& fullPath); diff --git a/libraries/ui/src/VrMenu.cpp b/libraries/ui/src/VrMenu.cpp index 8003337eac6..f7a2132aeac 100644 --- a/libraries/ui/src/VrMenu.cpp +++ b/libraries/ui/src/VrMenu.cpp @@ -141,7 +141,11 @@ class MenuUserData : public QObjectUserData { } private: +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + MenuUserData(const MenuUserData&); +#else Q_DISABLE_COPY(MenuUserData); +#endif QMetaObject::Connection _shutdownConnection; QMetaObject::Connection _changedConnection; diff --git a/tools/ac-client/src/ACClientApp.cpp b/tools/ac-client/src/ACClientApp.cpp index 3b6e36b63ea..a709b150be4 100644 --- a/tools/ac-client/src/ACClientApp.cpp +++ b/tools/ac-client/src/ACClientApp.cpp @@ -49,7 +49,11 @@ ACClientApp::ACClientApp(int argc, char* argv[]) : parser.addOption(listenPortOption); if (!parser.parse(QCoreApplication::arguments())) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + qCritical() << parser.errorText() << endl; +#else qCritical() << parser.errorText() << Qt::endl; +#endif parser.showHelp(); Q_UNREACHABLE(); } diff --git a/tools/atp-client/src/ATPClientApp.cpp b/tools/atp-client/src/ATPClientApp.cpp index a4b95432577..8682a77edad 100644 --- a/tools/atp-client/src/ATPClientApp.cpp +++ b/tools/atp-client/src/ATPClientApp.cpp @@ -59,7 +59,11 @@ ATPClientApp::ATPClientApp(int argc, char* argv[]) : parser.addOption(listenPortOption); if (!parser.parse(QCoreApplication::arguments())) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + qCritical() << parser.errorText() << endl; +#else qCritical() << parser.errorText() << Qt::endl; +#endif parser.showHelp(); Q_UNREACHABLE(); } diff --git a/tools/ice-client/src/ICEClientApp.cpp b/tools/ice-client/src/ICEClientApp.cpp index b10ef46b628..6e842c79793 100644 --- a/tools/ice-client/src/ICEClientApp.cpp +++ b/tools/ice-client/src/ICEClientApp.cpp @@ -47,7 +47,11 @@ ICEClientApp::ICEClientApp(int argc, char* argv[]) : parser.addOption(cacheSTUNOption); if (!parser.parse(QCoreApplication::arguments())) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + qCritical() << parser.errorText() << endl; +#else qCritical() << parser.errorText() << Qt::endl; +#endif parser.showHelp(); Q_UNREACHABLE(); } diff --git a/tools/nitpick/src/TestCreator.cpp b/tools/nitpick/src/TestCreator.cpp index baecb3e1738..d3cdb0a6868 100644 --- a/tools/nitpick/src/TestCreator.cpp +++ b/tools/nitpick/src/TestCreator.cpp @@ -207,11 +207,20 @@ void TestCreator::appendTestResultsToFile(const TestResult& testResult, const QP // Create text file describing the failure QTextStream stream(&descriptionFile); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + stream << "TestCreator in folder " << testResult._pathname.left(testResult._pathname.length() - 1) << endl; // remove trailing '/' + stream << "Expected image was " << testResult._expectedImageFilename << endl; + stream << "Actual image was " << testResult._actualImageFilename << endl; + stream << "Similarity index was " << testResult._errorGlobal << endl; + stream << "Worst tile was " << testResult._errorLocal << endl; +#else stream << "TestCreator in folder " << testResult._pathname.left(testResult._pathname.length() - 1) << Qt::endl; // remove trailing '/' stream << "Expected image was " << testResult._expectedImageFilename << Qt::endl; stream << "Actual image was " << testResult._actualImageFilename << Qt::endl; stream << "Similarity index was " << testResult._errorGlobal << Qt::endl; stream << "Worst tile was " << testResult._errorLocal << Qt::endl; +#endif + descriptionFile.close(); @@ -415,7 +424,11 @@ void TestCreator::includeTest(QTextStream& textStream, const QString& testPathna QString partialPath = extractPathFromTestsDown(testPathname); QString partialPathWithoutTests = partialPath.right(partialPath.length() - 7); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + textStream << "Script.include(testsRootPath + \"" << partialPathWithoutTests + "\");" << endl; +#else textStream << "Script.include(testsRootPath + \"" << partialPathWithoutTests + "\");" << Qt::endl; +#endif } void TestCreator::createTests(const QString& clientProfile) { @@ -994,12 +1007,45 @@ void TestCreator::createRecursiveScript(const QString& directory, bool interacti QTextStream textStream(&recursiveTestsFile); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + textStream << "// This is an automatically generated file, created by nitpick" << endl; +#else textStream << "// This is an automatically generated file, created by nitpick" << Qt::endl; +#endif // Include 'nitpick.js' QString branch = nitpick->getSelectedBranch(); QString user = nitpick->getSelectedUser(); +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + textStream << "PATH_TO_THE_REPO_PATH_UTILS_FILE = \"https://raw.githubusercontent.com/" + user + "/hifi_tests/" + branch + + "/tests/utils/branchUtils.js\";" + << endl; + textStream << "Script.include(PATH_TO_THE_REPO_PATH_UTILS_FILE);" << endl << endl; + + // The 'depth' variable is used to signal when to start running the recursive scripts + textStream << "if (typeof depth === 'undefined') {" << endl; + textStream << " depth = 0;" << endl; + textStream << " nitpick = createNitpick(Script.resolvePath(\".\"));" << endl; + textStream << " testsRootPath = nitpick.getTestsRootPath();" << endl << endl; + textStream << " nitpick.enableRecursive();" << endl; + textStream << " nitpick.enableAuto();" << endl; + textStream << "} else {" << endl; + textStream << " depth++" << endl; + textStream << "}" << endl << endl; + + // Now include the test scripts + for (int i = 0; i < directories.length(); ++i) { + includeTest(textStream, directories.at(i)); + } + + textStream << endl; + textStream << "if (depth > 0) {" << endl; + textStream << " depth--;" << endl; + textStream << "} else {" << endl; + textStream << " nitpick.runRecursive();" << endl; + textStream << "}" << endl << endl; +#else textStream << "PATH_TO_THE_REPO_PATH_UTILS_FILE = \"https://raw.githubusercontent.com/" + user + "/hifi_tests/" + branch + "/tests/utils/branchUtils.js\";" << Qt::endl; @@ -1027,6 +1073,8 @@ void TestCreator::createRecursiveScript(const QString& directory, bool interacti textStream << "} else {" << Qt::endl; textStream << " nitpick.runRecursive();" << Qt::endl; textStream << "}" << Qt::endl << Qt::endl; +#endif + recursiveTestsFile.close(); } diff --git a/tools/skeleton-dump/src/SkeletonDumpApp.cpp b/tools/skeleton-dump/src/SkeletonDumpApp.cpp index a736cf60b80..7445daf2c94 100644 --- a/tools/skeleton-dump/src/SkeletonDumpApp.cpp +++ b/tools/skeleton-dump/src/SkeletonDumpApp.cpp @@ -29,7 +29,11 @@ SkeletonDumpApp::SkeletonDumpApp(int argc, char* argv[]) : QCoreApplication(argc parser.addOption(inputFilenameOption); if (!parser.parse(QCoreApplication::arguments())) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + qCritical() << parser.errorText() << endl; +#else qCritical() << parser.errorText() << Qt::endl; +#endif parser.showHelp(); _returnCode = 1; return; diff --git a/tools/vhacd-util/src/VHACDUtilApp.cpp b/tools/vhacd-util/src/VHACDUtilApp.cpp index bf97adbd92f..bc9e79c2f7b 100644 --- a/tools/vhacd-util/src/VHACDUtilApp.cpp +++ b/tools/vhacd-util/src/VHACDUtilApp.cpp @@ -188,7 +188,11 @@ VHACDUtilApp::VHACDUtilApp(int argc, char* argv[]) : if (!parser.parse(QCoreApplication::arguments())) { +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + qCritical() << parser.errorText() << endl; +#else qCritical() << parser.errorText() << Qt::endl; +#endif parser.showHelp(); Q_UNREACHABLE(); } From 2275c61f9c2b66ae4a87ef6b0a622980707c99f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gro=C3=9F?= Date: Thu, 30 Dec 2021 19:18:47 +0100 Subject: [PATCH 2/5] Use Qt 5.12.3 for macOS to work around issue https://github.com/vircadia/vircadia/issues/1516 --- .github/workflows/master_build.yml | 2 ++ .github/workflows/pr_build.yml | 2 ++ BUILD_OSX.md | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/.github/workflows/master_build.yml b/.github/workflows/master_build.yml index 24e91a740cb..f404d1e7e41 100644 --- a/.github/workflows/master_build.yml +++ b/.github/workflows/master_build.yml @@ -69,6 +69,8 @@ jobs: echo "CMAKE_EXTRA=-DVIRCADIA_CPU_ARCHITECTURE= -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=OFF -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib -G Xcode" >> $GITHUB_ENV echo "::set-output name=symbols_archive::${BUILD_NUMBER}-${{ matrix.build_type }}-mac-symbols.zip" echo "APP_TARGET_NAME=Vircadia" >> $GITHUB_ENV + # Build with old Qt to work around incompatibility with newer Qt versions and macOSXSDK10.12. See https://github.com/vircadia/vircadia/issues/1516 + echo "VIRCADIA_USE_QT_VERSION=5.12.3" >> $GITHUB_ENV fi # Windows build variables if [ "${{ matrix.os }}" = "windows-latest" ]; then diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml index 05e8717ed18..072b09ba8f7 100644 --- a/.github/workflows/pr_build.yml +++ b/.github/workflows/pr_build.yml @@ -94,6 +94,8 @@ jobs: echo "CMAKE_EXTRA=-DVIRCADIA_CPU_ARCHITECTURE= -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -DCLIENT_ONLY=1 -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=OFF -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib -G Xcode" >> $GITHUB_ENV fi echo "APP_TARGET_NAME=Vircadia" >> $GITHUB_ENV + # Build with old Qt to work around incompatibility with newer Qt versions and macOSXSDK10.12. See https://github.com/vircadia/vircadia/issues/1516 + echo "VIRCADIA_USE_QT_VERSION=5.12.3" >> $GITHUB_ENV fi # Windows build variables if [ "${{ matrix.os }}" = "windows-latest" ]; then diff --git a/BUILD_OSX.md b/BUILD_OSX.md index 03106b93542..3ac2cf3b44f 100644 --- a/BUILD_OSX.md +++ b/BUILD_OSX.md @@ -29,6 +29,13 @@ You will need version `10.12` of the macOS SDK for building, otherwise you may h cp -rp ~/Downloads/MacOSX10.12.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ ``` +When using macOSXSDK10.12, you also need to use an older Qt package to avoid compatibility issues on Big Sur and newer. +To do this, set the appropriate environment variable: +```bash +VIRCADIA_USE_QT_VERSION=5.12.3 +``` + See https://github.com/vircadia/vircadia/issues/1516. + ### OpenSSL Assuming you've installed OpenSSL using the homebrew instructions above, you'll need to set `OPENSSL_ROOT_DIR` so CMake can find your installations. From 058b9032cce335ec138f413ff6273bb2236019ab Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 30 Dec 2021 13:04:10 +1300 Subject: [PATCH 3/5] Fix Qt 5.12.3 type errors --- domain-server/src/NodeConnectionData.cpp | 6 +++--- libraries/networking/src/Node.cpp | 10 +++++----- libraries/networking/src/NodeList.cpp | 10 +++++----- libraries/networking/src/SocketType.h | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/domain-server/src/NodeConnectionData.cpp b/domain-server/src/NodeConnectionData.cpp index d7d813e3df3..8c945f1fc45 100644 --- a/domain-server/src/NodeConnectionData.cpp +++ b/domain-server/src/NodeConnectionData.cpp @@ -51,12 +51,12 @@ NodeConnectionData NodeConnectionData::fromDataStream(QDataStream& dataStream, c dataStream >> newHeader.lastPingTimestamp; - SocketType publicSocketType, localSocketType; + quint8 publicSocketType, localSocketType; dataStream >> newHeader.nodeType >> publicSocketType >> newHeader.publicSockAddr >> localSocketType >> newHeader.localSockAddr >> newHeader.interestList >> newHeader.placeName; - newHeader.publicSockAddr.setType(publicSocketType); - newHeader.localSockAddr.setType(localSocketType); + newHeader.publicSockAddr.setType((SocketType)publicSocketType); + newHeader.localSockAddr.setType((SocketType)localSocketType); // For WebRTC connections, the user client's signaling channel WebSocket address is used instead of the actual data // channel's address. diff --git a/libraries/networking/src/Node.cpp b/libraries/networking/src/Node.cpp index de9fb6bddf1..11af62a051a 100644 --- a/libraries/networking/src/Node.cpp +++ b/libraries/networking/src/Node.cpp @@ -196,9 +196,9 @@ bool Node::isIgnoringNodeWithID(const QUuid& nodeID) const { QDataStream& operator<<(QDataStream& out, const Node& node) { out << node._type; out << node._uuid; - out << node._publicSocket.getType(); + out << (quint8)node._publicSocket.getType(); out << node._publicSocket; - out << node._localSocket.getType(); + out << (quint8)node._localSocket.getType(); out << node._localSocket; out << node._permissions; out << node._isReplicated; @@ -207,15 +207,15 @@ QDataStream& operator<<(QDataStream& out, const Node& node) { } QDataStream& operator>>(QDataStream& in, Node& node) { - SocketType publicSocketType, localSocketType; + quint8 publicSocketType, localSocketType; in >> node._type; in >> node._uuid; in >> publicSocketType; in >> node._publicSocket; - node._publicSocket.setType(publicSocketType); + node._publicSocket.setType((SocketType)publicSocketType); in >> localSocketType; in >> node._localSocket; - node._localSocket.setType(localSocketType); + node._localSocket.setType((SocketType)localSocketType); in >> node._permissions; in >> node._isReplicated; in >> node._localID; diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index 58d161a7975..1b166202b4e 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -496,8 +496,8 @@ void NodeList::sendDomainServerCheckIn() { // pack our data to send to the domain-server including // the hostname information (so the domain-server can see which place name we came in on) - packetStream << _ownerType.load() << publicSockAddr.getType() << publicSockAddr << localSockAddr.getType() - << localSockAddr << _nodeTypesOfInterest.toList(); + packetStream << _ownerType.load() << (quint8)publicSockAddr.getType() << publicSockAddr + << (quint8)localSockAddr.getType() << localSockAddr << _nodeTypesOfInterest.toList(); packetStream << DependencyManager::get()->getPlaceName(); if (!domainIsConnected) { @@ -882,7 +882,7 @@ void NodeList::processDomainServerRemovedNode(QSharedPointer me void NodeList::parseNodeFromPacketStream(QDataStream& packetStream) { NewNodeInfo info; - SocketType publicSocketType, localSocketType; + quint8 publicSocketType, localSocketType; packetStream >> info.type >> info.uuid >> publicSocketType @@ -893,8 +893,8 @@ void NodeList::parseNodeFromPacketStream(QDataStream& packetStream) { >> info.isReplicated >> info.sessionLocalID >> info.connectionSecretUUID; - info.publicSocket.setType(publicSocketType); - info.localSocket.setType(localSocketType); + info.publicSocket.setType((SocketType)publicSocketType); + info.localSocket.setType((SocketType)localSocketType); // if the public socket address is 0 then it's reachable at the same IP // as the domain server diff --git a/libraries/networking/src/SocketType.h b/libraries/networking/src/SocketType.h index c689f514223..9a45b081546 100644 --- a/libraries/networking/src/SocketType.h +++ b/libraries/networking/src/SocketType.h @@ -19,7 +19,7 @@ /// @brief The types of network socket. -enum class SocketType : uint8_t { +enum class SocketType : quint8 { Unknown, ///< Socket type unknown or not set. UDP, ///< UDP socket. WebRTC ///< WebRTC socket. A WebRTC data channel presented as a UDP-style socket. From 28c736e02b46106bcd7d2b66067e4c65ad04295d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gro=C3=9F?= Date: Fri, 31 Dec 2021 01:05:00 +0100 Subject: [PATCH 4/5] Add old Qt packages for manual selection. --- hifi_qt.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/hifi_qt.py b/hifi_qt.py index eb3e945ddb8..a5120f08b86 100644 --- a/hifi_qt.py +++ b/hifi_qt.py @@ -134,9 +134,19 @@ def __init__(self, args): return if 'Windows' == system: - self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-windows.tar.gz' + if self.version == "5.15.2": + self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-windows.tar.gz' + else: + self.version = "5.12.3" + self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.3-windows3.tar.gz%3FversionId=5ADqP0M0j5ZfimUHrx4zJld6vYceHEsI' + elif 'Darwin' == system: - self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-macos.tar.gz' + if self.version == "5.15.2": + self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-macos.tar.gz' + else: + self.version = "5.12.3" + self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.3-macos.tar.gz%3FversionId=bLAgnoJ8IMKpqv8NFDcAu8hsyQy3Rwwz' + elif 'Linux' == system: import distro cpu_architecture = platform.machine() @@ -145,7 +155,12 @@ def __init__(self, args): u_major = int( distro.major_version() ) u_minor = int( distro.minor_version() ) if (distro.id() == 'ubuntu' and u_major == 18) or distro.id() == 'linuxmint' and u_major == 19: - self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-ubuntu-18.04-amd64.tar.xz' + if self.version == "5.15.2": + self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.15.2-ubuntu-18.04-amd64.tar.xz' + else: + self.version = "5.12.3" + self.qtUrl = self.assets_url + '/dependencies/vcpkg/qt5-install-5.12.3-ubuntu-18.04.tar.gz' + elif (distro.id() == 'ubuntu' and u_major > 18) or (distro.id() == 'linuxmint' and u_major > 19): self.__no_qt_package_error() else: From 92907bd1221ecaab9007fe11e75c8700184b648c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gro=C3=9F?= Date: Sat, 19 Feb 2022 13:05:02 +0100 Subject: [PATCH 5/5] Clean up Qt compatibility code --- .../src/audio/AvatarAudioStream.h | 5 - assignment-client/src/avatars/AvatarMixer.cpp | 7 +- interface/src/Application.cpp | 33 ++----- interface/src/Application.h | 14 +-- interface/src/avatar/MyHead.h | 5 - interface/src/graphics/GraphicsEngine.h | 9 +- interface/src/ui/overlays/Overlays.h | 8 +- libraries/animation/src/AnimNodeLoader.h | 5 - libraries/animation/src/AnimRandomSwitch.h | 5 - libraries/animation/src/AnimStateMachine.h | 10 -- libraries/audio/src/AudioInjectorManager.h | 5 - libraries/audio/src/InjectedAudioStream.h | 5 - libraries/avatars/src/AvatarData.h | 5 - libraries/avatars/src/HeadData.h | 5 - .../src/controllers/UserInputMapper.cpp | 24 ++--- .../src/display-plugins/CompositorHelper.h | 8 +- libraries/entities/src/EntitySimulation.h | 8 +- libraries/entities/src/EntityTree.cpp | 9 +- libraries/networking/src/AccountManager.h | 5 - .../networking/src/AssetResourceRequest.cpp | 8 +- libraries/networking/src/HMACAuth.h | 8 +- libraries/networking/src/NLPacketList.h | 8 -- libraries/networking/src/Node.h | 5 - libraries/networking/src/NodeList.h | 9 -- .../networking/src/udt/CongestionControl.h | 5 - libraries/networking/src/udt/ControlPacket.h | 10 -- libraries/networking/src/udt/PacketList.h | 5 - libraries/networking/src/udt/SendQueue.h | 7 +- libraries/octree/src/OctreeEditPacketSender.h | 9 +- .../physics/src/PhysicalEntitySimulation.h | 9 +- libraries/render-utils/src/Model.cpp | 9 +- libraries/render-utils/src/Model.h | 8 +- libraries/script-engine/src/ScriptEngine.cpp | 21 ++-- libraries/shared/src/DependencyManager.h | 8 +- libraries/shared/src/QtCompatibility.h | 60 ++++++++++++ libraries/shared/src/shared/FileUtils.cpp | 12 +-- libraries/shared/src/shared/FileUtils.h | 8 +- libraries/ui/src/VrMenu.cpp | 4 - tools/ac-client/src/ACClientApp.cpp | 8 +- tools/atp-client/src/ATPClientApp.cpp | 8 +- tools/ice-client/src/ICEClientApp.cpp | 8 +- tools/nitpick/src/TestCreator.cpp | 97 +++++-------------- tools/skeleton-dump/src/SkeletonDumpApp.cpp | 8 +- tools/vhacd-util/src/VHACDUtilApp.cpp | 8 +- 44 files changed, 177 insertions(+), 348 deletions(-) create mode 100644 libraries/shared/src/QtCompatibility.h diff --git a/assignment-client/src/audio/AvatarAudioStream.h b/assignment-client/src/audio/AvatarAudioStream.h index b7d310377f0..e445dafa5cc 100644 --- a/assignment-client/src/audio/AvatarAudioStream.h +++ b/assignment-client/src/audio/AvatarAudioStream.h @@ -23,12 +23,7 @@ class AvatarAudioStream : public PositionalAudioStream { AvatarAudioStream(bool isStereo, int numStaticJitterFrames = -1); private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - AvatarAudioStream(const AvatarAudioStream&); - AvatarAudioStream& operator= (const AvatarAudioStream&); -#else Q_DISABLE_COPY(AvatarAudioStream) -#endif int parseStreamProperties(PacketType type, const QByteArray& packetAfterSeqNum, int& numAudioSamples) override; }; diff --git a/assignment-client/src/avatars/AvatarMixer.cpp b/assignment-client/src/avatars/AvatarMixer.cpp index 607b7d6b7c4..ee8f3f7ade6 100644 --- a/assignment-client/src/avatars/AvatarMixer.cpp +++ b/assignment-client/src/avatars/AvatarMixer.cpp @@ -5,6 +5,7 @@ // Created by Stephen Birarda on 9/5/13. // Copyright 2013 High Fidelity, Inc. // Copyright 2021 Vircadia contributors. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -1062,11 +1063,7 @@ void AvatarMixer::parseDomainServerSettings(const QJsonObject& domainSettings) { static const QString AVATAR_WHITELIST_OPTION = "avatar_whitelist"; _slaveSharedData.skeletonURLWhitelist = avatarMixerGroupObject[AVATAR_WHITELIST_OPTION] -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - .toString().split(',', QString::KeepEmptyParts); -#else - .toString().split(',', Qt::KeepEmptyParts); -#endif + .toString().split(',', QTCOMPAT_KEEP_EMPTY_PARTS); static const QString REPLACEMENT_AVATAR_OPTION = "replacement_avatar"; _slaveSharedData.skeletonReplacementURL = avatarMixerGroupObject[REPLACEMENT_AVATAR_OPTION] diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index ddbcf08724e..e7023d6ac3a 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5,6 +5,7 @@ // Created by Andrzej Kapolka on 5/10/13. // Copyright 2013 High Fidelity, Inc. // Copyright 2020 Vircadia contributors. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -24,6 +25,8 @@ #include +#include "QtCompatibility.h" + #include #include #include @@ -3261,20 +3264,12 @@ void Application::initializeUi() { auto newValidator = [=](const QUrl& url) -> bool { QString whitelistPrefix = "[WHITELIST ENTITY SCRIPTS]"; QList safeURLS = { "" }; -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - safeURLS += qEnvironmentVariable("EXTRA_WHITELIST").trimmed().split(QRegExp("\\s*,\\s*"), QString::SkipEmptyParts); -#else - safeURLS += qEnvironmentVariable("EXTRA_WHITELIST").trimmed().split(QRegExp("\\s*,\\s*"), Qt::SkipEmptyParts); -#endif + safeURLS += qEnvironmentVariable("EXTRA_WHITELIST").trimmed().split(QRegExp("\\s*,\\s*"), QTCOMPAT_SKIP_EMPTY_PARTS); // PULL SAFEURLS FROM INTERFACE.JSON Settings QVariant raw = Setting::Handle("private/settingsSafeURLS").get(); -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - QStringList settingsSafeURLS = raw.toString().trimmed().split(QRegExp("\\s*[,\r\n]+\\s*"), QString::SkipEmptyParts); -#else - QStringList settingsSafeURLS = raw.toString().trimmed().split(QRegExp("\\s*[,\r\n]+\\s*"), Qt::SkipEmptyParts); -#endif + QStringList settingsSafeURLS = raw.toString().trimmed().split(QRegExp("\\s*[,\r\n]+\\s*"), QTCOMPAT_SKIP_EMPTY_PARTS); safeURLS += settingsSafeURLS; // END PULL SAFEURLS FROM INTERFACE.JSON Settings @@ -8851,31 +8846,19 @@ void Application::initPlugins(const QStringList& arguments) { parser.parse(arguments); if (parser.isSet(display)) { -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - auto preferredDisplays = parser.value(display).split(',', QString::SkipEmptyParts); -#else - auto preferredDisplays = parser.value(display).split(',', Qt::SkipEmptyParts); -#endif + auto preferredDisplays = parser.value(display).split(',', QTCOMPAT_SKIP_EMPTY_PARTS); qInfo() << "Setting prefered display plugins:" << preferredDisplays; PluginManager::getInstance()->setPreferredDisplayPlugins(preferredDisplays); } if (parser.isSet(disableDisplays)) { -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - auto disabledDisplays = parser.value(disableDisplays).split(',', QString::SkipEmptyParts); -#else - auto disabledDisplays = parser.value(disableDisplays).split(',', Qt::SkipEmptyParts); -#endif + auto disabledDisplays = parser.value(disableDisplays).split(',', QTCOMPAT_SKIP_EMPTY_PARTS); qInfo() << "Disabling following display plugins:" << disabledDisplays; PluginManager::getInstance()->disableDisplays(disabledDisplays); } if (parser.isSet(disableInputs)) { -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - auto disabledInputs = parser.value(disableInputs).split(',', QString::SkipEmptyParts); -#else - auto disabledInputs = parser.value(disableInputs).split(',', Qt::SkipEmptyParts); -#endif + auto disabledInputs = parser.value(disableInputs).split(',', QTCOMPAT_SKIP_EMPTY_PARTS); qInfo() << "Disabling following input plugins:" << disabledInputs; PluginManager::getInstance()->disableInputs(disabledInputs); } diff --git a/interface/src/Application.h b/interface/src/Application.h index 0a7d9faebfe..853eae708da 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -5,6 +5,7 @@ // Created by Andrzej Kapolka on 5/10/13. // Copyright 2013 High Fidelity, Inc. // Copyright 2020 Vircadia contributors. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -15,6 +16,7 @@ #include +#include "QtCompatibility.h" #include #include #include @@ -648,11 +650,7 @@ private slots: EntityTreePointer _entityClipboard; -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - mutable QMutex _viewMutex { QMutex::Recursive }; -#else - mutable QRecursiveMutex _viewMutex; -#endif + mutable QTCOMPAT_DECLARE_RECURSIVE_MUTEX(_viewMutex); ViewFrustum _viewFrustum; // current state of view frustum, perspective, orientation, etc. ViewFrustum _displayViewFrustum; @@ -778,11 +776,7 @@ private slots: bool _isMissingSequenceNumbers { false }; void checkChangeCursor(); -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - mutable QMutex _changeCursorLock { QMutex::Recursive }; -#else - mutable QRecursiveMutex _changeCursorLock; -#endif + mutable QTCOMPAT_DECLARE_RECURSIVE_MUTEX(_changeCursorLock); Qt::CursorShape _desiredCursor{ Qt::BlankCursor }; bool _cursorNeedsChanging { false }; diff --git a/interface/src/avatar/MyHead.h b/interface/src/avatar/MyHead.h index c39d600e11a..31543ccf5cc 100644 --- a/interface/src/avatar/MyHead.h +++ b/interface/src/avatar/MyHead.h @@ -22,12 +22,7 @@ class MyHead : public Head { void simulate(float deltaTime) override; private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - MyHead(const Head&); - MyHead& operator= (const MyHead&); -#else Q_DISABLE_COPY(MyHead) -#endif }; #endif // hifi_MyHead_h diff --git a/interface/src/graphics/GraphicsEngine.h b/interface/src/graphics/GraphicsEngine.h index a1064925161..caed3066cf5 100644 --- a/interface/src/graphics/GraphicsEngine.h +++ b/interface/src/graphics/GraphicsEngine.h @@ -3,6 +3,7 @@ // // Created by Sam Gateau on 29/6/2018. // Copyright 2018 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -12,6 +13,7 @@ #include #include +#include "QtCompatibility.h" #include #include @@ -68,12 +70,7 @@ class GraphicsEngine { void render_runRenderFrame(RenderArgs* renderArgs); protected: - -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - mutable QMutex _renderArgsMutex{ QMutex::Recursive }; -#else - mutable QRecursiveMutex _renderArgsMutex; -#endif + mutable QTCOMPAT_DECLARE_RECURSIVE_MUTEX(_renderArgsMutex); AppRenderArgs _appRenderArgs; RateCounter<500> _renderLoopCounter; diff --git a/interface/src/ui/overlays/Overlays.h b/interface/src/ui/overlays/Overlays.h index 94132ad554a..4ccd4f93fb2 100644 --- a/interface/src/ui/overlays/Overlays.h +++ b/interface/src/ui/overlays/Overlays.h @@ -4,6 +4,7 @@ // // Modified by Zander Otavka on 7/15/15 // Copyright 2014 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -18,6 +19,7 @@ #ifndef hifi_Overlays_h #define hifi_Overlays_h +#include "QtCompatibility.h" #include #include #include @@ -746,11 +748,7 @@ public slots: private: void cleanupOverlaysToDelete(); -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - mutable QMutex _mutex { QMutex::Recursive }; -#else - mutable QRecursiveMutex _mutex; -#endif + mutable QTCOMPAT_DECLARE_RECURSIVE_MUTEX(_mutex); QMap _overlays; QList _overlaysToDelete; diff --git a/libraries/animation/src/AnimNodeLoader.h b/libraries/animation/src/AnimNodeLoader.h index 537735789a6..ac27402cf71 100644 --- a/libraries/animation/src/AnimNodeLoader.h +++ b/libraries/animation/src/AnimNodeLoader.h @@ -45,12 +45,7 @@ protected slots: QSharedPointer _resource; private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - AnimNodeLoader(const AnimNodeLoader&) = delete; - AnimNodeLoader& operator=(const AnimNodeLoader&) = delete; -#else Q_DISABLE_COPY(AnimNodeLoader) -#endif }; #endif // hifi_AnimNodeLoader diff --git a/libraries/animation/src/AnimRandomSwitch.h b/libraries/animation/src/AnimRandomSwitch.h index 65cfb75afe5..99a3f94d9b0 100644 --- a/libraries/animation/src/AnimRandomSwitch.h +++ b/libraries/animation/src/AnimRandomSwitch.h @@ -184,12 +184,7 @@ class AnimRandomSwitch : public AnimNode { QString _lastPlayedState; private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - AnimRandomSwitch(const AnimRandomSwitch&) = delete; - AnimRandomSwitch& operator=(const AnimRandomSwitch&) = delete; -#else Q_DISABLE_COPY(AnimRandomSwitch) -#endif }; #endif // hifi_AnimRandomSwitch_h diff --git a/libraries/animation/src/AnimStateMachine.h b/libraries/animation/src/AnimStateMachine.h index b8991f41787..0a34fc4ebcb 100644 --- a/libraries/animation/src/AnimStateMachine.h +++ b/libraries/animation/src/AnimStateMachine.h @@ -107,12 +107,7 @@ class AnimStateMachine : public AnimNode { std::vector _transitions; private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - State(const State&) = delete; - State& operator=(const State&) = delete; -#else Q_DISABLE_COPY(State) -#endif }; public: @@ -155,12 +150,7 @@ class AnimStateMachine : public AnimNode { QString _currentStateVar; private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - AnimStateMachine(const AnimStateMachine&) = delete; - AnimStateMachine& operator=(const AnimStateMachine&) = delete; -#else Q_DISABLE_COPY(AnimStateMachine) -#endif }; #endif // hifi_AnimStateMachine_h diff --git a/libraries/audio/src/AudioInjectorManager.h b/libraries/audio/src/AudioInjectorManager.h index cf8aa4e6748..8fac2b37f25 100644 --- a/libraries/audio/src/AudioInjectorManager.h +++ b/libraries/audio/src/AudioInjectorManager.h @@ -72,12 +72,7 @@ private slots: bool wouldExceedLimits(); AudioInjectorManager() { createThread(); } -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - AudioInjectorManager(const AudioInjectorManager&) = delete; - AudioInjectorManager& operator=(const AudioInjectorManager&) = delete; -#else Q_DISABLE_COPY(AudioInjectorManager) -#endif void createThread(); diff --git a/libraries/audio/src/InjectedAudioStream.h b/libraries/audio/src/InjectedAudioStream.h index 421a993ca7b..467c499fa61 100644 --- a/libraries/audio/src/InjectedAudioStream.h +++ b/libraries/audio/src/InjectedAudioStream.h @@ -28,12 +28,7 @@ class InjectedAudioStream : public PositionalAudioStream { virtual const QUuid& getStreamIdentifier() const override { return _streamIdentifier; } private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - InjectedAudioStream(const InjectedAudioStream&); - InjectedAudioStream& operator= (const InjectedAudioStream&); -#else Q_DISABLE_COPY(InjectedAudioStream) -#endif AudioStreamStats getAudioStreamStats() const override; int parseStreamProperties(PacketType type, const QByteArray& packetAfterSeqNum, int& numAudioSamples) override; diff --git a/libraries/avatars/src/AvatarData.h b/libraries/avatars/src/AvatarData.h index a791e46132b..70f20caa26f 100644 --- a/libraries/avatars/src/AvatarData.h +++ b/libraries/avatars/src/AvatarData.h @@ -1887,12 +1887,7 @@ public slots: virtual void clearAvatarGrabData(const QUuid& grabID); private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - AvatarData(const AvatarData&); - AvatarData& operator= (const AvatarData&); -#else Q_DISABLE_COPY(AvatarData) -#endif friend void avatarStateFromFrame(const QByteArray& frameData, AvatarData* _avatar); static QUrl _defaultFullAvatarModelUrl; diff --git a/libraries/avatars/src/HeadData.h b/libraries/avatars/src/HeadData.h index 94b3ea04f81..3ab756ce425 100644 --- a/libraries/avatars/src/HeadData.h +++ b/libraries/avatars/src/HeadData.h @@ -128,12 +128,7 @@ class HeadData { AvatarData* _owningAvatar; private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - HeadData(const HeadData&); - HeadData& operator= (const HeadData&); -#else Q_DISABLE_COPY(HeadData) -#endif void setHeadOrientation(const glm::quat& orientation); }; diff --git a/libraries/controllers/src/controllers/UserInputMapper.cpp b/libraries/controllers/src/controllers/UserInputMapper.cpp index 573a4e9a734..385a5d12b0e 100644 --- a/libraries/controllers/src/controllers/UserInputMapper.cpp +++ b/libraries/controllers/src/controllers/UserInputMapper.cpp @@ -1,6 +1,7 @@ // // Created by Sam Gateau on 4/27/15. // Copyright 2015 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -10,6 +11,8 @@ #include +#include "QtCompatibility.h" + #include #include @@ -738,11 +741,7 @@ Mapping::Pointer UserInputMapper::newMapping(const QString& mappingName) { // if (request->getResult() == ResourceRequest::Success) { // result = parseMapping(QString(request->getData())); // } else { -// #if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) -// qCWarning(controllers) << "Failed to load mapping url <" << jsonUrl << ">" << endl; -// #else -// qCWarning(controllers) << "Failed to load mapping url <" << jsonUrl << ">" << Qt::endl; -// #endif +// qCWarning(controllers) << "Failed to load mapping url <" << jsonUrl << ">" << QTCOMPAT_ENDL; // } // request->deleteLater(); // } @@ -1181,22 +1180,13 @@ Mapping::Pointer UserInputMapper::parseMapping(const QString& json) { if (doc.isNull()) { qCDebug(controllers) << "Invalid JSON...\n"; qCDebug(controllers) << error.errorString(); -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - qCDebug(controllers) << "JSON was:\n" << json << endl; -#else - qCDebug(controllers) << "JSON was:\n" << json << Qt::endl; -#endif + qCDebug(controllers) << "JSON was:\n" << json << QTCOMPAT_ENDL; return Mapping::Pointer(); } if (!doc.isObject()) { -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - qWarning() << "Mapping json Document is not an object" << endl; - qCDebug(controllers) << "JSON was:\n" << json << endl; -#else - qWarning() << "Mapping json Document is not an object" << Qt::endl; - qCDebug(controllers) << "JSON was:\n" << json << Qt::endl; -#endif + qWarning() << "Mapping json Document is not an object" << QTCOMPAT_ENDL; + qCDebug(controllers) << "JSON was:\n" << json << QTCOMPAT_ENDL; return Mapping::Pointer(); } return parseMapping(doc.object()); diff --git a/libraries/display-plugins/src/display-plugins/CompositorHelper.h b/libraries/display-plugins/src/display-plugins/CompositorHelper.h index 5e05b8a0905..3da90728211 100644 --- a/libraries/display-plugins/src/display-plugins/CompositorHelper.h +++ b/libraries/display-plugins/src/display-plugins/CompositorHelper.h @@ -2,6 +2,7 @@ // Created by Bradley Austin Davis Arnold on 2015/06/13 // Copyright 2015 High Fidelity, Inc. // Copyright 2020 Vircadia contributors. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -13,6 +14,7 @@ #include #include +#include "QtCompatibility.h" #include #include #include @@ -161,11 +163,7 @@ protected slots: // application specific position, when it's in desktop mode, the reticle position will simply move // the system mouse. glm::vec2 _reticlePositionInHMD { 0.0f, 0.0f }; -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - mutable QMutex _reticleLock { QMutex::Recursive }; -#else - mutable QRecursiveMutex _reticleLock; -#endif + mutable QTCOMPAT_DECLARE_RECURSIVE_MUTEX(_reticleLock); QPointF _lastKnownRealMouse; bool _ignoreMouseMove { false }; diff --git a/libraries/entities/src/EntitySimulation.h b/libraries/entities/src/EntitySimulation.h index f4b290e5c00..a96542b80b1 100644 --- a/libraries/entities/src/EntitySimulation.h +++ b/libraries/entities/src/EntitySimulation.h @@ -4,6 +4,7 @@ // // Created by Andrew Meadows on 2014.11.24 // Copyright 2014 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -15,6 +16,7 @@ #include #include +#include "QtCompatibility.h" #include #include @@ -94,11 +96,7 @@ class EntitySimulation : public QObject, public std::enable_shared_from_this #include #include @@ -68,11 +71,7 @@ EntityTree::~EntityTree() { } void EntityTree::setEntityScriptSourceWhitelist(const QString& entityScriptSourceWhitelist) { -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - _entityScriptSourceWhitelist = entityScriptSourceWhitelist.split(',', QString::SkipEmptyParts); -#else - _entityScriptSourceWhitelist = entityScriptSourceWhitelist.split(',', Qt::SkipEmptyParts); -#endif + _entityScriptSourceWhitelist = entityScriptSourceWhitelist.split(',', QTCOMPAT_SKIP_EMPTY_PARTS); } diff --git a/libraries/networking/src/AccountManager.h b/libraries/networking/src/AccountManager.h index 0e318e244e0..bd318e3af5b 100644 --- a/libraries/networking/src/AccountManager.h +++ b/libraries/networking/src/AccountManager.h @@ -163,12 +163,7 @@ private slots: void postAccountSettingsError(QNetworkReply::NetworkError error); private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - AccountManager(AccountManager const& other) = delete; - void operator=(AccountManager const& other) = delete; -#else Q_DISABLE_COPY(AccountManager); -#endif void persistAccountToFile(); diff --git a/libraries/networking/src/AssetResourceRequest.cpp b/libraries/networking/src/AssetResourceRequest.cpp index fb5b79ad849..fc1bfcb2873 100644 --- a/libraries/networking/src/AssetResourceRequest.cpp +++ b/libraries/networking/src/AssetResourceRequest.cpp @@ -4,6 +4,7 @@ // // Created by Ryan Huffman on 2015/07/23 // Copyright 2015 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -11,6 +12,7 @@ #include "AssetResourceRequest.h" +#include "QtCompatibility.h" #include #include @@ -59,11 +61,7 @@ void AssetResourceRequest::doSend() { // We'll either have a hash or an ATP path to a file (that maps to a hash) if (urlIsAssetHash(_url)) { // We've detected that this is a hash - simply use AssetClient to request that asset -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - auto parts = _url.path().split(".", QString::SkipEmptyParts); -#else - auto parts = _url.path().split(".", Qt::SkipEmptyParts); -#endif + auto parts = _url.path().split(".", QTCOMPAT_SKIP_EMPTY_PARTS); auto hash = parts.length() > 0 ? parts[0] : ""; requestHash(hash); diff --git a/libraries/networking/src/HMACAuth.h b/libraries/networking/src/HMACAuth.h index 69eaffd52b8..9b959e60094 100644 --- a/libraries/networking/src/HMACAuth.h +++ b/libraries/networking/src/HMACAuth.h @@ -4,6 +4,7 @@ // // Created by Simon Walton on 3/19/2018. // Copyright 2018 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -14,6 +15,7 @@ #include #include +#include "QtCompatibility.h" #include class QUuid; @@ -39,11 +41,7 @@ class HMACAuth { HMACHash result(); private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - QMutex _lock { QMutex::Recursive }; -#else - QRecursiveMutex _lock; -#endif + QTCOMPAT_DECLARE_RECURSIVE_MUTEX(_lock); struct hmac_ctx_st* _hmacContext; AuthMethod _authMethod; }; diff --git a/libraries/networking/src/NLPacketList.h b/libraries/networking/src/NLPacketList.h index f367befab5f..fb2a9f1d7ea 100644 --- a/libraries/networking/src/NLPacketList.h +++ b/libraries/networking/src/NLPacketList.h @@ -28,18 +28,10 @@ class NLPacketList : public udt::PacketList { qint64 getMaxSegmentSize() const override { return NLPacket::maxPayloadSize(_packetType, _isOrdered); } private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - NLPacketList(PacketType packetType, QByteArray extendedHeader = QByteArray(), bool isReliable = false, - bool isOrdered = false); - NLPacketList(udt::PacketList&& packetList); - NLPacketList(const NLPacketList& other) = delete; - NLPacketList& operator=(const NLPacketList& other) = delete; -#else Q_DISABLE_COPY(NLPacketList) NLPacketList(PacketType packetType, QByteArray extendedHeader = QByteArray(), bool isReliable = false, bool isOrdered = false); NLPacketList(udt::PacketList&& packetList); -#endif virtual std::unique_ptr createPacket() override; diff --git a/libraries/networking/src/Node.h b/libraries/networking/src/Node.h index a463d4d513f..70473c678cf 100644 --- a/libraries/networking/src/Node.h +++ b/libraries/networking/src/Node.h @@ -109,12 +109,7 @@ class Node : public NetworkPeer { float getOutboundKbps() const; private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - Node(const Node &otherNode); - Node& operator=(Node otherNode); -#else Q_DISABLE_COPY(Node) -#endif NodeType_t _type; diff --git a/libraries/networking/src/NodeList.h b/libraries/networking/src/NodeList.h index fc6bd0c40d8..f6ada6fce01 100644 --- a/libraries/networking/src/NodeList.h +++ b/libraries/networking/src/NodeList.h @@ -156,20 +156,11 @@ private slots: void maybeSendIgnoreSetToNode(SharedNodePointer node); private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - NodeList() : LimitedNodeList(INVALID_PORT, INVALID_PORT) { - assert(false); // Not implemented, needed for DependencyManager templates compile - } - NodeList(char ownerType, int socketListenPort = INVALID_PORT, int dtlsListenPort = INVALID_PORT); - NodeList(NodeList const&) = delete; // Don't implement, needed to avoid copies of singleton - void operator=(NodeList const&) = delete; // Don't implement, needed to avoid copies of singleton -#else Q_DISABLE_COPY(NodeList) NodeList() : LimitedNodeList(INVALID_PORT, INVALID_PORT) { assert(false); // Not implemented, needed for DependencyManager templates compile } NodeList(char ownerType, int socketListenPort = INVALID_PORT, int dtlsListenPort = INVALID_PORT); -#endif void processDomainServerAuthRequest(const QByteArray& packet); void requestAuthForDomainServer(); diff --git a/libraries/networking/src/udt/CongestionControl.h b/libraries/networking/src/udt/CongestionControl.h index 8c2ea3ae6a4..4d3b225535a 100644 --- a/libraries/networking/src/udt/CongestionControl.h +++ b/libraries/networking/src/udt/CongestionControl.h @@ -64,12 +64,7 @@ class CongestionControl { SequenceNumber _sendCurrSeqNum; // current maximum seq num sent out private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - CongestionControl(const CongestionControl& other) = delete; - CongestionControl& operator=(const CongestionControl& other) = delete; -#else Q_DISABLE_COPY(CongestionControl); -#endif }; diff --git a/libraries/networking/src/udt/ControlPacket.h b/libraries/networking/src/udt/ControlPacket.h index ccc1afaf368..aa3878bbd50 100644 --- a/libraries/networking/src/udt/ControlPacket.h +++ b/libraries/networking/src/udt/ControlPacket.h @@ -48,22 +48,12 @@ class ControlPacket : public BasePacket { void setType(Type type); private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - ControlPacket(Type type, qint64 size = -1); - ControlPacket(std::unique_ptr data, qint64 size, const SockAddr& senderSockAddr); - ControlPacket(ControlPacket&& other); - ControlPacket(const ControlPacket& other) = delete; - - ControlPacket& operator=(ControlPacket&& other); - ControlPacket& operator=(const ControlPacket& other) = delete; -#else Q_DISABLE_COPY(ControlPacket) ControlPacket(Type type, qint64 size = -1); ControlPacket(std::unique_ptr data, qint64 size, const SockAddr& senderSockAddr); ControlPacket(ControlPacket&& other); ControlPacket& operator=(ControlPacket&& other); -#endif // Header read/write void readType(); diff --git a/libraries/networking/src/udt/PacketList.h b/libraries/networking/src/udt/PacketList.h index 379ab97332c..8339c0919cb 100644 --- a/libraries/networking/src/udt/PacketList.h +++ b/libraries/networking/src/udt/PacketList.h @@ -85,12 +85,7 @@ class PacketList : public ExtendedIODevice { friend class SendQueue; friend class Socket; -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - PacketList(const PacketList& other) = delete; - PacketList& operator=(const PacketList& other) = delete; -#else Q_DISABLE_COPY(PacketList) -#endif // Takes the first packet of the list and returns it. template std::unique_ptr takeFront(); diff --git a/libraries/networking/src/udt/SendQueue.h b/libraries/networking/src/udt/SendQueue.h index 20de294d8ac..8029c056ba5 100644 --- a/libraries/networking/src/udt/SendQueue.h +++ b/libraries/networking/src/udt/SendQueue.h @@ -5,6 +5,7 @@ // Created by Clement on 7/21/15. // Copyright 2015 High Fidelity, Inc. // Copyright 2021 Vircadia contributors. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -21,6 +22,7 @@ #include #include +#include "QtCompatibility.h" #include #include @@ -90,12 +92,7 @@ private slots: void run(); private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - SendQueue(SendQueue& other) = delete; - SendQueue(SendQueue&& other) = delete; -#else Q_DISABLE_COPY_MOVE(SendQueue) -#endif SendQueue(Socket* socket, SockAddr dest, SequenceNumber currentSequenceNumber, MessageNumber currentMessageNumber, bool hasReceivedHandshakeACK); diff --git a/libraries/octree/src/OctreeEditPacketSender.h b/libraries/octree/src/OctreeEditPacketSender.h index 40e1a3bb584..00ec5445d65 100644 --- a/libraries/octree/src/OctreeEditPacketSender.h +++ b/libraries/octree/src/OctreeEditPacketSender.h @@ -4,6 +4,7 @@ // // Created by Brad Hefta-Gaub on 8/12/13. // Copyright 2013 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -14,6 +15,8 @@ #include +#include "QtCompatibility.h" + #include #include @@ -93,11 +96,7 @@ public slots: int _maxPendingMessages; bool _releaseQueuedMessagesPending; QMutex _pendingPacketsLock; -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - QMutex _packetsQueueLock{ QMutex::Recursive }; -#else - QRecursiveMutex _packetsQueueLock; // don't let different threads release the queue while another thread is writing to it -#endif + QTCOMPAT_DECLARE_RECURSIVE_MUTEX(_packetsQueueLock); // don't let different threads release the queue while another thread is writing to it std::list _preServerEdits; // these will get packed into other larger packets std::list> _preServerSingleMessagePackets; // these will go out as is diff --git a/libraries/physics/src/PhysicalEntitySimulation.h b/libraries/physics/src/PhysicalEntitySimulation.h index 0fb3f4b2db9..c4f064bf1a6 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.h +++ b/libraries/physics/src/PhysicalEntitySimulation.h @@ -4,6 +4,7 @@ // // Created by Andrew Meadows 2015.04.27 // Copyright 2015 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -16,6 +17,8 @@ #include #include +#include "QtCompatibility.h" + #include #include @@ -129,11 +132,7 @@ class PhysicalEntitySimulation : public EntitySimulation { QList _dynamicsToAdd; QSet _dynamicsToRemove; -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - QMutex _dynamicsMutex { QMutex::Recursive }; -#else - QRecursiveMutex _dynamicsMutex; -#endif + QTCOMPAT_DECLARE_RECURSIVE_MUTEX(_dynamicsMutex); workload::SpacePointer _space; uint64_t _nextBidExpiry; diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 3b88c800b9d..e5c5b270117 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -4,6 +4,7 @@ // // Created by Andrzej Kapolka on 10/18/13. // Copyright 2013 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -11,6 +12,7 @@ #include "Model.h" +#include "QtCompatibility.h" #include #include #include @@ -1637,11 +1639,8 @@ std::set Model::getMeshIDsFromMaterialID(QString parentMaterialNam }; if (parentMaterialName.length() > 2 && parentMaterialName.startsWith("[") && parentMaterialName.endsWith("]")) { -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - QStringList list = parentMaterialName.split(",", QString::SkipEmptyParts); -#else - QStringList list = parentMaterialName.split(",", Qt::SkipEmptyParts); -#endif + QStringList list = parentMaterialName.split(",", QTCOMPAT_SKIP_EMPTY_PARTS); + for (int i = 0; i < list.length(); i++) { auto& target = list[i]; if (i == 0) { diff --git a/libraries/render-utils/src/Model.h b/libraries/render-utils/src/Model.h index e39a33f8d78..af33413a276 100644 --- a/libraries/render-utils/src/Model.h +++ b/libraries/render-utils/src/Model.h @@ -4,6 +4,7 @@ // // Created by Andrzej Kapolka on 10/18/13. // Copyright 2013 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -12,6 +13,7 @@ #ifndef hifi_Model_h #define hifi_Model_h +#include "QtCompatibility.h" #include #include #include @@ -444,11 +446,7 @@ public slots: QVector _blendedBlendshapeCoefficients; int _blendNumber { 0 }; -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - mutable QMutex _mutex{ QMutex::Recursive }; -#else - mutable QRecursiveMutex _mutex; -#endif + mutable QTCOMPAT_DECLARE_RECURSIVE_MUTEX(_mutex); bool _overrideModelTransform { false }; bool _triangleSetsValid { false }; diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index cae491ae488..47086834bb9 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -4,6 +4,7 @@ // // Created by Brad Hefta-Gaub on 12/14/13. // Copyright 2013 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -14,6 +15,7 @@ #include #include +#include "QtCompatibility.h" #include #include #include @@ -187,11 +189,8 @@ void inputControllerFromScriptValue(const QScriptValue &object, controller::Inpu // // Extract the url portion of a url that has been encoded with encodeEntityIdIntoEntityUrl(...) QString extractUrlFromEntityUrl(const QString& url) { -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - auto parts = url.split(' ', QString::SkipEmptyParts); -#else - auto parts = url.split(' ', Qt::SkipEmptyParts); -#endif + auto parts = url.split(' ', QTCOMPAT_SKIP_EMPTY_PARTS); + if (parts.length() > 0) { return parts[0]; } else { @@ -2390,11 +2389,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co bool passList = false; // assume unsafe QString whitelistPrefix = "[WHITELIST ENTITY SCRIPTS]"; QList safeURLPrefixes = { "file:///", "atp:", "cache:" }; -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - safeURLPrefixes += qEnvironmentVariable("EXTRA_WHITELIST").trimmed().split(QRegExp("\\s*,\\s*"), QString::SkipEmptyParts); -#else - safeURLPrefixes += qEnvironmentVariable("EXTRA_WHITELIST").trimmed().split(QRegExp("\\s*,\\s*"), Qt::SkipEmptyParts); -#endif + safeURLPrefixes += qEnvironmentVariable("EXTRA_WHITELIST").trimmed().split(QRegExp("\\s*,\\s*"), QTCOMPAT_SKIP_EMPTY_PARTS); // Entity Script Whitelist toggle check. Setting::Handle whitelistEnabled {"private/whitelistEnabled", false }; @@ -2405,11 +2400,7 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co // Pull SAFEURLS from the Interface.JSON settings. QVariant raw = Setting::Handle("private/settingsSafeURLS").get(); -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - QStringList settingsSafeURLS = raw.toString().trimmed().split(QRegExp("\\s*[,\r\n]+\\s*"), QString::SkipEmptyParts); -#else - QStringList settingsSafeURLS = raw.toString().trimmed().split(QRegExp("\\s*[,\r\n]+\\s*"), Qt::SkipEmptyParts); -#endif + QStringList settingsSafeURLS = raw.toString().trimmed().split(QRegExp("\\s*[,\r\n]+\\s*"), QTCOMPAT_SKIP_EMPTY_PARTS); safeURLPrefixes += settingsSafeURLS; // END Pull SAFEURLS from the Interface.JSON settings. diff --git a/libraries/shared/src/DependencyManager.h b/libraries/shared/src/DependencyManager.h index 79ba32db1e7..91f16899616 100644 --- a/libraries/shared/src/DependencyManager.h +++ b/libraries/shared/src/DependencyManager.h @@ -4,6 +4,7 @@ // // Created by Clément Brisset on 12/10/14. // Copyright 2014 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -12,6 +13,7 @@ #ifndef hifi_DependencyManager_h #define hifi_DependencyManager_h +#include "QtCompatibility.h" #include #include #include @@ -89,11 +91,7 @@ class DependencyManager { QHash> _instanceHash; QHash _inheritanceHash; -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - mutable QMutex _instanceHashMutex { QMutex::Recursive }; -#else - mutable QRecursiveMutex _instanceHashMutex; -#endif + mutable QTCOMPAT_DECLARE_RECURSIVE_MUTEX(_instanceHashMutex); mutable QMutex _inheritanceHashMutex; bool _exiting { false }; diff --git a/libraries/shared/src/QtCompatibility.h b/libraries/shared/src/QtCompatibility.h new file mode 100644 index 00000000000..cf19ce75653 --- /dev/null +++ b/libraries/shared/src/QtCompatibility.h @@ -0,0 +1,60 @@ +// +// QtCompatibility.h +// +// Created by Julian Groß on 2022-02-04 +// Copyright 2022 Overte e.V. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#include + +// Compatibility with Qt < 5.13 +#ifndef Q_DISABLE_COPY + #define Q_DISABLE_COPY(className) \ + className(const className &) = delete;\ + className &operator=(const className &) = delete; +#endif + +// Compatibility with Qt < 5.13 +#ifndef Q_DISABLE_COPY_MOVE + #define Q_DISABLE_COPY_MOVE(className) \ + className(className & other) = delete;\ + className(className && other) = delete; +#endif + +// Compatibility with Qt < 5.15 +#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) + #define QTCOMPAT_ENDL endl +#else + #define QTCOMPAT_ENDL Qt::endl +#endif + +// Compatibility with Qt < 5.15 +#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) + #define QTCOMPAT_KEEP_EMPTY_PARTS QString::KeepEmptyParts +#else + #define QTCOMPAT_KEEP_EMPTY_PARTS Qt::KeepEmptyParts +#endif + +// Compatibility with Qt < 5.15 +#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) + #define QTCOMPAT_SPLIT_BEHAVIOR QString::SplitBehavior +#else + #define QTCOMPAT_SPLIT_BEHAVIOR Qt::SplitBehavior +#endif + +// Compatibility with Qt < 5.15 +#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) + #define QTCOMPAT_SKIP_EMPTY_PARTS QString::SkipEmptyParts +#else + #define QTCOMPAT_SKIP_EMPTY_PARTS Qt::SkipEmptyParts +#endif + +// Compatibility with Qt < 5.14 +#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) + #define QTCOMPAT_DECLARE_RECURSIVE_MUTEX(name) QMutex name { QMutex::Recursive } +#else + #define QTCOMPAT_DECLARE_RECURSIVE_MUTEX(name) QRecursiveMutex name +#endif diff --git a/libraries/shared/src/shared/FileUtils.cpp b/libraries/shared/src/shared/FileUtils.cpp index c23a262f681..983ead6a110 100644 --- a/libraries/shared/src/shared/FileUtils.cpp +++ b/libraries/shared/src/shared/FileUtils.cpp @@ -4,6 +4,7 @@ // // Created by Stojce Slavkovski on 12/23/13. // Copyright 2013 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -14,6 +15,7 @@ #include +#include "../QtCompatibility.h" #include #include #include @@ -67,15 +69,9 @@ QString FileUtils::readFile(const QString& filename) { return result; } -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) -QStringList FileUtils::readLines(const QString& filename, QString::SplitBehavior splitBehavior) { - return readFile(filename).split(QRegularExpression("[\\r\\n]"), QString::SkipEmptyParts); +QStringList FileUtils::readLines(const QString& filename, QTCOMPAT_SPLIT_BEHAVIOR splitBehavior) { + return readFile(filename).split(QRegularExpression("[\\r\\n]"), QTCOMPAT_SKIP_EMPTY_PARTS); } -#else -QStringList FileUtils::readLines(const QString& filename, Qt::SplitBehavior splitBehavior) { - return readFile(filename).split(QRegularExpression("[\\r\\n]"), Qt::SkipEmptyParts); -} -#endif void FileUtils::locateFile(const QString& filePath) { diff --git a/libraries/shared/src/shared/FileUtils.h b/libraries/shared/src/shared/FileUtils.h index 9c0237456c9..84d89ba4bb2 100644 --- a/libraries/shared/src/shared/FileUtils.h +++ b/libraries/shared/src/shared/FileUtils.h @@ -4,6 +4,7 @@ // // Created by Stojce Slavkovski on 12/23/13. // Copyright 2013 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -12,6 +13,7 @@ #ifndef hifi_FileUtils_h #define hifi_FileUtils_h +#include "../QtCompatibility.h" #include class FileUtils { @@ -24,11 +26,7 @@ class FileUtils { static bool isRelative(const QString& fileName); static QString standardPath(QString subfolder); static QString readFile(const QString& filename); -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - static QStringList readLines(const QString& filename, QString::SplitBehavior splitBehavior = QString::KeepEmptyParts); -#else - static QStringList readLines(const QString& filename, Qt::SplitBehavior splitBehavior = Qt::KeepEmptyParts); -#endif + static QStringList readLines(const QString& filename, QTCOMPAT_SPLIT_BEHAVIOR splitBehavior = QTCOMPAT_KEEP_EMPTY_PARTS); static QString replaceDateTimeTokens(const QString& path); static QString computeDocumentPath(const QString& path); static bool canCreateFile(const QString& fullPath); diff --git a/libraries/ui/src/VrMenu.cpp b/libraries/ui/src/VrMenu.cpp index f7a2132aeac..8003337eac6 100644 --- a/libraries/ui/src/VrMenu.cpp +++ b/libraries/ui/src/VrMenu.cpp @@ -141,11 +141,7 @@ class MenuUserData : public QObjectUserData { } private: -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - MenuUserData(const MenuUserData&); -#else Q_DISABLE_COPY(MenuUserData); -#endif QMetaObject::Connection _shutdownConnection; QMetaObject::Connection _changedConnection; diff --git a/tools/ac-client/src/ACClientApp.cpp b/tools/ac-client/src/ACClientApp.cpp index a709b150be4..e2dfc390d5c 100644 --- a/tools/ac-client/src/ACClientApp.cpp +++ b/tools/ac-client/src/ACClientApp.cpp @@ -4,6 +4,7 @@ // // Created by Seth Alves on 2016-10-5 // Copyright 2015 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -11,6 +12,7 @@ #include "ACClientApp.h" +#include "QtCompatibility.h" #include #include #include @@ -49,11 +51,7 @@ ACClientApp::ACClientApp(int argc, char* argv[]) : parser.addOption(listenPortOption); if (!parser.parse(QCoreApplication::arguments())) { -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - qCritical() << parser.errorText() << endl; -#else - qCritical() << parser.errorText() << Qt::endl; -#endif + qCritical() << parser.errorText() << QTCOMPAT_ENDL; parser.showHelp(); Q_UNREACHABLE(); } diff --git a/tools/atp-client/src/ATPClientApp.cpp b/tools/atp-client/src/ATPClientApp.cpp index 8682a77edad..b900f9bec89 100644 --- a/tools/atp-client/src/ATPClientApp.cpp +++ b/tools/atp-client/src/ATPClientApp.cpp @@ -4,6 +4,7 @@ // // Created by Seth Alves on 2017-3-15 // Copyright 2017 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -11,6 +12,7 @@ #include "ATPClientApp.h" +#include "QtCompatibility.h" #include #include #include @@ -59,11 +61,7 @@ ATPClientApp::ATPClientApp(int argc, char* argv[]) : parser.addOption(listenPortOption); if (!parser.parse(QCoreApplication::arguments())) { -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - qCritical() << parser.errorText() << endl; -#else - qCritical() << parser.errorText() << Qt::endl; -#endif + qCritical() << parser.errorText() << QTCOMPAT_ENDL; parser.showHelp(); Q_UNREACHABLE(); } diff --git a/tools/ice-client/src/ICEClientApp.cpp b/tools/ice-client/src/ICEClientApp.cpp index 6e842c79793..84d743e8958 100644 --- a/tools/ice-client/src/ICEClientApp.cpp +++ b/tools/ice-client/src/ICEClientApp.cpp @@ -5,6 +5,7 @@ // Created by Seth Alves on 3/5/15. // Copyright 2015 High Fidelity, Inc. // Copyright 2021 Vircadia contributors. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -12,6 +13,7 @@ #include "ICEClientApp.h" +#include "QtCompatibility.h" #include #include #include @@ -47,11 +49,7 @@ ICEClientApp::ICEClientApp(int argc, char* argv[]) : parser.addOption(cacheSTUNOption); if (!parser.parse(QCoreApplication::arguments())) { -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - qCritical() << parser.errorText() << endl; -#else - qCritical() << parser.errorText() << Qt::endl; -#endif + qCritical() << parser.errorText() << QTCOMPAT_ENDL; parser.showHelp(); Q_UNREACHABLE(); } diff --git a/tools/nitpick/src/TestCreator.cpp b/tools/nitpick/src/TestCreator.cpp index d3cdb0a6868..c16b7f46f16 100644 --- a/tools/nitpick/src/TestCreator.cpp +++ b/tools/nitpick/src/TestCreator.cpp @@ -3,6 +3,7 @@ // // Created by Nissim Hadar on 2 Nov 2017. // Copyright 2013 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -10,6 +11,7 @@ #include "TestCreator.h" #include +#include "QtCompatibility.h" #include #include #include @@ -207,20 +209,11 @@ void TestCreator::appendTestResultsToFile(const TestResult& testResult, const QP // Create text file describing the failure QTextStream stream(&descriptionFile); -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - stream << "TestCreator in folder " << testResult._pathname.left(testResult._pathname.length() - 1) << endl; // remove trailing '/' - stream << "Expected image was " << testResult._expectedImageFilename << endl; - stream << "Actual image was " << testResult._actualImageFilename << endl; - stream << "Similarity index was " << testResult._errorGlobal << endl; - stream << "Worst tile was " << testResult._errorLocal << endl; -#else - stream << "TestCreator in folder " << testResult._pathname.left(testResult._pathname.length() - 1) << Qt::endl; // remove trailing '/' - stream << "Expected image was " << testResult._expectedImageFilename << Qt::endl; - stream << "Actual image was " << testResult._actualImageFilename << Qt::endl; - stream << "Similarity index was " << testResult._errorGlobal << Qt::endl; - stream << "Worst tile was " << testResult._errorLocal << Qt::endl; -#endif - + stream << "TestCreator in folder " << testResult._pathname.left(testResult._pathname.length() - 1) << QTCOMPAT_ENDL; // remove trailing '/' + stream << "Expected image was " << testResult._expectedImageFilename << QTCOMPAT_ENDL; + stream << "Actual image was " << testResult._actualImageFilename << QTCOMPAT_ENDL; + stream << "Similarity index was " << testResult._errorGlobal << QTCOMPAT_ENDL; + stream << "Worst tile was " << testResult._errorLocal << QTCOMPAT_ENDL; descriptionFile.close(); @@ -424,11 +417,7 @@ void TestCreator::includeTest(QTextStream& textStream, const QString& testPathna QString partialPath = extractPathFromTestsDown(testPathname); QString partialPathWithoutTests = partialPath.right(partialPath.length() - 7); -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - textStream << "Script.include(testsRootPath + \"" << partialPathWithoutTests + "\");" << endl; -#else - textStream << "Script.include(testsRootPath + \"" << partialPathWithoutTests + "\");" << Qt::endl; -#endif + textStream << "Script.include(testsRootPath + \"" << partialPathWithoutTests + "\");" << QTCOMPAT_ENDL; } void TestCreator::createTests(const QString& clientProfile) { @@ -1007,73 +996,39 @@ void TestCreator::createRecursiveScript(const QString& directory, bool interacti QTextStream textStream(&recursiveTestsFile); -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - textStream << "// This is an automatically generated file, created by nitpick" << endl; -#else - textStream << "// This is an automatically generated file, created by nitpick" << Qt::endl; -#endif + textStream << "// This is an automatically generated file, created by nitpick" << QTCOMPAT_ENDL; // Include 'nitpick.js' QString branch = nitpick->getSelectedBranch(); QString user = nitpick->getSelectedUser(); -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - textStream << "PATH_TO_THE_REPO_PATH_UTILS_FILE = \"https://raw.githubusercontent.com/" + user + "/hifi_tests/" + branch + - "/tests/utils/branchUtils.js\";" - << endl; - textStream << "Script.include(PATH_TO_THE_REPO_PATH_UTILS_FILE);" << endl << endl; - - // The 'depth' variable is used to signal when to start running the recursive scripts - textStream << "if (typeof depth === 'undefined') {" << endl; - textStream << " depth = 0;" << endl; - textStream << " nitpick = createNitpick(Script.resolvePath(\".\"));" << endl; - textStream << " testsRootPath = nitpick.getTestsRootPath();" << endl << endl; - textStream << " nitpick.enableRecursive();" << endl; - textStream << " nitpick.enableAuto();" << endl; - textStream << "} else {" << endl; - textStream << " depth++" << endl; - textStream << "}" << endl << endl; - - // Now include the test scripts - for (int i = 0; i < directories.length(); ++i) { - includeTest(textStream, directories.at(i)); - } - - textStream << endl; - textStream << "if (depth > 0) {" << endl; - textStream << " depth--;" << endl; - textStream << "} else {" << endl; - textStream << " nitpick.runRecursive();" << endl; - textStream << "}" << endl << endl; -#else textStream << "PATH_TO_THE_REPO_PATH_UTILS_FILE = \"https://raw.githubusercontent.com/" + user + "/hifi_tests/" + branch + "/tests/utils/branchUtils.js\";" - << Qt::endl; - textStream << "Script.include(PATH_TO_THE_REPO_PATH_UTILS_FILE);" << Qt::endl << Qt::endl; + << QTCOMPAT_ENDL; + textStream << "Script.include(PATH_TO_THE_REPO_PATH_UTILS_FILE);" << QTCOMPAT_ENDL << QTCOMPAT_ENDL; // The 'depth' variable is used to signal when to start running the recursive scripts - textStream << "if (typeof depth === 'undefined') {" << Qt::endl; - textStream << " depth = 0;" << Qt::endl; - textStream << " nitpick = createNitpick(Script.resolvePath(\".\"));" << Qt::endl; - textStream << " testsRootPath = nitpick.getTestsRootPath();" << Qt::endl << Qt::endl; - textStream << " nitpick.enableRecursive();" << Qt::endl; - textStream << " nitpick.enableAuto();" << Qt::endl; - textStream << "} else {" << Qt::endl; - textStream << " depth++" << Qt::endl; - textStream << "}" << Qt::endl << Qt::endl; + textStream << "if (typeof depth === 'undefined') {" << QTCOMPAT_ENDL; + textStream << " depth = 0;" << QTCOMPAT_ENDL; + textStream << " nitpick = createNitpick(Script.resolvePath(\".\"));" << QTCOMPAT_ENDL; + textStream << " testsRootPath = nitpick.getTestsRootPath();" << QTCOMPAT_ENDL << QTCOMPAT_ENDL; + textStream << " nitpick.enableRecursive();" << QTCOMPAT_ENDL; + textStream << " nitpick.enableAuto();" << QTCOMPAT_ENDL; + textStream << "} else {" << QTCOMPAT_ENDL; + textStream << " depth++" << QTCOMPAT_ENDL; + textStream << "}" << QTCOMPAT_ENDL << QTCOMPAT_ENDL; // Now include the test scripts for (int i = 0; i < directories.length(); ++i) { includeTest(textStream, directories.at(i)); } - textStream << Qt::endl; - textStream << "if (depth > 0) {" << Qt::endl; - textStream << " depth--;" << Qt::endl; - textStream << "} else {" << Qt::endl; - textStream << " nitpick.runRecursive();" << Qt::endl; - textStream << "}" << Qt::endl << Qt::endl; -#endif + textStream << QTCOMPAT_ENDL; + textStream << "if (depth > 0) {" << QTCOMPAT_ENDL; + textStream << " depth--;" << QTCOMPAT_ENDL; + textStream << "} else {" << QTCOMPAT_ENDL; + textStream << " nitpick.runRecursive();" << QTCOMPAT_ENDL; + textStream << "}" << QTCOMPAT_ENDL << QTCOMPAT_ENDL; recursiveTestsFile.close(); diff --git a/tools/skeleton-dump/src/SkeletonDumpApp.cpp b/tools/skeleton-dump/src/SkeletonDumpApp.cpp index 7445daf2c94..40267a440e0 100644 --- a/tools/skeleton-dump/src/SkeletonDumpApp.cpp +++ b/tools/skeleton-dump/src/SkeletonDumpApp.cpp @@ -4,12 +4,14 @@ // // Created by Anthony Thibault on 11/4/16. // Copyright 2016 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #include "SkeletonDumpApp.h" +#include "QtCompatibility.h" #include #include #include @@ -29,11 +31,7 @@ SkeletonDumpApp::SkeletonDumpApp(int argc, char* argv[]) : QCoreApplication(argc parser.addOption(inputFilenameOption); if (!parser.parse(QCoreApplication::arguments())) { -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - qCritical() << parser.errorText() << endl; -#else - qCritical() << parser.errorText() << Qt::endl; -#endif + qCritical() << parser.errorText() << QTCOMPAT_ENDL; parser.showHelp(); _returnCode = 1; return; diff --git a/tools/vhacd-util/src/VHACDUtilApp.cpp b/tools/vhacd-util/src/VHACDUtilApp.cpp index bc9e79c2f7b..09ccf023298 100644 --- a/tools/vhacd-util/src/VHACDUtilApp.cpp +++ b/tools/vhacd-util/src/VHACDUtilApp.cpp @@ -4,6 +4,7 @@ // // Created by Seth Alves on 3/5/15. // Copyright 2015 High Fidelity, Inc. +// Copyright 2022 Overte e.V. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -11,6 +12,7 @@ #include "VHACDUtilApp.h" +#include "QtCompatibility.h" #include #include @@ -188,11 +190,7 @@ VHACDUtilApp::VHACDUtilApp(int argc, char* argv[]) : if (!parser.parse(QCoreApplication::arguments())) { -#if (QT_VERSION < QT_VERSION_CHECK(5, 14, 0)) - qCritical() << parser.errorText() << endl; -#else - qCritical() << parser.errorText() << Qt::endl; -#endif + qCritical() << parser.errorText() << QTCOMPAT_ENDL; parser.showHelp(); Q_UNREACHABLE(); }