From 9e3d8b0b6dbb0b89a6c8e320b563a4fda615be54 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 10 Feb 2017 20:11:20 +1300 Subject: [PATCH 1/7] Move the audio devices list into the root audio dialog --- scripts/system/selectAudioDevice.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/system/selectAudioDevice.js b/scripts/system/selectAudioDevice.js index c618909e8c..3f3b160630 100644 --- a/scripts/system/selectAudioDevice.js +++ b/scripts/system/selectAudioDevice.js @@ -52,8 +52,7 @@ var selectedInputMenu = ""; var selectedOutputMenu = ""; function setupAudioMenus() { - Menu.addMenu("Audio > Devices"); - Menu.addSeparator("Audio > Devices","Output Audio Device"); + Menu.addSeparator("Audio", "Output Audio Device"); var outputDeviceSetting = Settings.getValue(OUTPUT_DEVICE_SETTING); var outputDevices = AudioDevice.getOutputDevices(); @@ -68,7 +67,7 @@ function setupAudioMenus() { var thisDeviceSelected = (outputDevices[i] == selectedOutputDevice); var menuItem = "Use " + outputDevices[i] + " for Output"; Menu.addMenuItem({ - menuName: "Audio > Devices", + menuName: "Audio", menuItemName: menuItem, isCheckable: true, isChecked: thisDeviceSelected @@ -78,7 +77,7 @@ function setupAudioMenus() { } } - Menu.addSeparator("Audio > Devices","Input Audio Device"); + Menu.addSeparator("Audio", "Input Audio Device"); var inputDeviceSetting = Settings.getValue(INPUT_DEVICE_SETTING); var inputDevices = AudioDevice.getInputDevices(); @@ -93,7 +92,7 @@ function setupAudioMenus() { var thisDeviceSelected = (inputDevices[i] == selectedInputDevice); var menuItem = "Use " + inputDevices[i] + " for Input"; Menu.addMenuItem({ - menuName: "Audio > Devices", + menuName: "Audio", menuItemName: menuItem, isCheckable: true, isChecked: thisDeviceSelected From 8a995cc1d2774b616ab3a37c6e17bf3032d244d8 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Fri, 10 Feb 2017 20:14:52 +1300 Subject: [PATCH 2/7] Display list of audio input devices before list of audio output devices --- scripts/system/selectAudioDevice.js | 50 ++++++++++++++--------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/scripts/system/selectAudioDevice.js b/scripts/system/selectAudioDevice.js index 3f3b160630..9b97b24455 100644 --- a/scripts/system/selectAudioDevice.js +++ b/scripts/system/selectAudioDevice.js @@ -52,31 +52,6 @@ var selectedInputMenu = ""; var selectedOutputMenu = ""; function setupAudioMenus() { - Menu.addSeparator("Audio", "Output Audio Device"); - - var outputDeviceSetting = Settings.getValue(OUTPUT_DEVICE_SETTING); - var outputDevices = AudioDevice.getOutputDevices(); - var selectedOutputDevice = AudioDevice.getOutputDevice(); - if (outputDevices.indexOf(outputDeviceSetting) != -1 && selectedOutputDevice != outputDeviceSetting) { - if (AudioDevice.setOutputDevice(outputDeviceSetting)) { - selectedOutputDevice = outputDeviceSetting; - } - } - print("audio output devices: " + outputDevices); - for(var i = 0; i < outputDevices.length; i++) { - var thisDeviceSelected = (outputDevices[i] == selectedOutputDevice); - var menuItem = "Use " + outputDevices[i] + " for Output"; - Menu.addMenuItem({ - menuName: "Audio", - menuItemName: menuItem, - isCheckable: true, - isChecked: thisDeviceSelected - }); - if (thisDeviceSelected) { - selectedOutputMenu = menuItem; - } - } - Menu.addSeparator("Audio", "Input Audio Device"); var inputDeviceSetting = Settings.getValue(INPUT_DEVICE_SETTING); @@ -101,6 +76,31 @@ function setupAudioMenus() { selectedInputMenu = menuItem; } } + + Menu.addSeparator("Audio", "Output Audio Device"); + + var outputDeviceSetting = Settings.getValue(OUTPUT_DEVICE_SETTING); + var outputDevices = AudioDevice.getOutputDevices(); + var selectedOutputDevice = AudioDevice.getOutputDevice(); + if (outputDevices.indexOf(outputDeviceSetting) != -1 && selectedOutputDevice != outputDeviceSetting) { + if (AudioDevice.setOutputDevice(outputDeviceSetting)) { + selectedOutputDevice = outputDeviceSetting; + } + } + print("audio output devices: " + outputDevices); + for (var i = 0; i < outputDevices.length; i++) { + var thisDeviceSelected = (outputDevices[i] == selectedOutputDevice); + var menuItem = "Use " + outputDevices[i] + " for Output"; + Menu.addMenuItem({ + menuName: "Audio", + menuItemName: menuItem, + isCheckable: true, + isChecked: thisDeviceSelected + }); + if (thisDeviceSelected) { + selectedOutputMenu = menuItem; + } + } } function onDevicechanged() { From b5b92c1508f9156aa5bd0ee0120d39c5973f7f0d Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 11 Feb 2017 09:53:02 +1300 Subject: [PATCH 3/7] Make the tablet's mic icon reflect the current mute state --- interface/resources/qml/hifi/tablet/Tablet.qml | 9 +++++++-- libraries/script-engine/src/TabletScriptingInterface.cpp | 9 +++++++++ libraries/script-engine/src/TabletScriptingInterface.h | 7 +++++++ scripts/system/tablet-ui/tabletUI.js | 3 +++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/Tablet.qml b/interface/resources/qml/hifi/tablet/Tablet.qml index 0d563ed5bb..d1e11d5242 100644 --- a/interface/resources/qml/hifi/tablet/Tablet.qml +++ b/interface/resources/qml/hifi/tablet/Tablet.qml @@ -6,10 +6,16 @@ Item { id: tablet objectName: "tablet" property double micLevel: 0.8 + property bool micEnabled: true property int rowIndex: 0 property int columnIndex: 0 property int count: (flowMain.children.length - 1) + // called by C++ code to keep mic state updated + function setMicEnabled(newMicEnabled) { + tablet.micEnabled = newMicEnabled; + } + // called by C++ code to keep audio bar updated function setMicLevel(newMicLevel) { tablet.micLevel = newMicLevel; @@ -102,7 +108,7 @@ Item { id: muteIcon width: 40 height: 40 - source: "../../../icons/tablet-mute-icon.svg" + source: tablet.micEnabled ? "../../../icons/tablet-icons/mic-i.svg" : "../../../icons/tablet-icons/mic-a.svg" anchors.verticalCenter: parent.verticalCenter } @@ -175,7 +181,6 @@ Item { GradientStop { position: 0 color: "#2b2b2b" - } GradientStop { diff --git a/libraries/script-engine/src/TabletScriptingInterface.cpp b/libraries/script-engine/src/TabletScriptingInterface.cpp index 71f0073ead..215c3a98e6 100644 --- a/libraries/script-engine/src/TabletScriptingInterface.cpp +++ b/libraries/script-engine/src/TabletScriptingInterface.cpp @@ -309,6 +309,15 @@ void TabletProxy::removeButton(QObject* tabletButtonProxy) { } } +void TabletProxy::updateMicEnabled(const bool micOn) { + auto tablet = getQmlTablet(); + if (!tablet) { + //qCCritical(scriptengine) << "Could not find tablet in TabletRoot.qml"; + } else { + QMetaObject::invokeMethod(tablet, "setMicEnabled", Qt::AutoConnection, Q_ARG(QVariant, QVariant(micOn))); + } +} + void TabletProxy::updateAudioBar(const double micLevel) { auto tablet = getQmlTablet(); if (!tablet) { diff --git a/libraries/script-engine/src/TabletScriptingInterface.h b/libraries/script-engine/src/TabletScriptingInterface.h index 93f5bcf6ba..d5eccb2479 100644 --- a/libraries/script-engine/src/TabletScriptingInterface.h +++ b/libraries/script-engine/src/TabletScriptingInterface.h @@ -106,6 +106,13 @@ public: */ Q_INVOKABLE void removeButton(QObject* tabletButtonProxy); + /**jsdoc + * Updates the tablet's mic enabled state + * @function TabletProxy#updateMicEnabled + * @param micEnabled {bool} mic enabled state + */ + Q_INVOKABLE void updateMicEnabled(const bool micEnabled); + /**jsdoc * Updates the audio bar in tablet to reflect latest mic level * @function TabletProxy#updateAudioBar diff --git a/scripts/system/tablet-ui/tabletUI.js b/scripts/system/tablet-ui/tabletUI.js index dc1d71f402..1dc6b7fef8 100644 --- a/scripts/system/tablet-ui/tabletUI.js +++ b/scripts/system/tablet-ui/tabletUI.js @@ -53,8 +53,11 @@ function updateShowTablet() { if (tabletShown) { + var MUTE_MICROPHONE_MENU_ITEM = "Mute Microphone"; + var currentMicEnabled = !Menu.isOptionChecked(MUTE_MICROPHONE_MENU_ITEM); var currentMicLevel = getMicLevel(); var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); + tablet.updateMicEnabled(currentMicEnabled); tablet.updateAudioBar(currentMicLevel); } From acaf8c69c6f6f6210de7c5f1ed02da15bed7d7a7 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 11 Feb 2017 11:07:31 +1300 Subject: [PATCH 4/7] Better tablet mic muted and unmuted iconography --- .../resources/icons/tablet-icons/mic-mute.svg | 60 ++++++++++++++++++ .../resources/icons/tablet-icons/mic.svg | 62 +++++++++++++++++++ .../resources/qml/hifi/tablet/Tablet.qml | 31 ++++++++-- 3 files changed, 147 insertions(+), 6 deletions(-) create mode 100644 interface/resources/icons/tablet-icons/mic-mute.svg create mode 100644 interface/resources/icons/tablet-icons/mic.svg diff --git a/interface/resources/icons/tablet-icons/mic-mute.svg b/interface/resources/icons/tablet-icons/mic-mute.svg new file mode 100644 index 0000000000..bd42fded05 --- /dev/null +++ b/interface/resources/icons/tablet-icons/mic-mute.svg @@ -0,0 +1,60 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/interface/resources/icons/tablet-icons/mic.svg b/interface/resources/icons/tablet-icons/mic.svg new file mode 100644 index 0000000000..30b46d18dd --- /dev/null +++ b/interface/resources/icons/tablet-icons/mic.svg @@ -0,0 +1,62 @@ + + + +image/svg+xml \ No newline at end of file diff --git a/interface/resources/qml/hifi/tablet/Tablet.qml b/interface/resources/qml/hifi/tablet/Tablet.qml index d1e11d5242..9c9f17d067 100644 --- a/interface/resources/qml/hifi/tablet/Tablet.qml +++ b/interface/resources/qml/hifi/tablet/Tablet.qml @@ -103,13 +103,32 @@ Item { anchors.topMargin: 0 anchors.top: parent.top - - Image { - id: muteIcon + Item { + anchors.verticalCenter: parent.verticalCenter width: 40 height: 40 - source: tablet.micEnabled ? "../../../icons/tablet-icons/mic-i.svg" : "../../../icons/tablet-icons/mic-a.svg" - anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 5 + + Image { + id: micIcon + source: "../../../icons/tablet-icons/mic.svg" + } + + Item { + visible: !tablet.micEnabled + + Image { + id: muteIcon + source: "../../../icons/tablet-icons/mic-mute.svg" + } + + ColorOverlay { + anchors.fill: muteIcon + source: muteIcon + color: "#ff0000" + } + } } Item { @@ -230,7 +249,7 @@ Item { PropertyChanges { target: muteIcon - source: "../../../icons/tablet-unmute-icon.svg" + visible: micEnabled } PropertyChanges { From a08347936e131cf6cc52f3cd02a20e83c3300a97 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 11 Feb 2017 15:11:27 +1300 Subject: [PATCH 5/7] Make clicking the tablet mic icon or audio bar toggle the mute state --- .../resources/qml/hifi/tablet/Tablet.qml | 26 ++++++++++++++++--- .../resources/qml/hifi/tablet/TabletRoot.qml | 4 +++ interface/src/Application.cpp | 5 ++++ interface/src/Application.h | 2 ++ 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/interface/resources/qml/hifi/tablet/Tablet.qml b/interface/resources/qml/hifi/tablet/Tablet.qml index 9c9f17d067..3fb70f9cca 100644 --- a/interface/resources/qml/hifi/tablet/Tablet.qml +++ b/interface/resources/qml/hifi/tablet/Tablet.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick 2.5 import QtGraphicalEffects 1.0 import "../../styles-uit" @@ -104,6 +104,7 @@ Item { anchors.top: parent.top Item { + id: audioIcon anchors.verticalCenter: parent.verticalCenter width: 40 height: 40 @@ -116,7 +117,8 @@ Item { } Item { - visible: !tablet.micEnabled + visible: (!tablet.micEnabled && !toggleMuteMouseArea.containsMouse) + || (tablet.micEnabled && toggleMuteMouseArea.containsMouse) Image { id: muteIcon @@ -126,13 +128,13 @@ Item { ColorOverlay { anchors.fill: muteIcon source: muteIcon - color: "#ff0000" + color: toggleMuteMouseArea.containsMouse ? "#a0a0a0" : "#ff0000" } } } Item { - id: item1 + id: audioBar width: 170 height: 10 anchors.left: parent.left @@ -182,6 +184,22 @@ Item { } } + MouseArea { + id: toggleMuteMouseArea + anchors { + left: audioIcon.left + right: audioBar.right + top: audioIcon.top + bottom: audioIcon.bottom + } + + hoverEnabled: true + preventStealing: true + propagateComposedEvents: false + scrollGestureEnabled: false + onClicked: tabletRoot.toggleMicEnabled() + } + RalewaySemiBold { id: usernameText text: tablet.parent.parent.username diff --git a/interface/resources/qml/hifi/tablet/TabletRoot.qml b/interface/resources/qml/hifi/tablet/TabletRoot.qml index 0260bd6a01..40d88165b0 100644 --- a/interface/resources/qml/hifi/tablet/TabletRoot.qml +++ b/interface/resources/qml/hifi/tablet/TabletRoot.qml @@ -42,6 +42,10 @@ Item { } } + function toggleMicEnabled() { + ApplicationInterface.toggleMuteAudio(); + } + function setUsername(newUsername) { username = newUsername; } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 1441ae9001..16f464216c 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6854,3 +6854,8 @@ void Application::updateThreadPoolCount() const { qCDebug(interfaceapp) << "Setting thread pool size to " << threadPoolSize; QThreadPool::globalInstance()->setMaxThreadCount(threadPoolSize); } + +void Application::toggleMuteAudio() { + auto menu = Menu::getInstance(); + menu->setIsOptionChecked(MenuOption::MuteAudio, !menu->isOptionChecked(MenuOption::MuteAudio)); +} diff --git a/interface/src/Application.h b/interface/src/Application.h index 6072acac93..cab830ec88 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -386,6 +386,8 @@ public slots: void addAssetToWorldMessageClose(); + Q_INVOKABLE void toggleMuteAudio(); + private slots: void showDesktop(); void clearDomainOctreeDetails(); From 98c1a1832697696bb94a809f1c5be6068f0166a2 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 11 Feb 2017 21:02:23 +1300 Subject: [PATCH 6/7] Fix accumulating signal connections --- .../script-engine/src/TabletScriptingInterface.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/script-engine/src/TabletScriptingInterface.cpp b/libraries/script-engine/src/TabletScriptingInterface.cpp index 215c3a98e6..e40736b201 100644 --- a/libraries/script-engine/src/TabletScriptingInterface.cpp +++ b/libraries/script-engine/src/TabletScriptingInterface.cpp @@ -368,13 +368,13 @@ void TabletProxy::addButtonsToMenuScreen() { } QQuickItem* VrMenu = loader->findChild("tabletMenu"); - if (!VrMenu) { - return; + if (VrMenu) { + auto offscreenUi = DependencyManager::get(); + QObject* menu = offscreenUi->getRootMenu(); + QMetaObject::invokeMethod(VrMenu, "setRootMenu", Qt::AutoConnection, Q_ARG(QVariant, QVariant::fromValue(menu))); } - auto offscreenUi = DependencyManager::get(); - QObject* menu = offscreenUi->getRootMenu(); - QMetaObject::invokeMethod(VrMenu, "setRootMenu", Qt::AutoConnection, Q_ARG(QVariant, QVariant::fromValue(menu))); + QObject::disconnect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToMenuScreen())); } void TabletProxy::removeButtonsFromHomeScreen() { From 77f0fb14912b0546fbc6c6b2392ae47d7d809fe7 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 11 Feb 2017 22:40:19 +1300 Subject: [PATCH 7/7] Change the "Mute" tablet button to "Audio" --- .../resources/qml/hifi/tablet/TabletMenu.qml | 21 +++++++++++- .../resources/qml/hifi/tablet/TabletRoot.qml | 8 +++++ .../src/TabletScriptingInterface.cpp | 3 +- .../src/TabletScriptingInterface.h | 2 +- scripts/defaultScripts.js | 2 +- scripts/system/{mute.js => audio.js} | 32 ++++++++++++------- 6 files changed, 52 insertions(+), 16 deletions(-) rename scripts/system/{mute.js => audio.js} (56%) diff --git a/interface/resources/qml/hifi/tablet/TabletMenu.qml b/interface/resources/qml/hifi/tablet/TabletMenu.qml index cd3a9cacae..c154ac0f49 100644 --- a/interface/resources/qml/hifi/tablet/TabletMenu.qml +++ b/interface/resources/qml/hifi/tablet/TabletMenu.qml @@ -14,6 +14,7 @@ FocusScope { property var rootMenu: Menu { objectName:"rootMenu" } property var point: Qt.point(50, 50) + property string subMenu: "" TabletMouseHandler { id: menuPopperUpper } @@ -101,6 +102,24 @@ FocusScope { buildMenu() } function buildMenu() { - menuPopperUpper.popup(tabletMenu, rootMenu.items) + // Build submenu if specified. + if (subMenu !== "") { + var index = 0; + var found = false; + while (!found && index < rootMenu.items.length) { + found = rootMenu.items[index].title === subMenu; + if (!found) { + index += 1; + } + } + subMenu = ""; // Continue with full menu after initially displaying submenu. + if (found) { + menuPopperUpper.popup(tabletMenu, rootMenu.items[index].items); + return; + } + } + + // Otherwise build whole menu. + menuPopperUpper.popup(tabletMenu, rootMenu.items); } } diff --git a/interface/resources/qml/hifi/tablet/TabletRoot.qml b/interface/resources/qml/hifi/tablet/TabletRoot.qml index 40d88165b0..481c7846a9 100644 --- a/interface/resources/qml/hifi/tablet/TabletRoot.qml +++ b/interface/resources/qml/hifi/tablet/TabletRoot.qml @@ -6,9 +6,14 @@ Item { objectName: "tabletRoot" property string username: "Unknown user" property var eventBridge; + property string option: "" signal showDesktop(); + function setOption(value) { + option = value; + } + function loadSource(url) { loader.source = url; } @@ -72,6 +77,9 @@ Item { if (loader.item.hasOwnProperty("sendToScript")) { loader.item.sendToScript.connect(tabletRoot.sendToScript); } + if (loader.item.hasOwnProperty("subMenu")) { + loader.item.subMenu = option; + } loader.item.forceActiveFocus(); } } diff --git a/libraries/script-engine/src/TabletScriptingInterface.cpp b/libraries/script-engine/src/TabletScriptingInterface.cpp index e40736b201..7e8fdd6bc3 100644 --- a/libraries/script-engine/src/TabletScriptingInterface.cpp +++ b/libraries/script-engine/src/TabletScriptingInterface.cpp @@ -213,10 +213,11 @@ void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscr } } -void TabletProxy::gotoMenuScreen() { +void TabletProxy::gotoMenuScreen(const QString& submenu) { if (_qmlTabletRoot) { if (_state != State::Menu) { removeButtonsFromHomeScreen(); + QMetaObject::invokeMethod(_qmlTabletRoot, "setOption", Q_ARG(const QVariant&, QVariant(submenu))); auto loader = _qmlTabletRoot->findChild("loader"); QObject::connect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToMenuScreen()), Qt::DirectConnection); QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(VRMENU_SOURCE_URL))); diff --git a/libraries/script-engine/src/TabletScriptingInterface.h b/libraries/script-engine/src/TabletScriptingInterface.h index d5eccb2479..80ab365654 100644 --- a/libraries/script-engine/src/TabletScriptingInterface.h +++ b/libraries/script-engine/src/TabletScriptingInterface.h @@ -72,7 +72,7 @@ public: void setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscreenSurface); - Q_INVOKABLE void gotoMenuScreen(); + Q_INVOKABLE void gotoMenuScreen(const QString& submenu = ""); /**jsdoc * transition to the home screen diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index 36b0ddde85..40a77eda55 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -14,7 +14,7 @@ var DEFAULT_SCRIPTS = [ "system/progress.js", "system/away.js", - "system/mute.js", + "system/audio.js", "system/hmd.js", "system/menu.js", "system/bubble.js", diff --git a/scripts/system/mute.js b/scripts/system/audio.js similarity index 56% rename from scripts/system/mute.js rename to scripts/system/audio.js index f28a2eb9a5..dd49f944ea 100644 --- a/scripts/system/mute.js +++ b/scripts/system/audio.js @@ -1,8 +1,7 @@ "use strict"; // -// goto.js -// scripts/system/ +// audio.js // // Created by Howard Stearns on 2 Jun 2016 // Copyright 2016 High Fidelity, Inc. @@ -14,22 +13,33 @@ (function() { // BEGIN LOCAL_SCOPE var button; -var buttonName = "MUTE"; +var TOOLBAR_BUTTON_NAME = "MUTE"; +var TABLET_BUTTON_NAME = "AUDIO"; var toolBar = null; var tablet = null; +var isHUDUIEnabled = Settings.getValue("HUDUIEnabled"); +var HOME_BUTTON_TEXTURE = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-with-home-button.fbx/tablet-with-home-button.fbm/button-root.png"; function onMuteToggled() { - button.editProperties({isActive: AudioDevice.getMuted()}); + if (isHUDUIEnabled) { + button.editProperties({ isActive: AudioDevice.getMuted() }); + } } function onClicked(){ - var menuItem = "Mute Microphone"; - Menu.setIsOptionChecked(menuItem, !Menu.isOptionChecked(menuItem)); + if (isHUDUIEnabled) { + var menuItem = "Mute Microphone"; + Menu.setIsOptionChecked(menuItem, !Menu.isOptionChecked(menuItem)); + } else { + var entity = HMD.tabletID; + Entities.editEntity(entity, { textures: JSON.stringify({ "tex.close": HOME_BUTTON_TEXTURE }) }); + tablet.gotoMenuScreen("Audio"); + } } if (Settings.getValue("HUDUIEnabled")) { toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); button = toolBar.addButton({ - objectName: buttonName, + objectName: TOOLBAR_BUTTON_NAME, imageURL: Script.resolvePath("assets/images/tools/mic.svg"), visible: true, alpha: 0.9 @@ -37,10 +47,8 @@ if (Settings.getValue("HUDUIEnabled")) { } else { tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); button = tablet.addButton({ - icon: "icons/tablet-icons/mic-a.svg", - text: buttonName, - activeIcon: "icons/tablet-icons/mic-i.svg", - activeText: "UNMUTE", + icon: "icons/tablet-icons/mic-i.svg", + text: TABLET_BUTTON_NAME, sortOrder: 1 }); } @@ -56,7 +64,7 @@ Script.scriptEnding.connect(function () { tablet.removeButton(button); } if (toolBar) { - toolBar.removeButton(buttonName); + toolBar.removeButton(TOOLBAR_BUTTON_NAME); } });