From d31ed9ac2257246fe97728b20a24cc1e06d87bc1 Mon Sep 17 00:00:00 2001 From: Wayne Chen Date: Thu, 2 May 2019 12:23:58 -0700 Subject: [PATCH] adding timer for muted warning --- .../qml/hifi/audio/MicBarApplication.qml | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/hifi/audio/MicBarApplication.qml b/interface/resources/qml/hifi/audio/MicBarApplication.qml index bc3f4dff89..838cc73cb8 100644 --- a/interface/resources/qml/hifi/audio/MicBarApplication.qml +++ b/interface/resources/qml/hifi/audio/MicBarApplication.qml @@ -24,6 +24,20 @@ Rectangle { property var pushingToTalk: AudioScriptingInterface.pushingToTalk; readonly property var userSpeakingLevel: 0.4; property bool gated: false; + + Timer { + // used to hold the muted warning. + id: mutedTimer + + interval: 2000; + running: false; + repeat: false; + property bool isRunning: false; + onTriggered: { + isRunning = false; + } + } + Component.onCompleted: { AudioScriptingInterface.noiseGateOpened.connect(function() { gated = false; }); AudioScriptingInterface.noiseGateClosed.connect(function() { gated = true; }); @@ -54,7 +68,17 @@ Rectangle { opacity: 0.7; onLevelChanged: { - var rectOpacity = (muted && (level >= userSpeakingLevel)) ? 1.0 : 0.7; + var mutedAndSpeaking = (muted && (level >= userSpeakingLevel)); + if (!mutedTimer.isRunning && !pushToTalk) { + if (mutedAndSpeaking) { + mutedTimer.start(); + mutedTimer.isRunning = true; + statusText.text = "MUTED"; + } else { + statusText.text = ""; + } + } + var rectOpacity = mutedAndSpeaking ? 1.0 : 0.7; if (pushToTalk && !pushingToTalk) { rectOpacity = (mouseArea.containsMouse) ? 1.0 : 0.7; } else if (mouseArea.containsMouse && rectOpacity != 1.0) { @@ -63,6 +87,10 @@ Rectangle { micBar.opacity = rectOpacity; } + onPushToTalkChanged: { + statusText.text = pushToTalk ? HMD.active ? "PTT" : "PTT-(T)" : ""; + } + color: "#00000000"; border { width: mouseArea.containsMouse || mouseArea.containsPress ? 2 : 0; @@ -190,7 +218,6 @@ Rectangle { color: pushToTalk ? (pushingToTalk ? colors.unmutedColor : colors.mutedColor) : (level >= userSpeakingLevel && muted) ? colors.mutedColor : colors.unmutedColor; font.bold: true - text: pushToTalk ? (HMD.active ? "PTT" : "PTT-(T)") : (muted ? "MUTED" : "MUTE"); size: 12; } }