From 98f1664a46669666bcbf413f11cc6020276bcb37 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Wed, 25 Jan 2017 14:17:45 -0800 Subject: [PATCH] use a setting to decide which UI is enabled --- interface/src/scripting/HMDScriptingInterface.h | 7 +------ scripts/defaultScripts.js | 2 -- scripts/system/bubble.js | 2 +- scripts/system/edit.js | 2 +- scripts/system/goto.js | 2 +- scripts/system/help.js | 2 +- scripts/system/hmd.js | 6 +++--- scripts/system/marketplaces/marketplaces.js | 2 +- scripts/system/mute.js | 2 +- scripts/system/pal.js | 2 +- scripts/system/snapshot.js | 2 +- scripts/system/users.js | 2 +- 12 files changed, 13 insertions(+), 20 deletions(-) diff --git a/interface/src/scripting/HMDScriptingInterface.h b/interface/src/scripting/HMDScriptingInterface.h index a8c1600a16..f5744bb8d1 100644 --- a/interface/src/scripting/HMDScriptingInterface.h +++ b/interface/src/scripting/HMDScriptingInterface.h @@ -31,7 +31,7 @@ class HMDScriptingInterface : public AbstractHMDScriptingInterface, public Depen Q_PROPERTY(bool showTablet READ getShouldShowTablet) Q_PROPERTY(QUuid tabletID READ getCurrentTableUIID WRITE setCurrentTabletUIID) Q_PROPERTY(unsigned int homeButtonID READ getCurrentHomeButtonUUID WRITE setCurrentHomeButtonUUID) - Q_PROPERTY(bool hudUIEnabled READ getHUDUIEnabled WRITE setHUDUIEnabled); + public: Q_INVOKABLE glm::vec3 calculateRayUICollisionPoint(const glm::vec3& position, const glm::vec3& direction) const; @@ -96,9 +96,6 @@ public: void setCurrentHomeButtonUUID(unsigned int homeButtonID) { _homeButtonID = homeButtonID; } unsigned int getCurrentHomeButtonUUID() const { return _homeButtonID; } - bool getHUDUIEnabled() const { return _hudUIEnabled; } - void setHUDUIEnabled(bool value) { _hudUIEnabled = value; } - private: bool _showTablet { false }; QUuid _tabletUIID; // this is the entityID of the WebEntity which is part of (a child of) the tablet-ui. @@ -114,8 +111,6 @@ private: bool getHUDLookAtPosition3D(glm::vec3& result) const; glm::mat4 getWorldHMDMatrix() const; std::atomic _showHandControllersCount { 0 }; - - bool _hudUIEnabled; }; #endif // hifi_HMDScriptingInterface_h diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index f046351147..bd3131f4ff 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -43,8 +43,6 @@ var DEFAULT_SCRIPTS = [ var MENU_CATEGORY = "Developer"; var MENU_ITEM = "Debug defaultScripts.js"; -HMD.hudUIEnabled = true; - var SETTINGS_KEY = '_debugDefaultScriptsIsChecked'; var previousSetting = Settings.getValue(SETTINGS_KEY); diff --git a/scripts/system/bubble.js b/scripts/system/bubble.js index 4d93926abb..b5134e096b 100644 --- a/scripts/system/bubble.js +++ b/scripts/system/bubble.js @@ -165,7 +165,7 @@ // Setup the bubble button var buttonName = "BUBBLE"; - if (HMD.hudUIEnabled) { + if (Settings.getValue("HUDUIEnabled")) { var toolbar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); button = toolbar.addButton({ objectName: 'bubble', diff --git a/scripts/system/edit.js b/scripts/system/edit.js index 075bc4360d..7a6f063077 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -237,7 +237,7 @@ var toolBar = (function () { }); - if (HMD.hudUIEnabled) { + if (Settings.getValue("HUDUIEnabled")) { systemToolbar = Toolbars.getToolbar(SYSTEM_TOOLBAR); activeButton = systemToolbar.addButton({ objectName: EDIT_TOGGLE_BUTTON, diff --git a/scripts/system/goto.js b/scripts/system/goto.js index b9ae33339b..30f6ca255c 100644 --- a/scripts/system/goto.js +++ b/scripts/system/goto.js @@ -27,7 +27,7 @@ function onClicked(){ DialogsManager.toggleAddressBar(); } -if (HMD.hudUIEnabled) { +if (Settings.getValue("HUDUIEnabled")) { toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); button = toolBar.addButton({ objectName: buttonName, diff --git a/scripts/system/help.js b/scripts/system/help.js index 483a1c3dc4..f3f3007b65 100644 --- a/scripts/system/help.js +++ b/scripts/system/help.js @@ -18,7 +18,7 @@ var buttonName = "HELP"; var toolBar = null; var tablet = null; - if (HMD.hudUIEnabled) { + if (Settings.getValue("HUDUIEnabled")) { toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); button = toolBar.addButton({ objectName: buttonName, diff --git a/scripts/system/hmd.js b/scripts/system/hmd.js index 0261b2f684..bd525d7b14 100644 --- a/scripts/system/hmd.js +++ b/scripts/system/hmd.js @@ -40,7 +40,7 @@ var button; var toolBar = null; var tablet = null; -if (HMD.hudUIEnabled) { +if (Settings.getValue("HUDUIEnabled")) { toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); } else { tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); @@ -50,7 +50,7 @@ if (HMD.hudUIEnabled) { // Disable them in hmd. var desktopOnlyViews = ['Mirror', 'Independent Mode', 'Entity Mode']; function onHmdChanged(isHmd) { - if (HMD.hudUIEnabled) { + if (Settings.getValue("HUDUIEnabled")) { button.writeProperty('buttonState', isHmd ? 0 : 1); button.writeProperty('defaultState', isHmd ? 0 : 1); button.writeProperty('hoverState', isHmd ? 2 : 3); @@ -78,7 +78,7 @@ function onClicked(){ Menu.setIsOptionChecked(isDesktop ? headset : desktopMenuItemName, true); } if (headset) { - if (HMD.hudUIEnabled) { + if (Settings.getValue("HUDUIEnabled")) { button = toolBar.addButton({ objectName: "hmdToggle", imageURL: Script.resolvePath("assets/images/tools/switch.svg"), diff --git a/scripts/system/marketplaces/marketplaces.js b/scripts/system/marketplaces/marketplaces.js index 2b17cf3b7e..24eda5b6a3 100644 --- a/scripts/system/marketplaces/marketplaces.js +++ b/scripts/system/marketplaces/marketplaces.js @@ -112,7 +112,7 @@ function toggleMarketplace() { var tablet = null; var toolBar = null; var marketplaceButton = null; -if (HMD.hudUIEnabled) { +if (Settings.getValue("HUDUIEnabled")) { marketplaceWindow = new OverlayWebWindow({ title: "Marketplace", source: "about:blank", diff --git a/scripts/system/mute.js b/scripts/system/mute.js index 147e87d3e4..f94dbc242c 100644 --- a/scripts/system/mute.js +++ b/scripts/system/mute.js @@ -26,7 +26,7 @@ function onClicked(){ Menu.setIsOptionChecked(menuItem, !Menu.isOptionChecked(menuItem)); } -if (HMD.hudUIEnabled) { +if (Settings.getValue("HUDUIEnabled")) { toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); button = toolBar.addButton({ objectName: buttonName, diff --git a/scripts/system/pal.js b/scripts/system/pal.js index 7a5546c949..92bc410404 100644 --- a/scripts/system/pal.js +++ b/scripts/system/pal.js @@ -481,7 +481,7 @@ var button; var buttonName = "PAL"; var tablet = null; var toolBar = null; -if (HMD.hudUIEnabled) { +if (Settings.getValue("HUDUIEnabled")) { toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); button = toolBar.addButton({ objectName: buttonName, diff --git a/scripts/system/snapshot.js b/scripts/system/snapshot.js index 6d2fb01d29..db0c7bd36e 100644 --- a/scripts/system/snapshot.js +++ b/scripts/system/snapshot.js @@ -22,7 +22,7 @@ var buttonName = "SNAP"; var tablet = null; var toolBar = null; -if (HMD.hudUIEnabled) { +if (Settings.getValue("HUDUIEnabled")) { toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); button = toolBar.addButton({ objectName: buttonName, diff --git a/scripts/system/users.js b/scripts/system/users.js index b081768543..ce795b38e5 100644 --- a/scripts/system/users.js +++ b/scripts/system/users.js @@ -20,7 +20,7 @@ var tablet = null; var MENU_ITEM = "Users Online"; -if (HMD.hudUIEnabled) { +if (Settings.getValue("HUDUIEnabled")) { toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); button = toolBar.addButton({ objectName: buttonName,