diff --git a/interface/resources/icons/tablet-icons/bubble-i.svg b/interface/resources/icons/tablet-icons/bubble-i.svg new file mode 100644 index 0000000000..d7c8948e01 --- /dev/null +++ b/interface/resources/icons/tablet-icons/bubble-i.svg @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/interface/resources/icons/tablet-icons/edit-i.svg b/interface/resources/icons/tablet-icons/edit-i.svg new file mode 100644 index 0000000000..e430333597 --- /dev/null +++ b/interface/resources/icons/tablet-icons/edit-i.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + diff --git a/interface/resources/icons/tablet-icons/goto-i.svg b/interface/resources/icons/tablet-icons/goto-i.svg new file mode 100644 index 0000000000..911e346866 --- /dev/null +++ b/interface/resources/icons/tablet-icons/goto-i.svg @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/interface/resources/icons/tablet-icons/help-i.svg b/interface/resources/icons/tablet-icons/help-i.svg new file mode 100644 index 0000000000..8d53e04d64 --- /dev/null +++ b/interface/resources/icons/tablet-icons/help-i.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + diff --git a/interface/resources/icons/tablet-icons/ignore-i.svg b/interface/resources/icons/tablet-icons/ignore-i.svg new file mode 100644 index 0000000000..3b73385574 --- /dev/null +++ b/interface/resources/icons/tablet-icons/ignore-i.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + diff --git a/interface/resources/icons/tablet-icons/ignore.svg b/interface/resources/icons/tablet-icons/ignore.svg new file mode 100644 index 0000000000..f315c5f249 --- /dev/null +++ b/interface/resources/icons/tablet-icons/ignore.svg @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/interface/resources/icons/tablet-icons/kick.svg b/interface/resources/icons/tablet-icons/kick.svg new file mode 100644 index 0000000000..1eed6e7f43 --- /dev/null +++ b/interface/resources/icons/tablet-icons/kick.svg @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/interface/resources/icons/tablet-icons/market-i.svg b/interface/resources/icons/tablet-icons/market-i.svg new file mode 100644 index 0000000000..bf9aa9335f --- /dev/null +++ b/interface/resources/icons/tablet-icons/market-i.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + diff --git a/interface/resources/icons/tablet-icons/menu-i.svg b/interface/resources/icons/tablet-icons/menu-i.svg new file mode 100644 index 0000000000..a7a7400ffd --- /dev/null +++ b/interface/resources/icons/tablet-icons/menu-i.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/interface/resources/icons/tablet-icons/mic-a.svg b/interface/resources/icons/tablet-icons/mic-a.svg new file mode 100644 index 0000000000..69feec7c17 --- /dev/null +++ b/interface/resources/icons/tablet-icons/mic-a.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/interface/resources/icons/tablet-icons/mic-i.svg b/interface/resources/icons/tablet-icons/mic-i.svg new file mode 100644 index 0000000000..c4eda55cbc --- /dev/null +++ b/interface/resources/icons/tablet-icons/mic-i.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + diff --git a/interface/resources/icons/tablet-icons/people-i.svg b/interface/resources/icons/tablet-icons/people-i.svg new file mode 100644 index 0000000000..8665dfc6f7 --- /dev/null +++ b/interface/resources/icons/tablet-icons/people-i.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + diff --git a/interface/resources/icons/tablet-icons/scripts-i.svg b/interface/resources/icons/tablet-icons/scripts-i.svg new file mode 100644 index 0000000000..647cf805ce --- /dev/null +++ b/interface/resources/icons/tablet-icons/scripts-i.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + diff --git a/interface/resources/icons/tablet-icons/snap-i.svg b/interface/resources/icons/tablet-icons/snap-i.svg new file mode 100644 index 0000000000..abafa1c3cf --- /dev/null +++ b/interface/resources/icons/tablet-icons/snap-i.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + diff --git a/interface/resources/icons/tablet-icons/switch-a.svg b/interface/resources/icons/tablet-icons/switch-a.svg new file mode 100644 index 0000000000..2e26d09e62 --- /dev/null +++ b/interface/resources/icons/tablet-icons/switch-a.svg @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/interface/resources/icons/tablet-icons/switch-i.svg b/interface/resources/icons/tablet-icons/switch-i.svg new file mode 100644 index 0000000000..a6460f9c27 --- /dev/null +++ b/interface/resources/icons/tablet-icons/switch-i.svg @@ -0,0 +1,15 @@ + + + + + + + + + + diff --git a/interface/resources/qml/hifi/tablet/Tablet.qml b/interface/resources/qml/hifi/tablet/Tablet.qml index 93d388b374..9a4be95b64 100644 --- a/interface/resources/qml/hifi/tablet/Tablet.qml +++ b/interface/resources/qml/hifi/tablet/Tablet.qml @@ -166,28 +166,6 @@ Item { anchors.top: parent.top anchors.topMargin: 30 } - - Component.onCompleted: { - console.log("Tablet.onCompleted!"); - var component = Qt.createComponent("TabletButton.qml"); - var buttons = []; - for (var i = 0; i < 6; i++) { - var button = component.createObject(flowMain); - button.inDebugMode = true; - buttons.push(button); - } - - // set button text - buttons[0].text = "MUTE"; - buttons[1].text = "VR"; - buttons[2].text = "MENU"; - buttons[3].text = "BUBBLE"; - buttons[4].text = "SNAP"; - buttons[5].text = "HELP"; - - // set button icon - buttons[0].icon = "icons/tablet-mute-icon.svg" - } } states: [ State { diff --git a/scripts/system/bubble.js b/scripts/system/bubble.js index 508006be83..e787793eb2 100644 --- a/scripts/system/bubble.js +++ b/scripts/system/bubble.js @@ -166,6 +166,7 @@ // Setup the bubble button and add it to the toolbar var button = tablet.addButton({ + icon: "icons/tablet-icons/bubble-i.svg", text: "BUBBLE" }); onBubbleToggled(); @@ -176,8 +177,8 @@ // Cleanup the toolbar button and overlays when script is stopped Script.scriptEnding.connect(function () { - tablet.removeButton('bubble'); button.clicked.disconnect(Users.toggleIgnoreRadius); + tablet.removeButton(button); Users.ignoreRadiusEnabledChanged.disconnect(onBubbleToggled); Users.enteredIgnoreRadius.disconnect(enteredIgnoreRadius); Overlays.deleteOverlay(bubbleOverlay); diff --git a/scripts/system/controllers/handControllerGrab.js b/scripts/system/controllers/handControllerGrab.js index 2fa44da0eb..103981cb2d 100644 --- a/scripts/system/controllers/handControllerGrab.js +++ b/scripts/system/controllers/handControllerGrab.js @@ -1284,11 +1284,11 @@ function MyController(hand) { Entities.sendHoverOverEntity(entity, pointerEvent); } - if (!isEditing()) { - this.grabbedEntity = entity; - this.setState(STATE_ENTITY_TOUCHING, "begin touching entity '" + name + "'"); - return; - } + + this.grabbedEntity = entity; + this.setState(STATE_ENTITY_TOUCHING, "begin touching entity '" + name + "'"); + return; + } else if (this.hoverEntity) { pointerEvent = { type: "Move", @@ -1340,11 +1340,11 @@ function MyController(hand) { Overlays.sendHoverOverOverlay(overlay, pointerEvent); } - if (!isEditing()) { - this.grabbedOverlay = overlay; - this.setState(STATE_OVERLAY_TOUCHING, "begin touching overlay '" + overlay + "'"); - return; - } + + this.grabbedOverlay = overlay; + this.setState(STATE_OVERLAY_TOUCHING, "begin touching overlay '" + overlay + "'"); + return; + } else if (this.hoverOverlay) { pointerEvent = { diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 63e64ba982..4c931589d9 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -196,7 +196,6 @@ var toolBar = (function () { function cleanup() { that.setActive(false); - systemToolbar.removeButton(EDIT_TOGGLE_BUTTON); } function addButton(name, image, handler) { @@ -233,6 +232,7 @@ var toolBar = (function () { tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); activeButton = tablet.addButton({ + icon: "icons/tablet-icons/edit-i.svg", text: "EDIT" }); @@ -478,7 +478,6 @@ var toolBar = (function () { toolBar.writeProperty("shown", false); toolBar.writeProperty("shown", true); } - // toolBar.selectTool(activeButton, isActive); lightOverlayManager.setVisible(isActive && Menu.isOptionChecked(MENU_SHOW_LIGHTS_IN_EDIT_MODE)); Entities.setDrawZoneBoundaries(isActive && Menu.isOptionChecked(MENU_SHOW_ZONES_IN_EDIT_MODE)); }; diff --git a/scripts/system/goto.js b/scripts/system/goto.js index 62b9dce35b..5059a27ce2 100644 --- a/scripts/system/goto.js +++ b/scripts/system/goto.js @@ -16,6 +16,7 @@ var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); var isActive = false var button = tablet.addButton({ + icon: "icons/tablet-icons/goto-i.svg", text:"GOTO" }); @@ -35,8 +36,8 @@ button.clicked.connect(onClicked); DialogsManager.addressBarShown.connect(onAddressBarShown); Script.scriptEnding.connect(function () { - toolBar.removeButton("goto"); button.clicked.disconnect(onClicked); + tablet.removeButton(button); DialogsManager.addressBarShown.disconnect(onAddressBarShown); }); diff --git a/scripts/system/help.js b/scripts/system/help.js index b95ccbb529..663d2edf56 100644 --- a/scripts/system/help.js +++ b/scripts/system/help.js @@ -16,6 +16,7 @@ var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); var button = tablet.addButton({ + icon: "icons/tablet-icons/help-i.svg", text: "HELP" }); diff --git a/scripts/system/hmd.js b/scripts/system/hmd.js index bfe2be7664..e6e8ed1c5c 100644 --- a/scripts/system/hmd.js +++ b/scripts/system/hmd.js @@ -53,6 +53,7 @@ function onClicked(){ } if (headset) { button = tablet.addButton({ + icon: "icons/tablet-icons/switch-a.svg", text: "SWITCH" }); onHmdChanged(HMD.active); diff --git a/scripts/system/libraries/WebTablet.js b/scripts/system/libraries/WebTablet.js index 1445e9250e..b169a644bb 100644 --- a/scripts/system/libraries/WebTablet.js +++ b/scripts/system/libraries/WebTablet.js @@ -117,6 +117,8 @@ WebTablet = function (url, width, dpi, location, clientOnly) { Entities.editEntity(_this.homeButtonEntity, {color: {red: 255, green: 255, blue: 0}}); _this.clicked = true; } + var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + tablet.gotoHomeScreen(); } } diff --git a/scripts/system/marketplaces/marketplace.js b/scripts/system/marketplaces/marketplace.js index 04e59697d1..f365ca5d4c 100644 --- a/scripts/system/marketplaces/marketplace.js +++ b/scripts/system/marketplaces/marketplace.js @@ -42,30 +42,11 @@ function shouldShowWebTablet() { } function showMarketplace(marketplaceID) { - if (shouldShowWebTablet()) { - updateButtonState(true); - - if (HMD.tabletID) { - UIWebTablet.createWebEntity("https://metaverse.highfidelity.com/marketplace"); - HMD.tabletID = UIWebTablet.webEntityID; - } else { - marketplaceWebTablet = new WebTablet("https://metaverse.highfidelity.com/marketplace", - null, // width - null, // dpi - null, // location - true); // client-only - marketplaceWebTablet.register(); - } - Settings.setValue(persistenceKey, marketplaceWebTablet.pickle()); - } else { - var url = MARKETPLACE_URL; - if (marketplaceID) { - url = url + "/items/" + marketplaceID; - } - marketplaceWindow.setURL(url); - marketplaceWindow.setVisible(true); + var url = MARKETPLACE_URL; + if (marketplaceID) { + url = url + "/items/" + marketplaceID; } - + tablet.gotoWebScreen(url); marketplaceVisible = true; UserActivityLogger.openedMarketplace(); } @@ -81,15 +62,14 @@ function hideTablet(tablet) { Settings.setValue(persistenceKey, ""); } function clearOldTablet() { // If there was a tablet from previous domain or session, kill it and let it be recreated - var tablet = WebTablet.unpickle(Settings.getValue(persistenceKey, "")); - hideTablet(tablet); + } function hideMarketplace() { if (marketplaceWindow.visible) { marketplaceWindow.setVisible(false); marketplaceWindow.setURL("about:blank"); } else if (marketplaceWebTablet) { - hideTablet(marketplaceWebTablet); + } marketplaceVisible = false; } @@ -102,21 +82,15 @@ function toggleMarketplace() { } } -var toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); +var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); -var browseExamplesButton = toolBar.addButton({ - imageURL: toolIconUrl + "market.svg", - objectName: "marketplace", - buttonState: 1, - defaultState: 1, - hoverState: 3, - alpha: 0.9 +var browseExamplesButton = tablet.addButton({ + icon: "icons/tablet-icons/market-i.svg", + text: "MARKET" }); function updateButtonState(visible) { - browseExamplesButton.writeProperty('buttonState', visible ? 0 : 1); - browseExamplesButton.writeProperty('defaultState', visible ? 0 : 1); - browseExamplesButton.writeProperty('hoverState', visible ? 2 : 3); + } function onMarketplaceWindowVisibilityChanged() { updateButtonState(marketplaceWindow.visible); @@ -135,8 +109,8 @@ clearOldTablet(); // Run once at startup, in case there's anything laying around // but the HUD version stays around, so lets do the same. Script.scriptEnding.connect(function () { - toolBar.removeButton("marketplace"); browseExamplesButton.clicked.disconnect(onClick); + tablet.removeButton(browseExamplesButton); marketplaceWindow.visibleChanged.disconnect(onMarketplaceWindowVisibilityChanged); }); diff --git a/scripts/system/mod.js b/scripts/system/mod.js index 7e5cc5d2a5..a3b4974f8d 100644 --- a/scripts/system/mod.js +++ b/scripts/system/mod.js @@ -18,29 +18,24 @@ Script.include("/~/system/libraries/controllers.js"); // grab the toolbar -var toolbar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); +var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); var ASSETS_PATH = Script.resolvePath("assets"); var TOOLS_PATH = Script.resolvePath("assets/images/tools/"); function buttonImageURL() { - return TOOLS_PATH + (Users.canKick ? 'kick.svg' : 'ignore.svg'); + return (Users.canKick ? "kick.svg" : "ignore.svg"); } // setup the mod button and add it to the toolbar -var button = toolbar.addButton({ - objectName: 'mod', - imageURL: buttonImageURL(), - visible: true, - buttonState: 1, - defaultState: 1, - hoverState: 3, - alpha: 0.9 +var button = tablet.addButton({ + icon: "icons/tablet-icons/ignore-i.svg", + text: "KICK" }); // if this user's kick permissions change, change the state of the button in the HUD Users.canKickChanged.connect(function(canKick){ - button.writeProperty('imageURL', buttonImageURL()); + button.editProperties({text: buttonImageURL()}); }); var isShowingOverlays = false; @@ -69,9 +64,7 @@ function buttonClicked(){ isShowingOverlays = true; } - button.writeProperty('buttonState', isShowingOverlays ? 0 : 1); - button.writeProperty('defaultState', isShowingOverlays ? 0 : 1); - button.writeProperty('hoverState', isShowingOverlays ? 2 : 3); + } button.clicked.connect(buttonClicked); @@ -251,7 +244,7 @@ triggerMapping.enable(); // cleanup the toolbar button and overlays when script is stopped Script.scriptEnding.connect(function() { - toolbar.removeButton('mod'); + tablet.removeButton(button); removeOverlays(); triggerMapping.disable(); }); diff --git a/scripts/system/mute.js b/scripts/system/mute.js index 722ed65b3d..97a00fb0b2 100644 --- a/scripts/system/mute.js +++ b/scripts/system/mute.js @@ -13,26 +13,18 @@ (function() { // BEGIN LOCAL_SCOPE -var toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); +var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); -var button = toolBar.addButton({ - objectName: "mute", - imageURL: Script.resolvePath("assets/images/tools/mic.svg"), - visible: true, - buttonState: 1, - defaultState: 1, - hoverState: 3, - alpha: 0.9 +function muteURL() { + return "icons/tablet-icons/" + (AudioDevice.getMuted() ? "mic-a.svg" : "mic-i.svg"); +} +var button = tablet.addButton({ + icon: "icons/tablet-icons/mic-a.svg", + text: "MUTE" }); function onMuteToggled() { - // We could just toggle state, but we're less likely to get out of wack if we read the AudioDevice. - // muted => button "on" state => 1. go figure. - var state = AudioDevice.getMuted() ? 0 : 1; - var hoverState = AudioDevice.getMuted() ? 2 : 3; - button.writeProperty('buttonState', state); - button.writeProperty('defaultState', state); - button.writeProperty('hoverState', hoverState); + button.editProperties({icon: muteURL()}); } onMuteToggled(); function onClicked(){ @@ -43,8 +35,8 @@ button.clicked.connect(onClicked); AudioDevice.muteToggled.connect(onMuteToggled); Script.scriptEnding.connect(function () { - toolBar.removeButton("mute"); button.clicked.disconnect(onClicked); + tablet.removeButton(button); AudioDevice.muteToggled.disconnect(onMuteToggled); }); diff --git a/scripts/system/snapshot.js b/scripts/system/snapshot.js index d79a6e46cb..06a148be2f 100644 --- a/scripts/system/snapshot.js +++ b/scripts/system/snapshot.js @@ -11,18 +11,13 @@ (function() { // BEGIN LOCAL_SCOPE var SNAPSHOT_DELAY = 500; // 500ms -var toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); +var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); var resetOverlays; var reticleVisible; var clearOverlayWhenMoving; -var button = toolBar.addButton({ - objectName: "snapshot", - imageURL: Script.resolvePath("assets/images/tools/snap.svg"), - visible: true, - buttonState: 1, - defaultState: 1, - hoverState: 2, - alpha: 0.9, +var button = tablet.addButton({ + icon: "icons/tablet-icons/snap-i.svg", + text: "SNAP" }); function shouldOpenFeedAfterShare() { @@ -116,18 +111,11 @@ function onClicked() { reticleVisible = Reticle.visible; Reticle.visible = false; Window.snapshotTaken.connect(resetButtons); - - button.writeProperty("buttonState", 0); - button.writeProperty("defaultState", 0); - button.writeProperty("hoverState", 2); // hide overlays if they are on if (resetOverlays) { Menu.setIsOptionChecked("Overlays", false); } - - // hide hud - toolBar.writeProperty("visible", false); // take snapshot (with no notification) Script.setTimeout(function () { @@ -160,7 +148,7 @@ function resetButtons(pathStillSnapshot, pathAnimatedSnapshot, notify) { // If we ARE taking an animated snapshot, we've already re-enabled the HUD by this point. if (pathAnimatedSnapshot === "") { // show hud - toolBar.writeProperty("visible", true); + Reticle.visible = reticleVisible; // show overlays if they were on if (resetOverlays) { @@ -170,10 +158,6 @@ function resetButtons(pathStillSnapshot, pathAnimatedSnapshot, notify) { // Allow the user to click the snapshot HUD button again button.clicked.connect(onClicked); } - // update button states - button.writeProperty("buttonState", 1); - button.writeProperty("defaultState", 1); - button.writeProperty("hoverState", 3); Window.snapshotTaken.disconnect(resetButtons); // A Snapshot Review dialog might be left open indefinitely after taking the picture, @@ -197,14 +181,8 @@ function resetButtons(pathStillSnapshot, pathAnimatedSnapshot, notify) { function processingGif() { // show hud - toolBar.writeProperty("visible", true); Reticle.visible = reticleVisible; - // update button states - button.writeProperty("buttonState", 0); - button.writeProperty("defaultState", 0); - button.writeProperty("hoverState", 2); - // Don't allow the user to click the snapshot button yet button.clicked.disconnect(onClicked); // show overlays if they were on if (resetOverlays) { @@ -217,8 +195,8 @@ Window.snapshotShared.connect(snapshotShared); Window.processingGif.connect(processingGif); Script.scriptEnding.connect(function () { - toolBar.removeButton("snapshot"); button.clicked.disconnect(onClicked); + tablet.removeButton(button); Window.snapshotShared.disconnect(snapshotShared); Window.processingGif.disconnect(processingGif); }); diff --git a/scripts/system/tablet-ui/tabletUI.js b/scripts/system/tablet-ui/tabletUI.js index 077485ea35..784d7727d5 100644 --- a/scripts/system/tablet-ui/tabletUI.js +++ b/scripts/system/tablet-ui/tabletUI.js @@ -26,18 +26,6 @@ UIWebTablet = new WebTablet("qml/hifi/tablet/TabletRoot.qml", null, null, tabletLocation); UIWebTablet.register(); HMD.tabletID = UIWebTablet.webEntityID; - - var setUpTabletUI = function() { - var root = UIWebTablet.getRoot(); - if (!root) { - print("HERE no root yet"); - Script.setTimeout(setUpTabletUI, 100); - return; - } - print("HERE got root", root); - } - - Script.setTimeout(setUpTabletUI, 100); } function hideTabletUI() {