Merge branch 'instancing' of github.com:highfidelity/hifi into instancing

This commit is contained in:
Sam Gateau 2019-10-16 11:49:46 -07:00
commit a0f366315c
4 changed files with 48 additions and 116 deletions

View file

@ -33,6 +33,12 @@ Item {
property var item: null property var item: null
function load(url, scriptUrl) { 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"
root.item.destroy()
root.item = null
}
QmlSurface.load("./controls/WebView.qml", root, function(newItem) { QmlSurface.load("./controls/WebView.qml", root, function(newItem) {
root.item = newItem root.item = newItem
root.item.url = url root.item.url = url

View file

@ -580,8 +580,9 @@ Rectangle {
sendToScript(msg); sendToScript(msg);
} else if (msg.method === "showInvalidatedLightbox") { } else if (msg.method === "showInvalidatedLightbox") {
lightboxPopup.titleText = "Item Invalidated"; lightboxPopup.titleText = "Item Invalidated";
lightboxPopup.bodyText = 'Your item is marked "invalidated" because this item has been suspended ' + lightboxPopup.bodyText = 'This item has been invalidated and is no longer available.<br>' +
"from the Marketplace due to a claim against its author."; 'If you have questions, please contact marketplace@highfidelity.com.<br>' +
'Thank you!';
lightboxPopup.button1text = "CLOSE"; lightboxPopup.button1text = "CLOSE";
lightboxPopup.button1method = function() { lightboxPopup.button1method = function() {
lightboxPopup.visible = false; lightboxPopup.visible = false;

View file

@ -92,15 +92,19 @@ public:
ToolbarProxy(QObject* qmlObject, QObject* parent = nullptr); ToolbarProxy(QObject* qmlObject, QObject* parent = nullptr);
/**jsdoc /**jsdoc
* <em>Currently doesn't work.</em>
* @function ToolbarProxy#addButton * @function ToolbarProxy#addButton
* @param {object} properties * @param {object} properties - Button properties
* @returns {ToolbarButtonProxy} * @returns {object} The button added.
* @deprecated This method is deprecated and will be removed.
*/ */
Q_INVOKABLE ToolbarButtonProxy* addButton(const QVariant& properties); Q_INVOKABLE ToolbarButtonProxy* addButton(const QVariant& properties);
/**jsdoc /**jsdoc
* <em>Currently doesn't work.</em>
* @function ToolbarProxy#removeButton * @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); Q_INVOKABLE void removeButton(const QVariant& name);

View file

@ -1,117 +1,38 @@
var isActive = false; (function () {
var toolBar = (function() { // Get the system toolbar.
var that = {}, var toolbar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system");
toolBar, if (!toolbar) {
activeButton, print("ERROR: Couldn't get system toolbar.");
newModelButton, return;
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();
} }
that.setActive = function(active) { Script.setTimeout(function () {
if (active != isActive) { // Report the system toolbar visibility.
isActive = active; var isToolbarVisible = toolbar.readProperty("visible");
that.showTools(isActive); print("Toolbar visible: " + isToolbarVisible);
}
};
// Sets visibility of tool buttons, excluding the power button // Briefly toggle the system toolbar visibility.
that.showTools = function(doShow) { print("Toggle toolbar");
newModelButton.writeProperty('visible', doShow); toolbar.writeProperty("visible", !isToolbarVisible);
newShapeButton.writeProperty('visible', doShow); Script.setTimeout(function () {
newLightButton.writeProperty('visible', doShow); print("Toggle toolbar");
newTextButton.writeProperty('visible', doShow); toolbar.writeProperty("visible", isToolbarVisible);
newWebButton.writeProperty('visible', doShow); }, 2000);
newZoneButton.writeProperty('visible', doShow); }, 2000);
newParticleButton.writeProperty('visible', doShow);
newMaterialButton.writeProperty('visible', doShow); 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;
}()); }());