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();