wip for getting AvatarInputsBar to switch accordingly

This commit is contained in:
Wayne Chen 2019-03-22 15:34:06 -07:00
parent 0edbf12fa3
commit 390ce9bb26
9 changed files with 50 additions and 28 deletions

View file

@ -18,20 +18,31 @@ Item {
id: root; id: root;
objectName: "AvatarInputsBar" objectName: "AvatarInputsBar"
property int modality: Qt.NonModal property int modality: Qt.NonModal
readonly property bool ignoreRadiusEnabled: AvatarInputs.ignoreRadiusEnabled readonly property bool ignoreRadiusEnabled: AvatarInputs.ignoreRadiusEnabled;
width: audio.width; width: HMD.active ? audio.width : audioApplication.width;
height: audio.height; height: HMD.active ? audio.height : audioApplication.height;
x: 10; x: 10;
y: 5; y: 5;
readonly property bool shouldReposition: true; readonly property bool shouldReposition: true;
HifiAudio.MicBarApplication { HifiAudio.MicBar {
id: audio; id: audio;
visible: AvatarInputs.showAudioTools; visible: AvatarInputs.showAudioTools && HMD.active;
standalone: true;
dragTarget: parent;
}
HifiAudio.MicBarApplication {
id: audioApplication;
visible: AvatarInputs.showAudioTools && !HMD.active;
onVisibleChanged: {
console.log("visible changed: " + visible);
}
standalone: true; standalone: true;
dragTarget: parent; dragTarget: parent;
} }
BubbleIcon { BubbleIcon {
dragTarget: parent dragTarget: parent
visible: !HMD.active;
} }
} }

View file

