From 248f9ba375e07faac10a09dfd9cdbdd675a2b393 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Fri, 29 Mar 2019 10:32:13 -0700 Subject: [PATCH] adding mute overlay back into HMD and have warn when muted disable in desktop --- .../qml/hifi/audio/MicBarApplication.qml | 7 ++++--- scripts/defaultScripts.js | 3 ++- scripts/system/audioMuteOverlay.js | 16 +--------------- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/interface/resources/qml/hifi/audio/MicBarApplication.qml b/interface/resources/qml/hifi/audio/MicBarApplication.qml index c19cc54f4a..4e0adfd95c 100644 --- a/interface/resources/qml/hifi/audio/MicBarApplication.qml +++ b/interface/resources/qml/hifi/audio/MicBarApplication.qml @@ -18,6 +18,7 @@ import TabletScriptingInterface 1.0 Rectangle { id: micBar; readonly property var level: AudioScriptingInterface.inputLevel; + readonly property var warnWhenMuted: AudioScriptingInterface.warnWhenMuted; readonly property var clipping: AudioScriptingInterface.clipping; property var muted: AudioScriptingInterface.muted; property var pushToTalk: AudioScriptingInterface.pushToTalk; @@ -54,7 +55,7 @@ Rectangle { opacity: 0.7; onLevelChanged: { - var rectOpacity = muted && (level >= userSpeakingLevel) ? 1.0 : 0.7; + var rectOpacity = (muted && (level >= userSpeakingLevel)) && warnWhenMuted ? 1.0 : 0.7; if (pushToTalk && !pushingToTalk) { rectOpacity = (level >= userSpeakingLevel) ? 1.0 : 0.7; } else if (mouseArea.containsMouse && rectOpacity != 1.0) { @@ -163,7 +164,7 @@ Rectangle { Item { id: status; - visible: pushToTalk || (muted && (level >= userSpeakingLevel)); + visible: pushToTalk || (muted && (level >= userSpeakingLevel) && warnWhenMuted); anchors { left: parent.left; @@ -187,7 +188,7 @@ Rectangle { verticalCenter: parent.verticalCenter; } - color: pushToTalk ? (pushingToTalk ? colors.unmutedColor : colors.mutedColor) : (level >= userSpeakingLevel && muted) ? colors.mutedColor : colors.unmutedColor; + color: pushToTalk ? (pushingToTalk ? colors.unmutedColor : colors.mutedColor) : (level >= userSpeakingLevel && muted && warnWhenMuted) ? colors.mutedColor : colors.unmutedColor; font.bold: true text: pushToTalk ? (HMD.active ? "PTT" : "PTT-(T)") : (muted ? "MUTED" : "MUTE"); diff --git a/scripts/defaultScripts.js b/scripts/defaultScripts.js index bd7e79dffc..e392680df9 100644 --- a/scripts/defaultScripts.js +++ b/scripts/defaultScripts.js @@ -32,7 +32,8 @@ var DEFAULT_SCRIPTS_COMBINED = [ "system/firstPersonHMD.js", "system/tablet-ui/tabletUI.js", "system/emote.js", - "system/miniTablet.js" + "system/miniTablet.js", + "system/audioMuteOverlay.js" ]; var DEFAULT_SCRIPTS_SEPARATE = [ "system/controllers/controllerScripts.js", diff --git a/scripts/system/audioMuteOverlay.js b/scripts/system/audioMuteOverlay.js index e715e97575..feea604a92 100644 --- a/scripts/system/audioMuteOverlay.js +++ b/scripts/system/audioMuteOverlay.js @@ -58,20 +58,6 @@ parentID: MyAvatar.SELF_ID, parentJointIndex: MyAvatar.getJointIndex("_CAMERA_MATRIX") }); - } else { - var textDimensions = { x: 100, y: 50 }; - warningOverlayID = Overlays.addOverlay("text", { - name: "Muted-Warning", - font: { size: 36 }, - text: warningText, - x: (Window.innerWidth - textDimensions.x) / 2, - y: (Window.innerHeight - textDimensions.y), - width: textDimensions.x, - height: textDimensions.y, - textColor: { red: 226, green: 51, blue: 77 }, - backgroundAlpha: 0, - visible: true - }); } } @@ -141,4 +127,4 @@ Audio.mutedChanged.connect(startOrStopPoll); Audio.warnWhenMutedChanged.connect(startOrStopPoll); -}()); // END LOCAL_SCOPE \ No newline at end of file +}()); // END LOCAL_SCOPE