From f9446041205f52a6d9b74d4308d698e5ebc276b3 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 12 Oct 2019 10:10:27 +1300 Subject: [PATCH 1/5] Deprecate Toolbar API's addButton() and removeButton() methods --- libraries/ui/src/ui/ToolbarScriptingInterface.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libraries/ui/src/ui/ToolbarScriptingInterface.h b/libraries/ui/src/ui/ToolbarScriptingInterface.h index 952d3cce95..3d38aa296b 100644 --- a/libraries/ui/src/ui/ToolbarScriptingInterface.h +++ b/libraries/ui/src/ui/ToolbarScriptingInterface.h @@ -92,15 +92,19 @@ public: ToolbarProxy(QObject* qmlObject, QObject* parent = nullptr); /**jsdoc + * Currently doesn't work. * @function ToolbarProxy#addButton - * @param {object} properties - * @returns {ToolbarButtonProxy} + * @param {object} properties - Button properties + * @returns {object} The button added. + * @deprecated This method is deprecated and will be removed. */ Q_INVOKABLE ToolbarButtonProxy* addButton(const QVariant& properties); /**jsdoc + * Currently doesn't work. * @function ToolbarProxy#removeButton - * @param {string} name + * @param {string} name - Button name. + * @deprecated This method is deprecated and will be removed. */ Q_INVOKABLE void removeButton(const QVariant& name); From 5292dddc391c11315733f79ab7e508fd12605506 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 12 Oct 2019 10:10:41 +1300 Subject: [PATCH 2/5] Rewrite toolbarTest.js --- scripts/developer/tests/toolbarTest.js | 143 ++++++------------------- 1 file changed, 32 insertions(+), 111 deletions(-) diff --git a/scripts/developer/tests/toolbarTest.js b/scripts/developer/tests/toolbarTest.js index 89609e610d..9e82f814ac 100644 --- a/scripts/developer/tests/toolbarTest.js +++ b/scripts/developer/tests/toolbarTest.js @@ -1,117 +1,38 @@ -var isActive = false; +(function () { -var toolBar = (function() { - var that = {}, - toolBar, - activeButton, - newModelButton, - newShapeButton, - newLightButton, - newTextButton, - newWebButton, - newZoneButton, - newParticleButton, - newMaterialButton - - var toolIconUrl = Script.resolvePath("../../system/assets/images/tools/"); - - function initialize() { - print("Toolbars: " + Toolbars); - toolBar = Toolbars.getToolbar("highfidelity.edit.toolbar"); - print("Toolbar: " + toolBar); - activeButton = toolBar.addButton({ - objectName: "activeButton", - imageURL: toolIconUrl + "edit-01.svg", - visible: true, - alpha: 0.9, - }); - - print("Button " + activeButton); - print("Button signal " + activeButton.clicked); - activeButton.clicked.connect(function(){ - print("Clicked on button " + isActive); - that.setActive(!isActive); - }); - - newModelButton = toolBar.addButton({ - objectName: "newModelButton", - imageURL: toolIconUrl + "model-01.svg", - alpha: 0.9, - visible: false - }); - - newShapeButton = toolBar.addButton({ - objectName: "newShapeButton", - imageURL: toolIconUrl + "cube-01.svg", - alpha: 0.9, - visible: false - }); - - newLightButton = toolBar.addButton({ - objectName: "newLightButton", - imageURL: toolIconUrl + "light-01.svg", - alpha: 0.9, - visible: false - }); - - newTextButton = toolBar.addButton({ - objectName: "newTextButton", - imageURL: toolIconUrl + "text-01.svg", - alpha: 0.9, - visible: false - }); - - newWebButton = toolBar.addButton({ - objectName: "newWebButton", - imageURL: toolIconUrl + "web-01.svg", - alpha: 0.9, - visible: false - }); - - newZoneButton = toolBar.addButton({ - objectName: "newZoneButton", - imageURL: toolIconUrl + "zone-01.svg", - alpha: 0.9, - visible: false - }); - - newParticleButton = toolBar.addButton({ - objectName: "newParticleButton", - imageURL: toolIconUrl + "particle-01.svg", - alpha: 0.9, - visible: false - }); - - newMaterialButton = toolBar.addButton({ - objectName: "newMaterialButton", - imageURL: toolIconUrl + "material-01.svg", - alpha: 0.9, - visible: false - }); - - that.setActive(false); - newModelButton.clicked(); + // Get the system toolbar. + var toolbar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); + if (!toolbar) { + print("ERROR: Couldn't get system toolbar."); + return; } - that.setActive = function(active) { - if (active != isActive) { - isActive = active; - that.showTools(isActive); - } - }; + Script.setTimeout(function () { + // Report the system toolbar visibility. + var isToolbarVisible = toolbar.readProperty("visible"); + print("Toolbar visible: " + isToolbarVisible); - // Sets visibility of tool buttons, excluding the power button - that.showTools = function(doShow) { - newModelButton.writeProperty('visible', doShow); - newShapeButton.writeProperty('visible', doShow); - newLightButton.writeProperty('visible', doShow); - newTextButton.writeProperty('visible', doShow); - newWebButton.writeProperty('visible', doShow); - newZoneButton.writeProperty('visible', doShow); - newParticleButton.writeProperty('visible', doShow); - newMaterialButton.writeProperty('visible', doShow); - }; + // Briefly toggle the system toolbar visibility. + print("Toggle toolbar"); + toolbar.writeProperty("visible", !isToolbarVisible); + Script.setTimeout(function () { + print("Toggle toolbar"); + toolbar.writeProperty("visible", isToolbarVisible); + }, 2000); + }, 2000); + + Script.setTimeout(function () { + // Report the system toolbar visibility alternative method. + isToolbarVisible = toolbar.readProperties(["visible"]).visible; + print("Toolbar visible: " + isToolbarVisible); + + // Briefly toggle the system toolbar visibility. + print("Toggle toolbar"); + toolbar.writeProperties({ visible: !isToolbarVisible }); + Script.setTimeout(function () { + print("Toggle toolbar"); + toolbar.writeProperties({ visible: isToolbarVisible }); + }, 2000); + }, 6000); - initialize(); - return that; }()); From 7bd550e37bde7621f005d2c037b9204ce869bded Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Mon, 14 Oct 2019 09:30:44 -0700 Subject: [PATCH 3/5] DEV-2334: New 'Item Invalidated' language in Inventory --- .../resources/qml/hifi/commerce/purchases/Purchases.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml index 03fbbb178e..85e5211649 100644 --- a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml +++ b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml @@ -580,8 +580,9 @@ Rectangle { sendToScript(msg); } else if (msg.method === "showInvalidatedLightbox") { lightboxPopup.titleText = "Item Invalidated"; - lightboxPopup.bodyText = 'Your item is marked "invalidated" because this item has been suspended ' + - "from the Marketplace due to a claim against its author."; + lightboxPopup.bodyText = 'This item has been invalidated and is no longer available.
' + + 'If you have questions, please contact marketplace@highfidelity.com.
' + + 'Thank you!'; lightboxPopup.button1text = "CLOSE"; lightboxPopup.button1method = function() { lightboxPopup.visible = false; From 95b5c8a905de4debc2a46176fbd2db93e5ff012f Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Mon, 14 Oct 2019 10:46:32 -0700 Subject: [PATCH 4/5] DEV-2375: ensure web entities stop playing audio --- interface/resources/qml/Web3DSurface.qml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/interface/resources/qml/Web3DSurface.qml b/interface/resources/qml/Web3DSurface.qml index ff574ceaa5..5f49fe399a 100644 --- a/interface/resources/qml/Web3DSurface.qml +++ b/interface/resources/qml/Web3DSurface.qml @@ -33,6 +33,10 @@ Item { property var item: null function load(url, scriptUrl) { + // Ensure we reset any existing item to "about:blank" to ensure web audio stops: DEV-2375 + if (root.item != null) { + root.item.url = "about:blank" + } QmlSurface.load("./controls/WebView.qml", root, function(newItem) { root.item = newItem root.item.url = url From 6c35387b8d98be39e9416ff423b1c55c2af0c1bf Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Mon, 14 Oct 2019 10:56:23 -0700 Subject: [PATCH 5/5] also fix DEV-2083 --- interface/resources/qml/Web3DSurface.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/interface/resources/qml/Web3DSurface.qml b/interface/resources/qml/Web3DSurface.qml index 5f49fe399a..3340226761 100644 --- a/interface/resources/qml/Web3DSurface.qml +++ b/interface/resources/qml/Web3DSurface.qml @@ -36,6 +36,8 @@ Item { // Ensure we reset any existing item to "about:blank" to ensure web audio stops: DEV-2375 if (root.item != null) { root.item.url = "about:blank" + root.item.destroy() + root.item = null } QmlSurface.load("./controls/WebView.qml", root, function(newItem) { root.item = newItem