@ -19,8 +19,16 @@ Rectangle {
width: bubbleIcon.width + 10 width: bubbleIcon.width + 10
height: bubbleIcon.height + 10 height: bubbleIcon.height + 10
radius: 5; radius: 5;
opacity: AvatarInputs.ignoreRadiusEnabled ? 0.7 : 0.3;
property var dragTarget: null; property var dragTarget: null;
property bool ignoreRadiusEnabled: AvatarInputs.ignoreRadiusEnabled;
onIgnoreRadiusEnabledChanged: {
if (ignoreRadiusEnabled) {
bubbleRect.opacity = 0.7;
} else {
bubbleRect.opacity = 0.3;
}
}
color: "#00000000"; color: "#00000000";
border { border {
@ -58,15 +66,17 @@ Rectangle {
} }
drag.target: dragTarget; drag.target: dragTarget;
onContainsMouseChanged: { onContainsMouseChanged: {
var rectOpacity = ignoreRadiusEnabled ? (containsMouse ? 0.9 : 0.7) : (containsMouse ? 0.5 : 0.3);
if (containsMouse) { if (containsMouse) {
Tablet.playSound(TabletEnums.ButtonHover); Tablet.playSound(TabletEnums.ButtonHover);
} }
bubbleRect.opacity = rectOpacity;
} }
} }
Image { Image {
id: bubbleIcon id: bubbleIcon
source: "../icons/tablet-icons/bubble-i.svg"; source: "../icons/tablet-icons/bubble-i.svg";
sourceSize: Qt.size(28, 28); sourceSize: Qt.size(32, 32);
smooth: true; smooth: true;
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: (parent.height - bubbleIcon.height) / 2 anchors.topMargin: (parent.height - bubbleIcon.height) / 2

View file

@ -16,6 +16,7 @@ import stylesUit 1.0
import TabletScriptingInterface 1.0 import TabletScriptingInterface 1.0
Rectangle { Rectangle {
id: micBar
HifiConstants { id: hifi; } HifiConstants { id: hifi; }
readonly property var level: AudioScriptingInterface.inputLevel; readonly property var level: AudioScriptingInterface.inputLevel;
@ -72,7 +73,7 @@ Rectangle {
hoverEnabled: true; hoverEnabled: true;
scrollGestureEnabled: false; scrollGestureEnabled: false;
onClicked: { onClicked: {
if (AudioScriptingInterface.pushToTalk) { if (pushToTalk) {
return; return;
} }
muted = !muted; muted = !muted;
@ -98,7 +99,7 @@ Rectangle {
readonly property string red: colors.muted; readonly property string red: colors.muted;
readonly property string fill: "#55000000"; readonly property string fill: "#55000000";
readonly property string border: standalone ? "#80FFFFFF" : "#55FFFFFF"; readonly property string border: standalone ? "#80FFFFFF" : "#55FFFFFF";
readonly property string icon: muted ? muted : unmuted; readonly property string icon: micBar.muted ? muted : unmuted;
} }
Item { Item {
@ -122,7 +123,7 @@ Rectangle {
readonly property string gatedIcon: "../../../icons/tablet-icons/mic-gate-i.svg"; readonly property string gatedIcon: "../../../icons/tablet-icons/mic-gate-i.svg";
id: image; id: image;
source: (pushToTalk && !pushingToTalk) ? pushToTalkIcon : muted ? mutedIcon : source: (pushToTalk && !pushingToTalk) ? pushToTalkIcon : muted ? mutedIcon :
clipping ? clippingIcon : gated ? gatedIcon : unmutedIcon; clipping ? clippingIcon : gated ? gatedIcon : unmutedIcon;
width: 30; width: 30;
@ -146,9 +147,9 @@ Rectangle {
Item { Item {
id: status; id: status;
readonly property string color: muted ? colors.muted : colors.unmuted; readonly property string color: colors.icon;
visible: (pushToTalk && !pushingToTalk) || (muted && (level >= userSpeakingLevel)); visible: (pushToTalk && !pushingToTalk) || muted;
anchors { anchors {
left: parent.left; left: parent.left;
@ -177,7 +178,7 @@ Rectangle {
verticalCenter: parent.verticalCenter; verticalCenter: parent.verticalCenter;
} }
width: AudioScriptingInterface.pushToTalk && !AudioScriptingInterface.pushingToTalk ? (HMD.active ? 27 : 25) : 50; width: pushToTalk && !pushingToTalk ? (HMD.active ? 27 : 25) : 50;
height: 4; height: 4;
color: parent.color; color: parent.color;
} }
@ -188,7 +189,7 @@ Rectangle {
verticalCenter: parent.verticalCenter; verticalCenter: parent.verticalCenter;
} }
width: AudioScriptingInterface.pushToTalk && !AudioScriptingInterface.pushingToTalk ? (HMD.active ? 27 : 25) : 50; width: pushToTalk && !pushingToTalk ? (HMD.active ? 27 : 25) : 50;
height: 4; height: 4;
color: parent.color; color: parent.color;
} }

View file

@ -126,7 +126,7 @@ Rectangle {
Item { Item {
Image { Image {
id: image; id: image;
source: (pushToTalk && !pushingToTalk) ? pushToTalkIcon : muted ? mutedIcon : source: (pushToTalk) ? pushToTalkIcon : muted ? mutedIcon :
clipping ? clippingIcon : gated ? gatedIcon : unmutedIcon; clipping ? clippingIcon : gated ? gatedIcon : unmutedIcon;
width: 29; width: 29;
height: 32; height: 32;
@ -141,8 +141,7 @@ Rectangle {
id: imageOverlay id: imageOverlay
anchors { fill: image } anchors { fill: image }
source: image; source: image;
color: (pushToTalk && !pushingToTalk) ? ((level >= userSpeakingLevel) ? colors.mutedColor : color: pushToTalk ? (pushingToTalk ? colors.unmutedColor : colors.mutedColor) : colors.icon;
colors.unmutedColor) : colors.icon;
} }
} }
} }
@ -150,12 +149,12 @@ Rectangle {
Item { Item {
id: status; id: status;
visible: (pushToTalk && !pushingToTalk) || (muted && (level >= userSpeakingLevel)); visible: pushToTalk || (muted && (level >= userSpeakingLevel));
anchors { anchors {
left: parent.left; left: parent.left;
top: icon.bottom; top: icon.bottom;
topMargin: 5; topMargin: 2;
} }
width: parent.width; width: parent.width;
@ -174,10 +173,10 @@ Rectangle {
verticalCenter: parent.verticalCenter; verticalCenter: parent.verticalCenter;
} }
color: (level >= userSpeakingLevel && muted) ? colors.mutedColor : colors.unmutedColor; color: pushToTalk ? (pushingToTalk ? colors.unmutedColor : colors.mutedColor) : (level >= userSpeakingLevel && muted) ? colors.mutedColor : colors.unmutedColor;
font.bold: true font.bold: true
text: (pushToTalk && !pushingToTalk) ? (HMD.active ? "PTT" : "PTT-(T)") : (muted ? "MUTED" : "MUTE"); text: pushToTalk ? (HMD.active ? "PTT" : "PTT-(T)") : (muted ? "MUTED" : "MUTE");
size: 12; size: 12;
} }
} }
@ -204,6 +203,7 @@ Rectangle {
Rectangle { // mask Rectangle { // mask
id: mask; id: mask;
visible: (!(pushToTalk && !pushingToTalk))
height: parent.height * level; height: parent.height * level;
width: parent.width; width: parent.width;
radius: 5; radius: 5;
@ -217,6 +217,7 @@ Rectangle {
LinearGradient { LinearGradient {
anchors { fill: mask } anchors { fill: mask }
visible: (!(pushToTalk && !pushingToTalk))
source: mask source: mask
start: Qt.point(0, 0); start: Qt.point(0, 0);
end: Qt.point(0, bar.height); end: Qt.point(0, bar.height);

View file

@ -40,7 +40,7 @@ Item {
} }
} }
HifiAudio.MicBar { HifiAudio.MicBarApplication {
anchors { anchors {
left: parent.left left: parent.left
leftMargin: 30 leftMargin: 30

View file

@ -339,7 +339,7 @@ Setting::Handle<int> maxOctreePacketsPerSecond{"maxOctreePPS", DEFAULT_MAX_OCTRE
Setting::Handle<bool> loginDialogPoppedUp{"loginDialogPoppedUp", false}; Setting::Handle<bool> loginDialogPoppedUp{"loginDialogPoppedUp", false};
static const QUrl AVATAR_INPUTS_BAR_QML = PathUtils::qmlUrl("AvatarInputsBar.qml"); static const QUrl AVATAR_INPUTS_BAR_QML = PathUtils::qmlUrl("AvatarInputsBar.qml");
static const QUrl MIC_BAR_ENTITY_QML = PathUtils::qmlUrl("hifi/audio/MicBarApplication.qml"); static const QUrl MIC_BAR_APPLICATION_QML = PathUtils::qmlUrl("hifi/audio/MicBarApplication.qml");
static const QUrl BUBBLE_ICON_QML = PathUtils::qmlUrl("BubbleIcon.qml"); static const QUrl BUBBLE_ICON_QML = PathUtils::qmlUrl("BubbleIcon.qml");
static const QString STANDARD_TO_ACTION_MAPPING_NAME = "Standard to Action"; static const QString STANDARD_TO_ACTION_MAPPING_NAME = "Standard to Action";
@ -2396,7 +2396,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
}); });
auto rootItemLoadedFunctor = [webSurface, url, isTablet] { auto rootItemLoadedFunctor = [webSurface, url, isTablet] {
Application::setupQmlSurface(webSurface->getSurfaceContext(), isTablet || url == LOGIN_DIALOG.toString() || url == AVATAR_INPUTS_BAR_QML.toString() || Application::setupQmlSurface(webSurface->getSurfaceContext(), isTablet || url == LOGIN_DIALOG.toString() || url == AVATAR_INPUTS_BAR_QML.toString() ||
url == BUBBLE_ICON_QML.toString() || url == MIC_BAR_ENTITY_QML.toString() ); url == BUBBLE_ICON_QML.toString());
}; };
if (webSurface->getRootItem()) { if (webSurface->getRootItem()) {
rootItemLoadedFunctor(); rootItemLoadedFunctor();

View file

@ -32,8 +32,7 @@ var DEFAULT_SCRIPTS_COMBINED = [
"system/firstPersonHMD.js", "system/firstPersonHMD.js",
"system/tablet-ui/tabletUI.js", "system/tablet-ui/tabletUI.js",
"system/emote.js", "system/emote.js",
"system/miniTablet.js", "system/miniTablet.js"
"system/createAvatarInputsBarEntity.js"
]; ];
var DEFAULT_SCRIPTS_SEPARATE = [ var DEFAULT_SCRIPTS_SEPARATE = [
"system/controllers/controllerScripts.js", "system/controllers/controllerScripts.js",

View file

@ -171,7 +171,7 @@ function goAway(fromStartup) {
if (!previousBubbleState) { if (!previousBubbleState) {
Users.toggleIgnoreRadius(); Users.toggleIgnoreRadius();
} }
UserActivityLogger.bubbleToggled(Users.getIgnoreRadiusEnabled()); UserActivityLogger.privacyShieldToggled(Users.getIgnoreRadiusEnabled());
UserActivityLogger.toggledAway(true); UserActivityLogger.toggledAway(true);
MyAvatar.isAway = true; MyAvatar.isAway = true;
} }
@ -186,7 +186,7 @@ function goActive() {
if (Users.getIgnoreRadiusEnabled() !== previousBubbleState) { if (Users.getIgnoreRadiusEnabled() !== previousBubbleState) {
Users.toggleIgnoreRadius(); Users.toggleIgnoreRadius();
UserActivityLogger.bubbleToggled(Users.getIgnoreRadiusEnabled()); UserActivityLogger.privacyShieldToggled(Users.getIgnoreRadiusEnabled());
} }
if (!Window.hasFocus()) { if (!Window.hasFocus()) {