From c54e8f55693be7175839700c6e00d04b368bbc77 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Mon, 25 Mar 2019 17:32:03 -0700 Subject: [PATCH] showing ptt text always + hmd mode switch fix --- interface/resources/qml/BubbleIcon.qml | 10 +++++++++- interface/resources/qml/hifi/audio/Audio.qml | 5 ++--- interface/resources/qml/hifi/audio/MicBar.qml | 15 +++++++++------ .../qml/hifi/audio/MicBarApplication.qml | 13 +++++++++---- scripts/system/audio.js | 2 ++ 5 files changed, 31 insertions(+), 14 deletions(-) diff --git a/interface/resources/qml/BubbleIcon.qml b/interface/resources/qml/BubbleIcon.qml index 1ad73f6179..430eb19860 100644 --- a/interface/resources/qml/BubbleIcon.qml +++ b/interface/resources/qml/BubbleIcon.qml @@ -22,7 +22,7 @@ Rectangle { property var dragTarget: null; property bool ignoreRadiusEnabled: AvatarInputs.ignoreRadiusEnabled; - onIgnoreRadiusEnabledChanged: { + function updateOpacity() { if (ignoreRadiusEnabled) { bubbleRect.opacity = 0.7; } else { @@ -30,6 +30,14 @@ Rectangle { } } + Component.onCompleted: { + updateOpacity(); + } + + onIgnoreRadiusEnabledChanged: { + updateOpacity(); + } + color: "#00000000"; border { width: mouseArea.containsMouse || mouseArea.containsPress ? 2 : 0; diff --git a/interface/resources/qml/hifi/audio/Audio.qml b/interface/resources/qml/hifi/audio/Audio.qml index 3266f3ef46..015a9542e9 100644 --- a/interface/resources/qml/hifi/audio/Audio.qml +++ b/interface/resources/qml/hifi/audio/Audio.qml @@ -177,14 +177,14 @@ Rectangle { onClicked: { if (pushToTalk && !checked) { // disable push to talk if unmuting - if ((bar.currentIndex === 0)) { + if (bar.currentIndex === 0) { AudioScriptingInterface.pushToTalkDesktop = false; } else { AudioScriptingInterface.pushToTalkHMD = false; } } - if ((bar.currentIndex === 0)) { + if (bar.currentIndex === 0) { AudioScriptingInterface.mutedDesktop = checked; } else { @@ -293,7 +293,6 @@ Rectangle { Item { id: pttTextContainer - visible: pushToTalk; anchors.top: switchesContainer.bottom; anchors.topMargin: 10; anchors.left: parent.left; diff --git a/interface/resources/qml/hifi/audio/MicBar.qml b/interface/resources/qml/hifi/audio/MicBar.qml index 4b243e033a..b6254b168c 100644 --- a/interface/resources/qml/hifi/audio/MicBar.qml +++ b/interface/resources/qml/hifi/audio/MicBar.qml @@ -22,14 +22,18 @@ Rectangle { property var muted: AudioScriptingInterface.muted; readonly property var level: AudioScriptingInterface.inputLevel; readonly property var clipping: AudioScriptingInterface.clipping; - readonly property var pushToTalk: AudioScriptingInterface.pushToTalk; - readonly property var pushingToTalk: AudioScriptingInterface.pushingToTalk; + property var pushToTalk: AudioScriptingInterface.pushToTalk; + property var pushingToTalk: AudioScriptingInterface.pushingToTalk; readonly property var userSpeakingLevel: 0.4; property bool gated: false; Component.onCompleted: { AudioScriptingInterface.noiseGateOpened.connect(function() { gated = false; }); AudioScriptingInterface.noiseGateClosed.connect(function() { gated = true; }); + HMD.displayModeChanged.connect(function() { + muted = AudioScriptingInterface.muted; + pushToTalk = AudioScriptingInterface.pushToTalk; + }); } property bool standalone: false; @@ -147,7 +151,6 @@ Rectangle { Item { id: status; - readonly property string color: colors.icon; visible: (pushToTalk && !pushingToTalk) || muted; @@ -166,7 +169,7 @@ Rectangle { verticalCenter: parent.verticalCenter; } - color: parent.color; + color: colors.icon; text: (pushToTalk && !pushingToTalk) ? (HMD.active ? "MUTED PTT" : "MUTED PTT-(T)") : (muted ? "MUTED" : "MUTE"); font.pointSize: 12; @@ -180,7 +183,7 @@ Rectangle { width: pushToTalk && !pushingToTalk ? (HMD.active ? 27 : 25) : 50; height: 4; - color: parent.color; + color: colors.icon; } Rectangle { @@ -191,7 +194,7 @@ Rectangle { width: pushToTalk && !pushingToTalk ? (HMD.active ? 27 : 25) : 50; height: 4; - color: parent.color; + color: colors.icon; } } diff --git a/interface/resources/qml/hifi/audio/MicBarApplication.qml b/interface/resources/qml/hifi/audio/MicBarApplication.qml index f89ada6e49..509517063d 100644 --- a/interface/resources/qml/hifi/audio/MicBarApplication.qml +++ b/interface/resources/qml/hifi/audio/MicBarApplication.qml @@ -19,14 +19,18 @@ Rectangle { id: micBar; readonly property var level: AudioScriptingInterface.inputLevel; readonly property var clipping: AudioScriptingInterface.clipping; - readonly property var muted: AudioScriptingInterface.muted; - readonly property var pushToTalk: AudioScriptingInterface.pushToTalk; - readonly property var pushingToTalk: AudioScriptingInterface.pushingToTalk; + property var muted: AudioScriptingInterface.muted; + property var pushToTalk: AudioScriptingInterface.pushToTalk; + property var pushingToTalk: AudioScriptingInterface.pushingToTalk; readonly property var userSpeakingLevel: 0.4; property bool gated: false; Component.onCompleted: { AudioScriptingInterface.noiseGateOpened.connect(function() { gated = false; }); AudioScriptingInterface.noiseGateClosed.connect(function() { gated = true; }); + HMD.displayModeChanged.connect(function() { + muted = AudioScriptingInterface.muted; + pushToTalk = AudioScriptingInterface.pushToTalk; + }); } readonly property string unmutedIcon: "../../../icons/tablet-icons/mic-unmute-i.svg"; @@ -86,8 +90,9 @@ Rectangle { hoverEnabled: true; scrollGestureEnabled: false; onClicked: { - AudioScriptingInterface.muted = !AudioScriptingInterface.muted; + AudioScriptingInterface.muted = !muted; Tablet.playSound(TabletEnums.ButtonClick); + muted = Qt.binding(function() { return AudioScriptingInterface.muted; }); // restore binding } drag.target: dragTarget; onContainsMouseChanged: { diff --git a/scripts/system/audio.js b/scripts/system/audio.js index 19ed3faef2..a161b40ffd 100644 --- a/scripts/system/audio.js +++ b/scripts/system/audio.js @@ -75,6 +75,7 @@ button.clicked.connect(onClicked); tablet.screenChanged.connect(onScreenChanged); Audio.mutedChanged.connect(onMuteToggled); Audio.pushToTalkChanged.connect(onMuteToggled); +HMD.displayModeChanged.connect(onMuteToggled); Script.scriptEnding.connect(function () { if (onAudioScreen) { @@ -84,6 +85,7 @@ Script.scriptEnding.connect(function () { tablet.screenChanged.disconnect(onScreenChanged); Audio.mutedChanged.disconnect(onMuteToggled); Audio.pushToTalkChanged.disconnect(onMuteToggled); + HMD.displayModeChanged.disconnect(onMuteToggled); tablet.removeButton(button); });