diff --git a/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml b/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml index 9e58a0aa98..2260bc312a 100644 --- a/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml +++ b/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml @@ -136,17 +136,18 @@ Flickable { Layout.preferredHeight: 18 Layout.preferredWidth: parent.width labelTextOn: "Show Emote UI" - checked: Settings.getValue("simplifiedUI/emoteIndicatorVisible", true) + checked: Settings.getValue("simplifiedUI/showEmoteUI", true) onClicked: { - var currentSetting = Settings.getValue("simplifiedUI/emoteIndicatorVisible", true); - Settings.setValue("simplifiedUI/emoteIndicatorVisible", !currentSetting); + console.log("CLICKED GENERAL SETTING") + var currentSetting = Settings.getValue("simplifiedUI/showEmoteUI", true); + Settings.setValue("simplifiedUI/showEmoteUI", !currentSetting); } Connections { target: Settings onValueChanged: { - if (setting === "simplifiedUI/emoteIndicatorVisible") { + if (setting === "simplifiedUI/showEmoteUI") { emoteSwitch.checked = value; } } diff --git a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js index cd6c80dd64..6697807b67 100644 --- a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js +++ b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js @@ -425,7 +425,7 @@ function onGeometryChanged(rect) { function onWindowMinimizedChanged(isMinimized) { if (isMinimized) { handleEmoteIndicatorVisibleChanged(false); - } else if (!HMD.active && Settings.getValue("simplifiedUI/emoteIndicatorVisible", true)) { + } else if (!HMD.active) { handleEmoteIndicatorVisibleChanged(true); } } @@ -520,8 +520,8 @@ function showEmoteAppBar() { } -function handleEmoteIndicatorVisibleChanged(newValue) { - if (newValue && !emoteAppBarWindow) { +function handleEmoteIndicatorVisibleChanged(shouldBeVisible) { + if (shouldBeVisible && !emoteAppBarWindow) { showEmoteAppBar(); } else if (emoteAppBarWindow) { emoteAppBarWindow.fromQml.disconnect(onMessageFromEmoteAppBar); @@ -530,11 +530,14 @@ function handleEmoteIndicatorVisibleChanged(newValue) { } } - -function onSettingsValueChanged(settingName, newValue) { - if (settingName === "simplifiedUI/emoteIndicatorVisible") { - handleEmoteIndicatorVisibleChanged(newValue); - } +function handleEmoteIndictaorTrayDisabledChanged(shouldBeDisabled) { + emoteAppBarWindow.sendToQml({ + "source": "simplifiedEmote.js", + "method": "updateTrayDisabled", + "data": { + "shouldBeDisabled": shouldBeDisabled + } + }); } @@ -545,7 +548,7 @@ function onDisplayModeChanged(isHMDMode) { if (isHMDMode) { handleEmoteIndicatorVisibleChanged(false); - } else if (Settings.getValue("simplifiedUI/emoteIndicatorVisible", true)) { + } else { handleEmoteIndicatorVisibleChanged(true); } } @@ -584,12 +587,11 @@ function init() { Window.minimizedChanged.connect(onWindowMinimizedChanged); Window.geometryChanged.connect(onGeometryChanged); - Settings.valueChanged.connect(onSettingsValueChanged); HMD.displayModeChanged.connect(onDisplayModeChanged); emojiAPI.startup(); getSounds(); - handleEmoteIndicatorVisibleChanged(Settings.getValue("simplifiedUI/emoteIndicatorVisible", true)); + handleEmoteIndicatorVisibleChanged(true); Controller.keyPressEvent.connect(keyPressHandler); Controller.keyReleaseEvent.connect(keyReleaseHandler); @@ -621,7 +623,6 @@ function shutdown() { Window.minimizedChanged.disconnect(onWindowMinimizedChanged); Window.geometryChanged.disconnect(onGeometryChanged); - Settings.valueChanged.disconnect(onSettingsValueChanged); HMD.displayModeChanged.disconnect(onDisplayModeChanged); if (keyPressSignalsConnected) { diff --git a/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml b/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml index a401feec12..b178b9eef5 100644 --- a/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml +++ b/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml @@ -21,22 +21,33 @@ Rectangle { id: root color: simplifiedUI.colors.white anchors.fill: parent - + Component.onCompleted: { + console.log("\n\n\n\n\n\n\n COMPLETED @@2 \n\n\n\n\n\n\n\n"); + } property int originalWidth: 48 property int expandedWidth: mainEmojiContainer.width + drawerContainer.width // For the below to work, the Repeater's Item's second child must be the individual button's `MouseArea` - property int requestedWidth: (drawerContainer.keepDrawerExpanded || - emoteIndicatorMouseArea.containsMouse || - emoteButtonsRepeater.itemAt(0).hovered || - emoteButtonsRepeater.itemAt(1).hovered || - emoteButtonsRepeater.itemAt(2).hovered || - emoteButtonsRepeater.itemAt(3).hovered || - emoteButtonsRepeater.itemAt(4).hovered || - emoteButtonsRepeater.itemAt(5).hovered) ? expandedWidth : originalWidth; + // Here + property int requestedWidth: ( + root.showEmoteUI && ( + drawerContainer.keepDrawerExpanded || + emoteIndicatorMouseArea.containsMouse || + emoteButtonsRepeater.itemAt(0).hovered || + emoteButtonsRepeater.itemAt(1).hovered || + emoteButtonsRepeater.itemAt(2).hovered || + emoteButtonsRepeater.itemAt(3).hovered || + emoteButtonsRepeater.itemAt(4).hovered || + emoteButtonsRepeater.itemAt(5).hovered) + ) ? expandedWidth : originalWidth; readonly property int totalEmojiDurationMS: 7000 // Must match `TOTAL_EMOJI_DURATION_MS` in `simplifiedEmoji.js` readonly property string emoteIconSource: "images/emote_Icon.svg" + // property bool trayDisabled: Settings.getValue("simplifiedUI/showEmoteUI", false) + property bool showEmoteUI: Settings.getValue("simplifiedUI/showEmoteUI", false) + onRequestedWidthChanged: { + console.log("root.tryDisabled on requested widthChanged", root.showEmoteUI); + console.log(root.requestedWidth); root.requestNewWidth(root.requestedWidth); } @@ -45,6 +56,18 @@ Rectangle { SmoothedAnimation { duration: 220 } } + Connections { + target: Settings + + onValueChanged: { + console.log("in on value changed", setting, value) + if (setting === "simplifiedUI/showEmoteUI") { + console.log("on root tray disabled"); + root.showEmoteUI = value; + } + } + } + SimplifiedConstants.SimplifiedConstants { id: simplifiedUI } @@ -158,7 +181,7 @@ Rectangle { anchors.fill: lockIcon source: lockIcon color: "#ffffff" - visible: drawerContainer.keepDrawerExpanded + visible: root.showEmoteUI && drawerContainer.keepDrawerExpanded } MouseArea {