diff --git a/assignment-client/src/AssignmentClient.cpp b/assignment-client/src/AssignmentClient.cpp index 2db1fba952..efced972a0 100644 --- a/assignment-client/src/AssignmentClient.cpp +++ b/assignment-client/src/AssignmentClient.cpp @@ -142,7 +142,7 @@ void AssignmentClient::stopAssignmentClient() { QThread* currentAssignmentThread = _currentAssignment->thread(); // ask the current assignment to stop - hifi::qt::blockingInvokeMethod(_currentAssignment, "stop"); + BLOCKING_INVOKE_METHOD(_currentAssignment, "stop"); // ask the current assignment to delete itself on its thread _currentAssignment->deleteLater(); diff --git a/assignment-client/src/avatars/ScriptableAvatar.cpp b/assignment-client/src/avatars/ScriptableAvatar.cpp index 4e2836119e..6443e7bf4b 100644 --- a/assignment-client/src/avatars/ScriptableAvatar.cpp +++ b/assignment-client/src/avatars/ScriptableAvatar.cpp @@ -50,7 +50,7 @@ void ScriptableAvatar::stopAnimation() { AnimationDetails ScriptableAvatar::getAnimationDetails() { if (QThread::currentThread() != thread()) { AnimationDetails result; - hifi::qt::blockingInvokeMethod(this, "getAnimationDetails", + BLOCKING_INVOKE_METHOD(this, "getAnimationDetails", Q_RETURN_ARG(AnimationDetails, result)); return result; } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 2b6c6033a2..d5b6f06d45 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1656,7 +1656,7 @@ QString Application::getUserAgent() { if (QThread::currentThread() != thread()) { QString userAgent; - hifi::qt::blockingInvokeMethod(this, "getUserAgent", Q_RETURN_ARG(QString, userAgent)); + BLOCKING_INVOKE_METHOD(this, "getUserAgent", Q_RETURN_ARG(QString, userAgent)); return userAgent; } diff --git a/interface/src/avatar/AvatarManager.cpp b/interface/src/avatar/AvatarManager.cpp index abdcd48b42..c46d61cf68 100644 --- a/interface/src/avatar/AvatarManager.cpp +++ b/interface/src/avatar/AvatarManager.cpp @@ -483,7 +483,7 @@ RayToAvatarIntersectionResult AvatarManager::findRayIntersection(const PickRay& const QScriptValue& avatarIdsToDiscard) { RayToAvatarIntersectionResult result; if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(const_cast(this), "findRayIntersection", + BLOCKING_INVOKE_METHOD(const_cast(this), "findRayIntersection", Q_RETURN_ARG(RayToAvatarIntersectionResult, result), Q_ARG(const PickRay&, ray), Q_ARG(const QScriptValue&, avatarIdsToInclude), diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 404f8681f2..230ea7616a 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -898,7 +898,7 @@ void MyAvatar::restoreAnimation() { QStringList MyAvatar::getAnimationRoles() { if (QThread::currentThread() != thread()) { QStringList result; - hifi::qt::blockingInvokeMethod(this, "getAnimationRoles", Q_RETURN_ARG(QStringList, result)); + BLOCKING_INVOKE_METHOD(this, "getAnimationRoles", Q_RETURN_ARG(QStringList, result)); return result; } return _skeletonModel->getRig().getAnimationRoles(); @@ -1369,7 +1369,7 @@ void MyAvatar::resetFullAvatarURL() { void MyAvatar::useFullAvatarURL(const QUrl& fullAvatarURL, const QString& modelName) { if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "useFullAvatarURL", + BLOCKING_INVOKE_METHOD(this, "useFullAvatarURL", Q_ARG(const QUrl&, fullAvatarURL), Q_ARG(const QString&, modelName)); return; @@ -1395,7 +1395,7 @@ void MyAvatar::useFullAvatarURL(const QUrl& fullAvatarURL, const QString& modelN void MyAvatar::setAttachmentData(const QVector& attachmentData) { if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "setAttachmentData", + BLOCKING_INVOKE_METHOD(this, "setAttachmentData", Q_ARG(const QVector, attachmentData)); return; } @@ -2359,7 +2359,7 @@ bool MyAvatar::safeLanding(const glm::vec3& position) { if (QThread::currentThread() != thread()) { bool result; - hifi::qt::blockingInvokeMethod(this, "safeLanding", Q_RETURN_ARG(bool, result), Q_ARG(const glm::vec3&, position)); + BLOCKING_INVOKE_METHOD(this, "safeLanding", Q_RETURN_ARG(bool, result), Q_ARG(const glm::vec3&, position)); return result; } glm::vec3 better; diff --git a/interface/src/scripting/ClipboardScriptingInterface.cpp b/interface/src/scripting/ClipboardScriptingInterface.cpp index b443ba1ef0..f8db061299 100644 --- a/interface/src/scripting/ClipboardScriptingInterface.cpp +++ b/interface/src/scripting/ClipboardScriptingInterface.cpp @@ -27,7 +27,7 @@ float ClipboardScriptingInterface::getClipboardContentsLargestDimension() { bool ClipboardScriptingInterface::exportEntities(const QString& filename, const QVector& entityIDs) { bool retVal; - hifi::qt::blockingInvokeMethod(qApp, "exportEntities", + BLOCKING_INVOKE_METHOD(qApp, "exportEntities", Q_RETURN_ARG(bool, retVal), Q_ARG(const QString&, filename), Q_ARG(const QVector&, entityIDs)); @@ -36,7 +36,7 @@ bool ClipboardScriptingInterface::exportEntities(const QString& filename, const bool ClipboardScriptingInterface::exportEntities(const QString& filename, float x, float y, float z, float s) { bool retVal; - hifi::qt::blockingInvokeMethod(qApp, "exportEntities", + BLOCKING_INVOKE_METHOD(qApp, "exportEntities", Q_RETURN_ARG(bool, retVal), Q_ARG(const QString&, filename), Q_ARG(float, x), @@ -48,7 +48,7 @@ bool ClipboardScriptingInterface::exportEntities(const QString& filename, float bool ClipboardScriptingInterface::importEntities(const QString& filename) { bool retVal; - hifi::qt::blockingInvokeMethod(qApp, "importEntities", + BLOCKING_INVOKE_METHOD(qApp, "importEntities", Q_RETURN_ARG(bool, retVal), Q_ARG(const QString&, filename)); return retVal; @@ -56,7 +56,7 @@ bool ClipboardScriptingInterface::importEntities(const QString& filename) { QVector ClipboardScriptingInterface::pasteEntities(glm::vec3 position) { QVector retVal; - hifi::qt::blockingInvokeMethod(qApp, "pasteEntities", + BLOCKING_INVOKE_METHOD(qApp, "pasteEntities", Q_RETURN_ARG(QVector, retVal), Q_ARG(float, position.x), Q_ARG(float, position.y), diff --git a/interface/src/scripting/HMDScriptingInterface.cpp b/interface/src/scripting/HMDScriptingInterface.cpp index 81a806b8ab..35f2e2aa86 100644 --- a/interface/src/scripting/HMDScriptingInterface.cpp +++ b/interface/src/scripting/HMDScriptingInterface.cpp @@ -156,7 +156,7 @@ QString HMDScriptingInterface::preferredAudioOutput() const { bool HMDScriptingInterface::setHandLasers(int hands, bool enabled, const glm::vec4& color, const glm::vec3& direction) { if (QThread::currentThread() != thread()) { bool result; - hifi::qt::blockingInvokeMethod(this, "setHandLasers", Q_RETURN_ARG(bool, result), + BLOCKING_INVOKE_METHOD(this, "setHandLasers", Q_RETURN_ARG(bool, result), Q_ARG(int, hands), Q_ARG(bool, enabled), Q_ARG(glm::vec4, color), Q_ARG(glm::vec3, direction)); return result; } @@ -171,7 +171,7 @@ bool HMDScriptingInterface::setHandLasers(int hands, bool enabled, const glm::ve bool HMDScriptingInterface::setExtraLaser(const glm::vec3& worldStart, bool enabled, const glm::vec4& color, const glm::vec3& direction) { if (QThread::currentThread() != thread()) { bool result; - hifi::qt::blockingInvokeMethod(this, "setExtraLaser", Q_RETURN_ARG(bool, result), + BLOCKING_INVOKE_METHOD(this, "setExtraLaser", Q_RETURN_ARG(bool, result), Q_ARG(glm::vec3, worldStart), Q_ARG(bool, enabled), Q_ARG(glm::vec4, color), Q_ARG(glm::vec3, direction)); return result; } diff --git a/interface/src/scripting/MenuScriptingInterface.cpp b/interface/src/scripting/MenuScriptingInterface.cpp index b3829ecb3b..d9372978e8 100644 --- a/interface/src/scripting/MenuScriptingInterface.cpp +++ b/interface/src/scripting/MenuScriptingInterface.cpp @@ -44,7 +44,7 @@ bool MenuScriptingInterface::menuExists(const QString& menu) { return Menu::getInstance()->menuExists(menu); } bool result; - hifi::qt::blockingInvokeMethod(Menu::getInstance(), "menuExists", + BLOCKING_INVOKE_METHOD(Menu::getInstance(), "menuExists", Q_RETURN_ARG(bool, result), Q_ARG(const QString&, menu)); return result; @@ -87,7 +87,7 @@ bool MenuScriptingInterface::menuItemExists(const QString& menu, const QString& return Menu::getInstance()->menuItemExists(menu, menuitem); } bool result; - hifi::qt::blockingInvokeMethod(Menu::getInstance(), "menuItemExists", + BLOCKING_INVOKE_METHOD(Menu::getInstance(), "menuItemExists", Q_RETURN_ARG(bool, result), Q_ARG(const QString&, menu), Q_ARG(const QString&, menuitem)); @@ -115,7 +115,7 @@ bool MenuScriptingInterface::isOptionChecked(const QString& menuOption) { return Menu::getInstance()->isOptionChecked(menuOption); } bool result; - hifi::qt::blockingInvokeMethod(Menu::getInstance(), "isOptionChecked", + BLOCKING_INVOKE_METHOD(Menu::getInstance(), "isOptionChecked", Q_RETURN_ARG(bool, result), Q_ARG(const QString&, menuOption)); return result; @@ -132,7 +132,7 @@ bool MenuScriptingInterface::isMenuEnabled(const QString& menuOption) { return Menu::getInstance()->isOptionChecked(menuOption); } bool result; - hifi::qt::blockingInvokeMethod(Menu::getInstance(), "isMenuEnabled", + BLOCKING_INVOKE_METHOD(Menu::getInstance(), "isMenuEnabled", Q_RETURN_ARG(bool, result), Q_ARG(const QString&, menuOption)); return result; @@ -158,7 +158,7 @@ bool MenuScriptingInterface::isInfoViewVisible(const QString& path) { } bool result; - hifi::qt::blockingInvokeMethod(Menu::getInstance(), "isInfoViewVisible", + BLOCKING_INVOKE_METHOD(Menu::getInstance(), "isInfoViewVisible", Q_RETURN_ARG(bool, result), Q_ARG(const QString&, path)); return result; } diff --git a/interface/src/scripting/TestScriptingInterface.cpp b/interface/src/scripting/TestScriptingInterface.cpp index 4d3e3b94a1..d4b4ba1480 100644 --- a/interface/src/scripting/TestScriptingInterface.cpp +++ b/interface/src/scripting/TestScriptingInterface.cpp @@ -60,7 +60,7 @@ void TestScriptingInterface::waitIdle() { bool TestScriptingInterface::loadTestScene(QString scene) { if (QThread::currentThread() != thread()) { bool result; - hifi::qt::blockingInvokeMethod(this, "loadTestScene", Q_RETURN_ARG(bool, result), Q_ARG(QString, scene)); + BLOCKING_INVOKE_METHOD(this, "loadTestScene", Q_RETURN_ARG(bool, result), Q_ARG(QString, scene)); return result; } diff --git a/interface/src/scripting/WindowScriptingInterface.cpp b/interface/src/scripting/WindowScriptingInterface.cpp index a5d8544658..84f4cbbbd8 100644 --- a/interface/src/scripting/WindowScriptingInterface.cpp +++ b/interface/src/scripting/WindowScriptingInterface.cpp @@ -317,7 +317,7 @@ bool WindowScriptingInterface::isPhysicsEnabled() { int WindowScriptingInterface::openMessageBox(QString title, QString text, int buttons, int defaultButton) { if (QThread::currentThread() != thread()) { int result; - hifi::qt::blockingInvokeMethod(this, "openMessageBox", + BLOCKING_INVOKE_METHOD(this, "openMessageBox", Q_RETURN_ARG(int, result), Q_ARG(QString, title), Q_ARG(QString, text), diff --git a/interface/src/ui/JSConsole.cpp b/interface/src/ui/JSConsole.cpp index 4b03d1b575..443f11fb23 100644 --- a/interface/src/ui/JSConsole.cpp +++ b/interface/src/ui/JSConsole.cpp @@ -116,7 +116,7 @@ void JSConsole::executeCommand(const QString& command) { QScriptValue JSConsole::executeCommandInWatcher(const QString& command) { QScriptValue result; - hifi::qt::blockingInvokeMethod(_scriptEngine, "evaluate", + BLOCKING_INVOKE_METHOD(_scriptEngine, "evaluate", Q_RETURN_ARG(QScriptValue, result), Q_ARG(const QString&, command), Q_ARG(const QString&, _consoleFileName)); diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index c27800a5bb..0c73f1fa70 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -145,7 +145,7 @@ Overlay::Pointer Overlays::getOverlay(OverlayID id) const { OverlayID Overlays::addOverlay(const QString& type, const QVariant& properties) { if (QThread::currentThread() != thread()) { OverlayID result; - hifi::qt::blockingInvokeMethod(this, "addOverlay", Q_RETURN_ARG(OverlayID, result), Q_ARG(QString, type), Q_ARG(QVariant, properties)); + BLOCKING_INVOKE_METHOD(this, "addOverlay", Q_RETURN_ARG(OverlayID, result), Q_ARG(QString, type), Q_ARG(QVariant, properties)); return result; } @@ -209,7 +209,7 @@ OverlayID Overlays::addOverlay(const Overlay::Pointer& overlay) { OverlayID Overlays::cloneOverlay(OverlayID id) { if (QThread::currentThread() != thread()) { OverlayID result; - hifi::qt::blockingInvokeMethod(this, "cloneOverlay", Q_RETURN_ARG(OverlayID, result), Q_ARG(OverlayID, id)); + BLOCKING_INVOKE_METHOD(this, "cloneOverlay", Q_RETURN_ARG(OverlayID, result), Q_ARG(OverlayID, id)); return result; } @@ -232,7 +232,7 @@ OverlayID Overlays::cloneOverlay(OverlayID id) { bool Overlays::editOverlay(OverlayID id, const QVariant& properties) { if (QThread::currentThread() != thread()) { bool result; - hifi::qt::blockingInvokeMethod(this, "editOverlay", Q_RETURN_ARG(bool, result), Q_ARG(OverlayID, id), Q_ARG(QVariant, properties)); + BLOCKING_INVOKE_METHOD(this, "editOverlay", Q_RETURN_ARG(bool, result), Q_ARG(OverlayID, id), Q_ARG(QVariant, properties)); return result; } @@ -247,7 +247,7 @@ bool Overlays::editOverlay(OverlayID id, const QVariant& properties) { bool Overlays::editOverlays(const QVariant& propertiesById) { if (QThread::currentThread() != thread()) { bool result; - hifi::qt::blockingInvokeMethod(this, "editOverlays", Q_RETURN_ARG(bool, result), Q_ARG(QVariant, propertiesById)); + BLOCKING_INVOKE_METHOD(this, "editOverlays", Q_RETURN_ARG(bool, result), Q_ARG(QVariant, propertiesById)); return result; } @@ -299,7 +299,7 @@ void Overlays::deleteOverlay(OverlayID id) { QString Overlays::getOverlayType(OverlayID overlayId) { if (QThread::currentThread() != thread()) { QString result; - hifi::qt::blockingInvokeMethod(this, "getOverlayType", Q_RETURN_ARG(QString, result), Q_ARG(OverlayID, overlayId)); + BLOCKING_INVOKE_METHOD(this, "getOverlayType", Q_RETURN_ARG(QString, result), Q_ARG(OverlayID, overlayId)); return result; } @@ -313,7 +313,7 @@ QString Overlays::getOverlayType(OverlayID overlayId) { QObject* Overlays::getOverlayObject(OverlayID id) { if (QThread::currentThread() != thread()) { QObject* result; - hifi::qt::blockingInvokeMethod(this, "getOverlayObject", Q_RETURN_ARG(QObject*, result), Q_ARG(OverlayID, id)); + BLOCKING_INVOKE_METHOD(this, "getOverlayObject", Q_RETURN_ARG(QObject*, result), Q_ARG(OverlayID, id)); return result; } @@ -370,7 +370,7 @@ void Overlays::setParentPanel(OverlayID childId, OverlayID panelId) { OverlayID Overlays::getOverlayAtPoint(const glm::vec2& point) { if (QThread::currentThread() != thread()) { OverlayID result; - hifi::qt::blockingInvokeMethod(this, "getOverlayAtPoint", Q_RETURN_ARG(OverlayID, result), Q_ARG(glm::vec2, point)); + BLOCKING_INVOKE_METHOD(this, "getOverlayAtPoint", Q_RETURN_ARG(OverlayID, result), Q_ARG(glm::vec2, point)); return result; } @@ -408,7 +408,7 @@ OverlayID Overlays::getOverlayAtPoint(const glm::vec2& point) { OverlayPropertyResult Overlays::getProperty(OverlayID id, const QString& property) { if (QThread::currentThread() != thread()) { OverlayPropertyResult result; - hifi::qt::blockingInvokeMethod(this, "getProperty", Q_RETURN_ARG(OverlayPropertyResult, result), Q_ARG(OverlayID, id), Q_ARG(QString, property)); + BLOCKING_INVOKE_METHOD(this, "getProperty", Q_RETURN_ARG(OverlayPropertyResult, result), Q_ARG(OverlayID, id), Q_ARG(QString, property)); return result; } @@ -453,7 +453,7 @@ RayToOverlayIntersectionResult Overlays::findRayIntersectionInternal(const PickR bool visibleOnly, bool collidableOnly) { if (QThread::currentThread() != thread()) { RayToOverlayIntersectionResult result; - hifi::qt::blockingInvokeMethod(this, "findRayIntersectionInternal", Q_RETURN_ARG(RayToOverlayIntersectionResult, result), + BLOCKING_INVOKE_METHOD(this, "findRayIntersectionInternal", Q_RETURN_ARG(RayToOverlayIntersectionResult, result), Q_ARG(PickRay, ray), Q_ARG(bool, precisionPicking), Q_ARG(QVector, overlaysToInclude), @@ -580,7 +580,7 @@ void RayToOverlayIntersectionResultFromScriptValue(const QScriptValue& objectVar bool Overlays::isLoaded(OverlayID id) { if (QThread::currentThread() != thread()) { bool result; - hifi::qt::blockingInvokeMethod(this, "isLoaded", Q_RETURN_ARG(bool, result), Q_ARG(OverlayID, id)); + BLOCKING_INVOKE_METHOD(this, "isLoaded", Q_RETURN_ARG(bool, result), Q_ARG(OverlayID, id)); return result; } @@ -594,7 +594,7 @@ bool Overlays::isLoaded(OverlayID id) { QSizeF Overlays::textSize(OverlayID id, const QString& text) { if (QThread::currentThread() != thread()) { QSizeF result; - hifi::qt::blockingInvokeMethod(this, "textSize", Q_RETURN_ARG(QSizeF, result), Q_ARG(OverlayID, id), Q_ARG(QString, text)); + BLOCKING_INVOKE_METHOD(this, "textSize", Q_RETURN_ARG(QSizeF, result), Q_ARG(OverlayID, id), Q_ARG(QString, text)); return result; } @@ -671,7 +671,7 @@ void Overlays::deletePanel(OverlayID panelId) { bool Overlays::isAddedOverlay(OverlayID id) { if (QThread::currentThread() != thread()) { bool result; - hifi::qt::blockingInvokeMethod(this, "isAddedOverlay", Q_RETURN_ARG(bool, result), Q_ARG(OverlayID, id)); + BLOCKING_INVOKE_METHOD(this, "isAddedOverlay", Q_RETURN_ARG(bool, result), Q_ARG(OverlayID, id)); return result; } @@ -705,7 +705,7 @@ void Overlays::sendHoverLeaveOverlay(OverlayID id, PointerEvent event) { OverlayID Overlays::getKeyboardFocusOverlay() { if (QThread::currentThread() != thread()) { OverlayID result; - hifi::qt::blockingInvokeMethod(this, "getKeyboardFocusOverlay", Q_RETURN_ARG(OverlayID, result)); + BLOCKING_INVOKE_METHOD(this, "getKeyboardFocusOverlay", Q_RETURN_ARG(OverlayID, result)); return result; } @@ -724,7 +724,7 @@ void Overlays::setKeyboardFocusOverlay(OverlayID id) { float Overlays::width() { if (QThread::currentThread() != thread()) { float result; - hifi::qt::blockingInvokeMethod(this, "width", Q_RETURN_ARG(float, result)); + BLOCKING_INVOKE_METHOD(this, "width", Q_RETURN_ARG(float, result)); return result; } @@ -735,7 +735,7 @@ float Overlays::width() { float Overlays::height() { if (QThread::currentThread() != thread()) { float result; - hifi::qt::blockingInvokeMethod(this, "height", Q_RETURN_ARG(float, result)); + BLOCKING_INVOKE_METHOD(this, "height", Q_RETURN_ARG(float, result)); return result; } @@ -945,7 +945,7 @@ bool Overlays::mouseMoveEvent(QMouseEvent* event) { QVector Overlays::findOverlays(const glm::vec3& center, float radius) { QVector result; if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "findOverlays", Q_RETURN_ARG(QVector, result), Q_ARG(glm::vec3, center), Q_ARG(float, radius)); + BLOCKING_INVOKE_METHOD(this, "findOverlays", Q_RETURN_ARG(QVector, result), Q_ARG(glm::vec3, center), Q_ARG(float, radius)); return result; } diff --git a/libraries/animation/src/AnimationCache.cpp b/libraries/animation/src/AnimationCache.cpp index 0bca721464..9aa315beb8 100644 --- a/libraries/animation/src/AnimationCache.cpp +++ b/libraries/animation/src/AnimationCache.cpp @@ -34,7 +34,7 @@ AnimationCache::AnimationCache(QObject* parent) : AnimationPointer AnimationCache::getAnimation(const QUrl& url) { if (QThread::currentThread() != thread()) { AnimationPointer result; - hifi::qt::blockingInvokeMethod(this, "getAnimation", + BLOCKING_INVOKE_METHOD(this, "getAnimation", Q_RETURN_ARG(AnimationPointer, result), Q_ARG(const QUrl&, url)); return result; } @@ -100,7 +100,7 @@ bool Animation::isLoaded() const { QStringList Animation::getJointNames() const { if (QThread::currentThread() != thread()) { QStringList result; - hifi::qt::blockingInvokeMethod(const_cast(this), "getJointNames", + BLOCKING_INVOKE_METHOD(const_cast(this), "getJointNames", Q_RETURN_ARG(QStringList, result)); return result; } @@ -114,7 +114,7 @@ QStringList Animation::getJointNames() const { QVector Animation::getFrames() const { if (QThread::currentThread() != thread()) { QVector result; - hifi::qt::blockingInvokeMethod(const_cast(this), "getFrames", + BLOCKING_INVOKE_METHOD(const_cast(this), "getFrames", Q_RETURN_ARG(QVector, result)); return result; } diff --git a/libraries/audio/src/SoundCache.cpp b/libraries/audio/src/SoundCache.cpp index dc20b9884d..162e833da2 100644 --- a/libraries/audio/src/SoundCache.cpp +++ b/libraries/audio/src/SoundCache.cpp @@ -32,7 +32,7 @@ SoundCache::SoundCache(QObject* parent) : SharedSoundPointer SoundCache::getSound(const QUrl& url) { if (QThread::currentThread() != thread()) { SharedSoundPointer result; - hifi::qt::blockingInvokeMethod(this, "getSound", + BLOCKING_INVOKE_METHOD(this, "getSound", Q_RETURN_ARG(SharedSoundPointer, result), Q_ARG(const QUrl&, url)); return result; } diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index faebeafb29..d303b2e66d 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -1011,7 +1011,7 @@ glm::vec3 Avatar::getAbsoluteJointTranslationInObjectFrame(int index) const { int Avatar::getJointIndex(const QString& name) const { if (QThread::currentThread() != thread()) { int result; - hifi::qt::blockingInvokeMethod(const_cast(this), "getJointIndex", + BLOCKING_INVOKE_METHOD(const_cast(this), "getJointIndex", Q_RETURN_ARG(int, result), Q_ARG(const QString&, name)); return result; } @@ -1025,7 +1025,7 @@ int Avatar::getJointIndex(const QString& name) const { QStringList Avatar::getJointNames() const { if (QThread::currentThread() != thread()) { QStringList result; - hifi::qt::blockingInvokeMethod(const_cast(this), "getJointNames", + BLOCKING_INVOKE_METHOD(const_cast(this), "getJointNames", Q_RETURN_ARG(QStringList, result)); return result; } @@ -1035,7 +1035,7 @@ QStringList Avatar::getJointNames() const { glm::vec3 Avatar::getJointPosition(int index) const { if (QThread::currentThread() != thread()) { glm::vec3 position; - hifi::qt::blockingInvokeMethod(const_cast(this), "getJointPosition", + BLOCKING_INVOKE_METHOD(const_cast(this), "getJointPosition", Q_RETURN_ARG(glm::vec3, position), Q_ARG(const int, index)); return position; } @@ -1047,7 +1047,7 @@ glm::vec3 Avatar::getJointPosition(int index) const { glm::vec3 Avatar::getJointPosition(const QString& name) const { if (QThread::currentThread() != thread()) { glm::vec3 position; - hifi::qt::blockingInvokeMethod(const_cast(this), "getJointPosition", + BLOCKING_INVOKE_METHOD(const_cast(this), "getJointPosition", Q_RETURN_ARG(glm::vec3, position), Q_ARG(const QString&, name)); return position; } @@ -1106,7 +1106,7 @@ static std::shared_ptr allocateAttachmentModel(bool isSoft, const Rig& ri void Avatar::setAttachmentData(const QVector& attachmentData) { if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "setAttachmentData", + BLOCKING_INVOKE_METHOD(this, "setAttachmentData", Q_ARG(const QVector, attachmentData)); return; } diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 5f63826a99..6eed23fb5b 100644 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -1228,7 +1228,7 @@ bool AvatarData::isJointDataValid(int index) const { } if (QThread::currentThread() != thread()) { bool result; - hifi::qt::blockingInvokeMethod(const_cast(this), "isJointDataValid", + BLOCKING_INVOKE_METHOD(const_cast(this), "isJointDataValid", Q_RETURN_ARG(bool, result), Q_ARG(int, index)); return result; } @@ -1241,7 +1241,7 @@ glm::quat AvatarData::getJointRotation(int index) const { } if (QThread::currentThread() != thread()) { glm::quat result; - hifi::qt::blockingInvokeMethod(const_cast(this), "getJointRotation", + BLOCKING_INVOKE_METHOD(const_cast(this), "getJointRotation", Q_RETURN_ARG(glm::quat, result), Q_ARG(int, index)); return result; } @@ -1256,7 +1256,7 @@ glm::vec3 AvatarData::getJointTranslation(int index) const { } if (QThread::currentThread() != thread()) { glm::vec3 result; - hifi::qt::blockingInvokeMethod(const_cast(this), "getJointTranslation", + BLOCKING_INVOKE_METHOD(const_cast(this), "getJointTranslation", Q_RETURN_ARG(glm::vec3, result), Q_ARG(int, index)); return result; } @@ -1267,7 +1267,7 @@ glm::vec3 AvatarData::getJointTranslation(int index) const { glm::vec3 AvatarData::getJointTranslation(const QString& name) const { if (QThread::currentThread() != thread()) { glm::vec3 result; - hifi::qt::blockingInvokeMethod(const_cast(this), "getJointTranslation", + BLOCKING_INVOKE_METHOD(const_cast(this), "getJointTranslation", Q_RETURN_ARG(glm::vec3, result), Q_ARG(const QString&, name)); return result; } @@ -1345,7 +1345,7 @@ void AvatarData::clearJointData(const QString& name) { bool AvatarData::isJointDataValid(const QString& name) const { if (QThread::currentThread() != thread()) { bool result; - hifi::qt::blockingInvokeMethod(const_cast(this), "isJointDataValid", + BLOCKING_INVOKE_METHOD(const_cast(this), "isJointDataValid", Q_RETURN_ARG(bool, result), Q_ARG(const QString&, name)); return result; } @@ -1355,7 +1355,7 @@ bool AvatarData::isJointDataValid(const QString& name) const { glm::quat AvatarData::getJointRotation(const QString& name) const { if (QThread::currentThread() != thread()) { glm::quat result; - hifi::qt::blockingInvokeMethod(const_cast(this), "getJointRotation", + BLOCKING_INVOKE_METHOD(const_cast(this), "getJointRotation", Q_RETURN_ARG(glm::quat, result), Q_ARG(const QString&, name)); return result; } @@ -1365,7 +1365,7 @@ glm::quat AvatarData::getJointRotation(const QString& name) const { QVector AvatarData::getJointRotations() const { if (QThread::currentThread() != thread()) { QVector result; - hifi::qt::blockingInvokeMethod(const_cast(this), "getJointRotations", + BLOCKING_INVOKE_METHOD(const_cast(this), "getJointRotations", Q_RETURN_ARG(QVector, result)); return result; } @@ -1380,7 +1380,7 @@ QVector AvatarData::getJointRotations() const { void AvatarData::setJointRotations(QVector jointRotations) { if (QThread::currentThread() != thread()) { QVector result; - hifi::qt::blockingInvokeMethod(const_cast(this), "setJointRotations", + BLOCKING_INVOKE_METHOD(const_cast(this), "setJointRotations", Q_ARG(QVector, jointRotations)); } QWriteLocker writeLock(&_jointDataLock); @@ -1397,7 +1397,7 @@ void AvatarData::setJointRotations(QVector jointRotations) { QVector AvatarData::getJointTranslations() const { if (QThread::currentThread() != thread()) { QVector result; - hifi::qt::blockingInvokeMethod(const_cast(this), "getJointTranslations", + BLOCKING_INVOKE_METHOD(const_cast(this), "getJointTranslations", Q_RETURN_ARG(QVector, result)); return result; } @@ -1412,7 +1412,7 @@ QVector AvatarData::getJointTranslations() const { void AvatarData::setJointTranslations(QVector jointTranslations) { if (QThread::currentThread() != thread()) { QVector result; - hifi::qt::blockingInvokeMethod(const_cast(this), "setJointTranslations", + BLOCKING_INVOKE_METHOD(const_cast(this), "setJointTranslations", Q_ARG(QVector, jointTranslations)); } QWriteLocker writeLock(&_jointDataLock); @@ -1613,7 +1613,7 @@ void AvatarData::setDisplayName(const QString& displayName) { QVector AvatarData::getAttachmentData() const { if (QThread::currentThread() != thread()) { QVector result; - hifi::qt::blockingInvokeMethod(const_cast(this), "getAttachmentData", + BLOCKING_INVOKE_METHOD(const_cast(this), "getAttachmentData", Q_RETURN_ARG(QVector, result)); return result; } @@ -2336,7 +2336,7 @@ void AvatarData::clearAvatarEntity(const QUuid& entityID) { AvatarEntityMap AvatarData::getAvatarEntityData() const { AvatarEntityMap result; if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(const_cast(this), "getAvatarEntityData", + BLOCKING_INVOKE_METHOD(const_cast(this), "getAvatarEntityData", Q_RETURN_ARG(AvatarEntityMap, result)); return result; } @@ -2377,7 +2377,7 @@ void AvatarData::setAvatarEntityData(const AvatarEntityMap& avatarEntityData) { AvatarEntityIDs AvatarData::getAndClearRecentlyDetachedIDs() { AvatarEntityIDs result; if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(const_cast(this), "getAndClearRecentlyDetachedIDs", + BLOCKING_INVOKE_METHOD(const_cast(this), "getAndClearRecentlyDetachedIDs", Q_RETURN_ARG(AvatarEntityIDs, result)); return result; } diff --git a/libraries/display-plugins/src/display-plugins/CompositorHelper.cpp b/libraries/display-plugins/src/display-plugins/CompositorHelper.cpp index 92abec78fa..29b8aee08b 100644 --- a/libraries/display-plugins/src/display-plugins/CompositorHelper.cpp +++ b/libraries/display-plugins/src/display-plugins/CompositorHelper.cpp @@ -291,7 +291,7 @@ glm::vec2 CompositorHelper::getReticleMaximumPosition() const { void CompositorHelper::sendFakeMouseEvent() { if (qApp->thread() != QThread::currentThread()) { - hifi::qt::blockingInvokeMethod(this, "sendFakeMouseEvent"); + BLOCKING_INVOKE_METHOD(this, "sendFakeMouseEvent"); return; } diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index fbf76df38e..a8eca41077 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -381,7 +381,7 @@ ModelPointer EntityTreeRenderer::allocateModel(const QString& url, float loading // Only create and delete models on the thread that owns the EntityTreeRenderer if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "allocateModel", + BLOCKING_INVOKE_METHOD(this, "allocateModel", Q_RETURN_ARG(ModelPointer, model), Q_ARG(const QString&, url)); @@ -398,7 +398,7 @@ ModelPointer EntityTreeRenderer::allocateModel(const QString& url, float loading ModelPointer EntityTreeRenderer::updateModel(ModelPointer model, const QString& newUrl) { // Only create and delete models on the thread that owns the EntityTreeRenderer if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "updateModel", + BLOCKING_INVOKE_METHOD(this, "updateModel", Q_RETURN_ARG(ModelPointer, model), Q_ARG(ModelPointer, model), Q_ARG(const QString&, newUrl)); diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index ae9f79f0f6..f22631d363 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -1489,7 +1489,7 @@ int EntityScriptingInterface::getJointIndex(const QUuid& entityID, const QString return -1; } int result; - hifi::qt::blockingInvokeMethod(_entityTree.get(), "getJointIndex", + BLOCKING_INVOKE_METHOD(_entityTree.get(), "getJointIndex", Q_RETURN_ARG(int, result), Q_ARG(QUuid, entityID), Q_ARG(QString, name)); return result; } @@ -1499,7 +1499,7 @@ QStringList EntityScriptingInterface::getJointNames(const QUuid& entityID) { return QStringList(); } QStringList result; - hifi::qt::blockingInvokeMethod(_entityTree.get(), "getJointNames", + BLOCKING_INVOKE_METHOD(_entityTree.get(), "getJointNames", Q_RETURN_ARG(QStringList, result), Q_ARG(QUuid, entityID)); return result; } diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index 82314d0cd1..262f0318b6 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -233,7 +233,7 @@ void NodeList::processICEPingPacket(QSharedPointer message) { void NodeList::reset() { if (thread() != QThread::currentThread()) { - hifi::qt::blockingInvokeMethod(this, "reset"); + QMetaObject::invokeMethod(this, "reset"); return; } diff --git a/libraries/networking/src/ResourceCache.cpp b/libraries/networking/src/ResourceCache.cpp index 0c91a581ce..43f0e9335d 100644 --- a/libraries/networking/src/ResourceCache.cpp +++ b/libraries/networking/src/ResourceCache.cpp @@ -180,7 +180,7 @@ ScriptableResource* ResourceCache::prefetch(const QUrl& url, void* extra) { if (QThread::currentThread() != thread()) { // Must be called in thread to ensure getResource returns a valid pointer - hifi::qt::blockingInvokeMethod(this, "prefetch", + BLOCKING_INVOKE_METHOD(this, "prefetch", Q_RETURN_ARG(ScriptableResource*, result), Q_ARG(QUrl, url), Q_ARG(void*, extra)); return result; @@ -303,7 +303,7 @@ QVariantList ResourceCache::getResourceList() { QVariantList list; if (QThread::currentThread() != thread()) { // NOTE: invokeMethod does not allow a const QObject* - hifi::qt::blockingInvokeMethod(this, "getResourceList", + BLOCKING_INVOKE_METHOD(this, "getResourceList", Q_RETURN_ARG(QVariantList, list)); } else { auto resources = _resources.uniqueKeys(); diff --git a/libraries/networking/src/udt/Socket.cpp b/libraries/networking/src/udt/Socket.cpp index 89a6758366..a3374a0f47 100644 --- a/libraries/networking/src/udt/Socket.cpp +++ b/libraries/networking/src/udt/Socket.cpp @@ -277,7 +277,7 @@ Connection* Socket::findOrCreateConnection(const HifiSockAddr& sockAddr) { void Socket::clearConnections() { if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "clearConnections"); + BLOCKING_INVOKE_METHOD(this, "clearConnections"); return; } diff --git a/libraries/plugins/src/plugins/InputConfiguration.cpp b/libraries/plugins/src/plugins/InputConfiguration.cpp index 8ce206988b..9234ac6585 100644 --- a/libraries/plugins/src/plugins/InputConfiguration.cpp +++ b/libraries/plugins/src/plugins/InputConfiguration.cpp @@ -23,7 +23,7 @@ InputConfiguration::InputConfiguration() { QStringList InputConfiguration::inputPlugins() { if (QThread::currentThread() != thread()) { QStringList result; - hifi::qt::blockingInvokeMethod(this, "inputPlugins", + BLOCKING_INVOKE_METHOD(this, "inputPlugins", Q_RETURN_ARG(QStringList, result)); return result; } @@ -44,7 +44,7 @@ QStringList InputConfiguration::inputPlugins() { QStringList InputConfiguration::activeInputPlugins() { if (QThread::currentThread() != thread()) { QStringList result; - hifi::qt::blockingInvokeMethod(this, "activeInputPlugins", + BLOCKING_INVOKE_METHOD(this, "activeInputPlugins", Q_RETURN_ARG(QStringList, result)); return result; } @@ -66,7 +66,7 @@ QStringList InputConfiguration::activeInputPlugins() { QString InputConfiguration::configurationLayout(QString pluginName) { if (QThread::currentThread() != thread()) { QString result; - hifi::qt::blockingInvokeMethod(this, "configurationLayout", + BLOCKING_INVOKE_METHOD(this, "configurationLayout", Q_RETURN_ARG(QString, result), Q_ARG(QString, pluginName)); return result; @@ -83,7 +83,7 @@ QString InputConfiguration::configurationLayout(QString pluginName) { void InputConfiguration::setConfigurationSettings(QJsonObject configurationSettings, QString pluginName) { if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "setConfigurationSettings", + BLOCKING_INVOKE_METHOD(this, "setConfigurationSettings", Q_ARG(QJsonObject, configurationSettings), Q_ARG(QString, pluginName)); return; @@ -99,7 +99,7 @@ void InputConfiguration::setConfigurationSettings(QJsonObject configurationSetti QJsonObject InputConfiguration::configurationSettings(QString pluginName) { if (QThread::currentThread() != thread()) { QJsonObject result; - hifi::qt::blockingInvokeMethod(this, "configurationSettings", + BLOCKING_INVOKE_METHOD(this, "configurationSettings", Q_RETURN_ARG(QJsonObject, result), Q_ARG(QString, pluginName)); return result; @@ -115,7 +115,7 @@ QJsonObject InputConfiguration::configurationSettings(QString pluginName) { void InputConfiguration::calibratePlugin(QString pluginName) { if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "calibratePlugin"); + BLOCKING_INVOKE_METHOD(this, "calibratePlugin"); return; } @@ -130,7 +130,7 @@ void InputConfiguration::calibratePlugin(QString pluginName) { bool InputConfiguration::uncalibratePlugin(QString pluginName) { if (QThread::currentThread() != thread()) { bool result; - hifi::qt::blockingInvokeMethod(this, "uncalibratePlugin", + BLOCKING_INVOKE_METHOD(this, "uncalibratePlugin", Q_ARG(bool, result)); return result; } diff --git a/libraries/recording/src/recording/ClipCache.cpp b/libraries/recording/src/recording/ClipCache.cpp index 458979bf96..0fbbf1bc8e 100644 --- a/libraries/recording/src/recording/ClipCache.cpp +++ b/libraries/recording/src/recording/ClipCache.cpp @@ -39,7 +39,7 @@ ClipCache::ClipCache(QObject* parent) : NetworkClipLoaderPointer ClipCache::getClipLoader(const QUrl& url) { if (QThread::currentThread() != thread()) { NetworkClipLoaderPointer result; - hifi::qt::blockingInvokeMethod(this, "getClipLoader", + BLOCKING_INVOKE_METHOD(this, "getClipLoader", Q_RETURN_ARG(NetworkClipLoaderPointer, result), Q_ARG(const QUrl&, url)); return result; } diff --git a/libraries/render-utils/src/Model.cpp b/libraries/render-utils/src/Model.cpp index 94b074d1e3..45be09b701 100644 --- a/libraries/render-utils/src/Model.cpp +++ b/libraries/render-utils/src/Model.cpp @@ -871,7 +871,7 @@ bool Model::getRelativeDefaultJointTranslation(int jointIndex, glm::vec3& transl QStringList Model::getJointNames() const { if (QThread::currentThread() != thread()) { QStringList result; - hifi::qt::blockingInvokeMethod(const_cast(this), "getJointNames", + BLOCKING_INVOKE_METHOD(const_cast(this), "getJointNames", Q_RETURN_ARG(QStringList, result)); return result; } diff --git a/libraries/render/src/task/Config.cpp b/libraries/render/src/task/Config.cpp index d1edd8bda8..b378237c9c 100644 --- a/libraries/render/src/task/Config.cpp +++ b/libraries/render/src/task/Config.cpp @@ -61,7 +61,7 @@ void TaskConfig::transferChildrenConfigs(QConfigPointer source) { void TaskConfig::refresh() { if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "refresh"); + BLOCKING_INVOKE_METHOD(this, "refresh"); return; } diff --git a/libraries/script-engine/src/AudioScriptingInterface.cpp b/libraries/script-engine/src/AudioScriptingInterface.cpp index 4023af375a..28bf5ed163 100644 --- a/libraries/script-engine/src/AudioScriptingInterface.cpp +++ b/libraries/script-engine/src/AudioScriptingInterface.cpp @@ -34,7 +34,7 @@ ScriptAudioInjector* AudioScriptingInterface::playSound(SharedSoundPointer sound if (QThread::currentThread() != thread()) { ScriptAudioInjector* injector = NULL; - hifi::qt::blockingInvokeMethod(this, "playSound", + BLOCKING_INVOKE_METHOD(this, "playSound", Q_RETURN_ARG(ScriptAudioInjector*, injector), Q_ARG(SharedSoundPointer, sound), Q_ARG(const AudioInjectorOptions&, injectorOptions)); diff --git a/libraries/script-engine/src/RecordingScriptingInterface.cpp b/libraries/script-engine/src/RecordingScriptingInterface.cpp index cd5b79b4a8..b51e9cd529 100644 --- a/libraries/script-engine/src/RecordingScriptingInterface.cpp +++ b/libraries/script-engine/src/RecordingScriptingInterface.cpp @@ -99,7 +99,7 @@ void RecordingScriptingInterface::loadRecording(const QString& url, QScriptValue void RecordingScriptingInterface::startPlaying() { if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "startPlaying"); + BLOCKING_INVOKE_METHOD(this, "startPlaying"); return; } @@ -116,7 +116,7 @@ void RecordingScriptingInterface::setPlayerAudioOffset(float audioOffset) { void RecordingScriptingInterface::setPlayerTime(float time) { if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "setPlayerTime", Q_ARG(float, time)); + BLOCKING_INVOKE_METHOD(this, "setPlayerTime", Q_ARG(float, time)); return; } _player->seek(time); @@ -148,7 +148,7 @@ void RecordingScriptingInterface::setPlayerUseSkeletonModel(bool useSkeletonMode void RecordingScriptingInterface::pausePlayer() { if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "pausePlayer"); + BLOCKING_INVOKE_METHOD(this, "pausePlayer"); return; } _player->pause(); @@ -156,7 +156,7 @@ void RecordingScriptingInterface::pausePlayer() { void RecordingScriptingInterface::stopPlaying() { if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "stopPlaying"); + BLOCKING_INVOKE_METHOD(this, "stopPlaying"); return; } _player->stop(); @@ -177,7 +177,7 @@ void RecordingScriptingInterface::startRecording() { } if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "startRecording"); + BLOCKING_INVOKE_METHOD(this, "startRecording"); return; } @@ -200,7 +200,7 @@ QString RecordingScriptingInterface::getDefaultRecordingSaveDirectory() { void RecordingScriptingInterface::saveRecording(const QString& filename) { if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "saveRecording", + BLOCKING_INVOKE_METHOD(this, "saveRecording", Q_ARG(QString, filename)); return; } @@ -221,7 +221,7 @@ bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUr if (QThread::currentThread() != thread()) { bool result; - hifi::qt::blockingInvokeMethod(this, "saveRecordingToAsset", + BLOCKING_INVOKE_METHOD(this, "saveRecordingToAsset", Q_RETURN_ARG(bool, result), Q_ARG(QScriptValue, getClipAtpUrl)); return result; @@ -258,7 +258,7 @@ bool RecordingScriptingInterface::saveRecordingToAsset(QScriptValue getClipAtpUr void RecordingScriptingInterface::loadLastRecording() { if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "loadLastRecording"); + BLOCKING_INVOKE_METHOD(this, "loadLastRecording"); return; } diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 52ce11c3cf..b51cb0ee3b 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -965,7 +965,7 @@ QScriptValue ScriptEngine::evaluate(const QString& sourceCode, const QString& fi qCDebug(scriptengine) << "*** WARNING *** ScriptEngine::evaluate() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "] " "sourceCode:" << sourceCode << " fileName:" << fileName << "lineNumber:" << lineNumber; #endif - hifi::qt::blockingInvokeMethod(this, "evaluate", + BLOCKING_INVOKE_METHOD(this, "evaluate", Q_RETURN_ARG(QScriptValue, result), Q_ARG(const QString&, sourceCode), Q_ARG(const QString&, fileName), diff --git a/libraries/script-engine/src/ScriptEngines.cpp b/libraries/script-engine/src/ScriptEngines.cpp index 254312fa45..57b04eeb82 100644 --- a/libraries/script-engine/src/ScriptEngines.cpp +++ b/libraries/script-engine/src/ScriptEngines.cpp @@ -453,7 +453,7 @@ ScriptEngine* ScriptEngines::loadScript(const QUrl& scriptFilename, bool isUserL bool activateMainWindow, bool reload) { if (thread() != QThread::currentThread()) { ScriptEngine* result { nullptr }; - hifi::qt::blockingInvokeMethod(this, "loadScript", Q_RETURN_ARG(ScriptEngine*, result), + BLOCKING_INVOKE_METHOD(this, "loadScript", Q_RETURN_ARG(ScriptEngine*, result), Q_ARG(QUrl, scriptFilename), Q_ARG(bool, isUserLoaded), Q_ARG(bool, loadScriptFromEditor), diff --git a/libraries/shared/src/shared/QtHelpers.cpp b/libraries/shared/src/shared/QtHelpers.cpp index 3681136bf2..1ce1c3e07c 100644 --- a/libraries/shared/src/shared/QtHelpers.cpp +++ b/libraries/shared/src/shared/QtHelpers.cpp @@ -17,6 +17,7 @@ Q_LOGGING_CATEGORY(thread_safety, "hifi.thread_safety") namespace hifi { namespace qt { bool blockingInvokeMethod( + const char* function, QObject *obj, const char *member, QGenericReturnArgument ret, QGenericArgument val0, @@ -30,13 +31,14 @@ bool blockingInvokeMethod( QGenericArgument val8, QGenericArgument val9) { if (QThread::currentThread() == qApp->thread()) { - qCWarning(thread_safety, "BlockingQueuedConnection invoked on main thread!"); + qCWarning(thread_safety) << "BlockingQueuedConnection invoked on main thread from " << function; } return QMetaObject::invokeMethod(obj, member, Qt::BlockingQueuedConnection, ret, val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); } bool blockingInvokeMethod( + const char* function, QObject *obj, const char *member, QGenericArgument val0, QGenericArgument val1, @@ -48,8 +50,7 @@ bool blockingInvokeMethod( QGenericArgument val7, QGenericArgument val8, QGenericArgument val9) { - qCWarning(thread_safety, "BlockingQueuedConnection invoked without return value!"); - return blockingInvokeMethod(obj, member, QGenericReturnArgument(), val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); + return blockingInvokeMethod(function, obj, member, QGenericReturnArgument(), val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); } diff --git a/libraries/shared/src/shared/QtHelpers.h b/libraries/shared/src/shared/QtHelpers.h index 7b5a15a069..5da65a378f 100644 --- a/libraries/shared/src/shared/QtHelpers.h +++ b/libraries/shared/src/shared/QtHelpers.h @@ -12,9 +12,11 @@ #include + namespace hifi { namespace qt { bool blockingInvokeMethod( + const char* function, QObject *obj, const char *member, QGenericReturnArgument ret, QGenericArgument val0 = QGenericArgument(Q_NULLPTR), @@ -29,6 +31,7 @@ bool blockingInvokeMethod( QGenericArgument val9 = QGenericArgument()); bool blockingInvokeMethod( + const char* function, QObject *obj, const char *member, QGenericArgument val0 = QGenericArgument(Q_NULLPTR), QGenericArgument val1 = QGenericArgument(), @@ -43,5 +46,7 @@ bool blockingInvokeMethod( } } +#define BLOCKING_INVOKE_METHOD(obj, member, ...) \ + hifi::qt::blockingInvokeMethod(__FUNCTION__, obj, member, ##__VA_ARGS__) #endif diff --git a/libraries/ui/src/OffscreenUi.cpp b/libraries/ui/src/OffscreenUi.cpp index 2bc5f89d00..135729653e 100644 --- a/libraries/ui/src/OffscreenUi.cpp +++ b/libraries/ui/src/OffscreenUi.cpp @@ -250,7 +250,7 @@ int OffscreenUi::waitForMessageBoxResult(QQuickItem* messageBox) { QMessageBox::StandardButton OffscreenUi::messageBox(Icon icon, const QString& title, const QString& text, QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton) { if (QThread::currentThread() != thread()) { QMessageBox::StandardButton result = QMessageBox::StandardButton::NoButton; - hifi::qt::blockingInvokeMethod(this, "messageBox", + BLOCKING_INVOKE_METHOD(this, "messageBox", Q_RETURN_ARG(QMessageBox::StandardButton, result), Q_ARG(Icon, icon), Q_ARG(QString, title), @@ -352,7 +352,7 @@ QVariant OffscreenUi::getCustomInfo(const Icon icon, const QString& title, const QVariant OffscreenUi::inputDialog(const Icon icon, const QString& title, const QString& label, const QVariant& current) { if (QThread::currentThread() != thread()) { QVariant result; - hifi::qt::blockingInvokeMethod(this, "inputDialog", + BLOCKING_INVOKE_METHOD(this, "inputDialog", Q_RETURN_ARG(QVariant, result), Q_ARG(Icon, icon), Q_ARG(QString, title), @@ -367,7 +367,7 @@ QVariant OffscreenUi::inputDialog(const Icon icon, const QString& title, const Q QVariant OffscreenUi::customInputDialog(const Icon icon, const QString& title, const QVariantMap& config) { if (QThread::currentThread() != thread()) { QVariant result; - hifi::qt::blockingInvokeMethod(this, "customInputDialog", + BLOCKING_INVOKE_METHOD(this, "customInputDialog", Q_RETURN_ARG(QVariant, result), Q_ARG(Icon, icon), Q_ARG(QString, title), @@ -641,7 +641,7 @@ QString OffscreenUi::fileDialog(const QVariantMap& properties) { QString OffscreenUi::fileOpenDialog(const QString& caption, const QString& dir, const QString& filter, QString* selectedFilter, QFileDialog::Options options) { if (QThread::currentThread() != thread()) { QString result; - hifi::qt::blockingInvokeMethod(this, "fileOpenDialog", + BLOCKING_INVOKE_METHOD(this, "fileOpenDialog", Q_RETURN_ARG(QString, result), Q_ARG(QString, caption), Q_ARG(QString, dir), @@ -663,7 +663,7 @@ QString OffscreenUi::fileOpenDialog(const QString& caption, const QString& dir, QString OffscreenUi::fileSaveDialog(const QString& caption, const QString& dir, const QString& filter, QString* selectedFilter, QFileDialog::Options options) { if (QThread::currentThread() != thread()) { QString result; - hifi::qt::blockingInvokeMethod(this, "fileSaveDialog", + BLOCKING_INVOKE_METHOD(this, "fileSaveDialog", Q_RETURN_ARG(QString, result), Q_ARG(QString, caption), Q_ARG(QString, dir), @@ -687,7 +687,7 @@ QString OffscreenUi::fileSaveDialog(const QString& caption, const QString& dir, QString OffscreenUi::existingDirectoryDialog(const QString& caption, const QString& dir, const QString& filter, QString* selectedFilter, QFileDialog::Options options) { if (QThread::currentThread() != thread()) { QString result; - hifi::qt::blockingInvokeMethod(this, "existingDirectoryDialog", + BLOCKING_INVOKE_METHOD(this, "existingDirectoryDialog", Q_RETURN_ARG(QString, result), Q_ARG(QString, caption), Q_ARG(QString, dir), @@ -774,7 +774,7 @@ QString OffscreenUi::assetOpenDialog(const QString& caption, const QString& dir, // ATP equivalent of fileOpenDialog(). if (QThread::currentThread() != thread()) { QString result; - hifi::qt::blockingInvokeMethod(this, "assetOpenDialog", + BLOCKING_INVOKE_METHOD(this, "assetOpenDialog", Q_RETURN_ARG(QString, result), Q_ARG(QString, caption), Q_ARG(QString, dir), diff --git a/libraries/ui/src/QmlWebWindowClass.cpp b/libraries/ui/src/QmlWebWindowClass.cpp index 13fc9cc018..44a0af7787 100644 --- a/libraries/ui/src/QmlWebWindowClass.cpp +++ b/libraries/ui/src/QmlWebWindowClass.cpp @@ -38,7 +38,7 @@ QScriptValue QmlWebWindowClass::constructor(QScriptContext* context, QScriptEngi QString QmlWebWindowClass::getURL() { if (QThread::currentThread() != thread()) { QString result; - hifi::qt::blockingInvokeMethod(this, "getURL", Q_RETURN_ARG(QString, result)); + BLOCKING_INVOKE_METHOD(this, "getURL", Q_RETURN_ARG(QString, result)); return result; } diff --git a/libraries/ui/src/QmlWindowClass.cpp b/libraries/ui/src/QmlWindowClass.cpp index 8d93af15f5..14d8ec8985 100644 --- a/libraries/ui/src/QmlWindowClass.cpp +++ b/libraries/ui/src/QmlWindowClass.cpp @@ -79,7 +79,7 @@ QScriptValue QmlWindowClass::constructor(QScriptContext* context, QScriptEngine* Q_ASSERT(retVal); if (QThread::currentThread() != qApp->thread()) { retVal->moveToThread(qApp->thread()); - hifi::qt::blockingInvokeMethod(retVal, "initQml", Q_ARG(QVariantMap, properties)); + BLOCKING_INVOKE_METHOD(retVal, "initQml", Q_ARG(QVariantMap, properties)); } else { retVal->initQml(properties); } @@ -111,7 +111,7 @@ void QmlWindowClass::initQml(QVariantMap properties) { // Build the event bridge and wrapper on the main thread offscreenUi->loadInNewContext(qmlSource(), [&](QQmlContext* context, QObject* object) { _qmlWindow = object; - context->setContextProperty("eventBridge", this); + context->setContextProperty(EVENT_BRIDGE_PROPERTY, this); context->engine()->setObjectOwnership(this, QQmlEngine::CppOwnership); context->engine()->setObjectOwnership(object, QQmlEngine::CppOwnership); if (properties.contains(TITLE_PROPERTY)) { @@ -243,7 +243,7 @@ void QmlWindowClass::setVisible(bool visible) { bool QmlWindowClass::isVisible() { if (QThread::currentThread() != thread()) { bool result = false; - hifi::qt::blockingInvokeMethod(this, "isVisible", Q_RETURN_ARG(bool, result)); + BLOCKING_INVOKE_METHOD(this, "isVisible", Q_RETURN_ARG(bool, result)); return result; } @@ -264,7 +264,7 @@ bool QmlWindowClass::isVisible() { glm::vec2 QmlWindowClass::getPosition() { if (QThread::currentThread() != thread()) { vec2 result; - hifi::qt::blockingInvokeMethod(this, "getPosition", Q_RETURN_ARG(vec2, result)); + BLOCKING_INVOKE_METHOD(this, "getPosition", Q_RETURN_ARG(vec2, result)); return result; } @@ -299,7 +299,7 @@ glm::vec2 toGlm(const QSizeF& size) { glm::vec2 QmlWindowClass::getSize() { if (QThread::currentThread() != thread()) { vec2 result; - hifi::qt::blockingInvokeMethod(this, "getSize", Q_RETURN_ARG(vec2, result)); + BLOCKING_INVOKE_METHOD(this, "getSize", Q_RETURN_ARG(vec2, result)); return result; } diff --git a/libraries/ui/src/ui/Menu.cpp b/libraries/ui/src/ui/Menu.cpp index 7aa4bc5e17..4e61eba28f 100644 --- a/libraries/ui/src/ui/Menu.cpp +++ b/libraries/ui/src/ui/Menu.cpp @@ -246,7 +246,7 @@ void Menu::removeAction(MenuWrapper* menu, const QString& actionName) { void Menu::setIsOptionChecked(const QString& menuOption, bool isChecked) { if (thread() != QThread::currentThread()) { - hifi::qt::blockingInvokeMethod(this, "setIsOptionChecked", + BLOCKING_INVOKE_METHOD(this, "setIsOptionChecked", Q_ARG(const QString&, menuOption), Q_ARG(bool, isChecked)); return; diff --git a/libraries/ui/src/ui/QmlWrapper.cpp b/libraries/ui/src/ui/QmlWrapper.cpp index d0f9a5e535..3879e1bc8f 100644 --- a/libraries/ui/src/ui/QmlWrapper.cpp +++ b/libraries/ui/src/ui/QmlWrapper.cpp @@ -38,7 +38,7 @@ void QmlWrapper::writeProperties(QVariant propertyMap) { QVariant QmlWrapper::readProperty(const QString& propertyName) { if (QThread::currentThread() != thread()) { QVariant result; - hifi::qt::blockingInvokeMethod(this, "readProperty", Q_RETURN_ARG(QVariant, result), Q_ARG(QString, propertyName)); + BLOCKING_INVOKE_METHOD(this, "readProperty", Q_RETURN_ARG(QVariant, result), Q_ARG(QString, propertyName)); return result; } @@ -48,7 +48,7 @@ QVariant QmlWrapper::readProperty(const QString& propertyName) { QVariant QmlWrapper::readProperties(const QVariant& propertyList) { if (QThread::currentThread() != thread()) { QVariant result; - hifi::qt::blockingInvokeMethod(this, "readProperties", Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, propertyList)); + BLOCKING_INVOKE_METHOD(this, "readProperties", Q_RETURN_ARG(QVariant, result), Q_ARG(QVariant, propertyList)); return result; } diff --git a/libraries/ui/src/ui/TabletScriptingInterface.cpp b/libraries/ui/src/ui/TabletScriptingInterface.cpp index 0dbcfac25c..857cae15cc 100644 --- a/libraries/ui/src/ui/TabletScriptingInterface.cpp +++ b/libraries/ui/src/ui/TabletScriptingInterface.cpp @@ -43,7 +43,7 @@ ToolbarProxy* TabletScriptingInterface::getSystemToolbarProxy() { TabletProxy* TabletScriptingInterface::getTablet(const QString& tabletId) { TabletProxy* tabletProxy = nullptr; if (QThread::currentThread() != thread()) { - hifi::qt::blockingInvokeMethod(this, "getTablet", Q_RETURN_ARG(TabletProxy*, tabletProxy), Q_ARG(QString, tabletId)); + BLOCKING_INVOKE_METHOD(this, "getTablet", Q_RETURN_ARG(TabletProxy*, tabletProxy), Q_ARG(QString, tabletId)); return tabletProxy; } @@ -291,7 +291,7 @@ void TabletProxy::initialScreen(const QVariant& url) { bool TabletProxy::isMessageDialogOpen() { if (QThread::currentThread() != thread()) { bool result = false; - hifi::qt::blockingInvokeMethod(this, "isMessageDialogOpen", Q_RETURN_ARG(bool, result)); + BLOCKING_INVOKE_METHOD(this, "isMessageDialogOpen", Q_RETURN_ARG(bool, result)); return result; } @@ -316,7 +316,7 @@ void TabletProxy::emitWebEvent(const QVariant& msg) { bool TabletProxy::isPathLoaded(const QVariant& path) { if (QThread::currentThread() != thread()) { bool result = false; - hifi::qt::blockingInvokeMethod(this, "isPathLoaded", Q_RETURN_ARG(bool, result), Q_ARG(QVariant, path)); + BLOCKING_INVOKE_METHOD(this, "isPathLoaded", Q_RETURN_ARG(bool, result), Q_ARG(QVariant, path)); return result; } @@ -479,7 +479,7 @@ void TabletProxy::loadQMLSource(const QVariant& path) { bool TabletProxy::pushOntoStack(const QVariant& path) { if (QThread::currentThread() != thread()) { bool result = false; - hifi::qt::blockingInvokeMethod(this, "pushOntoStack", Q_RETURN_ARG(bool, result), Q_ARG(QVariant, path)); + BLOCKING_INVOKE_METHOD(this, "pushOntoStack", Q_RETURN_ARG(bool, result), Q_ARG(QVariant, path)); return result; } @@ -605,7 +605,7 @@ void TabletProxy::gotoWebScreen(const QString& url, const QString& injectedJavaS TabletButtonProxy* TabletProxy::addButton(const QVariant& properties) { if (QThread::currentThread() != thread()) { TabletButtonProxy* result = nullptr; - hifi::qt::blockingInvokeMethod(this, "addButton", Q_RETURN_ARG(TabletButtonProxy*, result), Q_ARG(QVariant, properties)); + BLOCKING_INVOKE_METHOD(this, "addButton", Q_RETURN_ARG(TabletButtonProxy*, result), Q_ARG(QVariant, properties)); return result; } @@ -632,7 +632,7 @@ TabletButtonProxy* TabletProxy::addButton(const QVariant& properties) { bool TabletProxy::onHomeScreen() { if (QThread::currentThread() != thread()) { bool result = false; - hifi::qt::blockingInvokeMethod(this, "onHomeScreen", Q_RETURN_ARG(bool, result)); + BLOCKING_INVOKE_METHOD(this, "onHomeScreen", Q_RETURN_ARG(bool, result)); return result; } @@ -839,7 +839,7 @@ void TabletButtonProxy::setToolbarButtonProxy(QObject* toolbarButtonProxy) { QVariantMap TabletButtonProxy::getProperties() { if (QThread::currentThread() != thread()) { QVariantMap result; - hifi::qt::blockingInvokeMethod(this, "getProperties", Q_RETURN_ARG(QVariantMap, result)); + BLOCKING_INVOKE_METHOD(this, "getProperties", Q_RETURN_ARG(QVariantMap, result)); return result; } diff --git a/libraries/ui/src/ui/ToolbarScriptingInterface.cpp b/libraries/ui/src/ui/ToolbarScriptingInterface.cpp index adfc15cc83..d01b538004 100644 --- a/libraries/ui/src/ui/ToolbarScriptingInterface.cpp +++ b/libraries/ui/src/ui/ToolbarScriptingInterface.cpp @@ -70,7 +70,7 @@ ToolbarProxy::ToolbarProxy(QObject* qmlObject, QObject* parent) : QmlWrapper(qml ToolbarButtonProxy* ToolbarProxy::addButton(const QVariant& properties) { if (QThread::currentThread() != thread()) { ToolbarButtonProxy* result = nullptr; - hifi::qt::blockingInvokeMethod(this, "addButton", Q_RETURN_ARG(ToolbarButtonProxy*, result), Q_ARG(QVariant, properties)); + BLOCKING_INVOKE_METHOD(this, "addButton", Q_RETURN_ARG(ToolbarButtonProxy*, result), Q_ARG(QVariant, properties)); return result; } @@ -101,7 +101,7 @@ void ToolbarProxy::removeButton(const QVariant& name) { ToolbarProxy* ToolbarScriptingInterface::getToolbar(const QString& toolbarId) { if (QThread::currentThread() != thread()) { ToolbarProxy* result = nullptr; - hifi::qt::blockingInvokeMethod(this, "getToolbar", Q_RETURN_ARG(ToolbarProxy*, result), Q_ARG(QString, toolbarId)); + BLOCKING_INVOKE_METHOD(this, "getToolbar", Q_RETURN_ARG(ToolbarProxy*, result), Q_ARG(QString, toolbarId)); return result; }