diff --git a/interface/resources/qml/hifi/tablet/Tablet.qml b/interface/resources/qml/hifi/tablet/Tablet.qml index 18f88b7718..25cbd02426 100644 --- a/interface/resources/qml/hifi/tablet/Tablet.qml +++ b/interface/resources/qml/hifi/tablet/Tablet.qml @@ -6,16 +6,10 @@ 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; @@ -121,8 +115,8 @@ Item { } Item { - visible: (!tablet.micEnabled && !toggleMuteMouseArea.containsMouse) - || (tablet.micEnabled && toggleMuteMouseArea.containsMouse) + visible: (Audio.muted && !toggleMuteMouseArea.containsMouse) + || (!Audio.muted && toggleMuteMouseArea.containsMouse) Image { id: muteIcon @@ -201,7 +195,7 @@ Item { preventStealing: true propagateComposedEvents: false scrollGestureEnabled: false - onClicked: tabletRoot.toggleMicEnabled() + onClicked: { Audio.muted = !Audio.muted } } RalewaySemiBold { @@ -271,7 +265,7 @@ Item { PropertyChanges { target: muteIcon - visible: micEnabled + visible: !Audio.muted } PropertyChanges { diff --git a/interface/resources/qml/hifi/tablet/TabletRoot.qml b/interface/resources/qml/hifi/tablet/TabletRoot.qml index fca445d5ba..0cd52a8d80 100644 --- a/interface/resources/qml/hifi/tablet/TabletRoot.qml +++ b/interface/resources/qml/hifi/tablet/TabletRoot.qml @@ -150,10 +150,6 @@ Item { } } - function toggleMicEnabled() { - Audio.mute = !Audio.mute; - } - function setUsername(newUsername) { username = newUsername; } diff --git a/interface/resources/qml/hifi/tablet/WindowRoot.qml b/interface/resources/qml/hifi/tablet/WindowRoot.qml index 2f4b56f9cb..849b857453 100644 --- a/interface/resources/qml/hifi/tablet/WindowRoot.qml +++ b/interface/resources/qml/hifi/tablet/WindowRoot.qml @@ -72,10 +72,6 @@ Windows.ScrollingWindow { } } - function toggleMicEnabled() { - Audio.mute = !Audio.mute; - } - function setUsername(newUsername) { username = newUsername; } diff --git a/libraries/script-engine/src/TabletScriptingInterface.cpp b/libraries/script-engine/src/TabletScriptingInterface.cpp index cd7e00d322..ab45ebfd77 100644 --- a/libraries/script-engine/src/TabletScriptingInterface.cpp +++ b/libraries/script-engine/src/TabletScriptingInterface.cpp @@ -606,15 +606,6 @@ 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 5329d6ed9c..2ae9e70846 100644 --- a/libraries/script-engine/src/TabletScriptingInterface.h +++ b/libraries/script-engine/src/TabletScriptingInterface.h @@ -152,13 +152,6 @@ 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 f83e8d9550..af093551e1 100644 --- a/scripts/system/tablet-ui/tabletUI.js +++ b/scripts/system/tablet-ui/tabletUI.js @@ -185,10 +185,7 @@ //TODO: move to tablet qml? if (tabletShown) { - var currentMicEnabled = !Menu.isOptionChecked(MUTE_MICROPHONE_MENU_ITEM); - var currentMicLevel = getMicLevel(); - gTablet.updateMicEnabled(currentMicEnabled); - gTablet.updateAudioBar(currentMicLevel); + gTablet.updateAudioBar(getMicLevel()); } if (validCheckTime - now > MSECS_PER_SEC/4) {