Merge pull request #16132 from MiladNazeri/dev-486/emote-ui-toggle-fix

Dev-486 : emote indicator should still be showing
This commit is contained in:
Zach Fox 2019-09-04 13:11:24 -07:00 committed by GitHub
commit df3f7fcb72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 28 deletions

View file

@ -136,17 +136,17 @@ Flickable {
Layout.preferredHeight: 18 Layout.preferredHeight: 18
Layout.preferredWidth: parent.width Layout.preferredWidth: parent.width
labelTextOn: "Show Emote UI" labelTextOn: "Show Emote UI"
checked: Settings.getValue("simplifiedUI/emoteIndicatorVisible", true) checked: Settings.getValue("simplifiedUI/allowEmoteDrawerExpansion", true)
onClicked: { onClicked: {
var currentSetting = Settings.getValue("simplifiedUI/emoteIndicatorVisible", true); var currentSetting = Settings.getValue("simplifiedUI/allowEmoteDrawerExpansion", true);
Settings.setValue("simplifiedUI/emoteIndicatorVisible", !currentSetting); Settings.setValue("simplifiedUI/allowEmoteDrawerExpansion", !currentSetting);
} }
Connections { Connections {
target: Settings target: Settings
onValueChanged: { onValueChanged: {
if (setting === "simplifiedUI/emoteIndicatorVisible") { if (setting === "simplifiedUI/allowEmoteDrawerExpansion") {
emoteSwitch.checked = value; emoteSwitch.checked = value;
} }
} }

View file

@ -425,7 +425,7 @@ function onGeometryChanged(rect) {
function onWindowMinimizedChanged(isMinimized) { function onWindowMinimizedChanged(isMinimized) {
if (isMinimized) { if (isMinimized) {
handleEmoteIndicatorVisibleChanged(false); handleEmoteIndicatorVisibleChanged(false);
} else if (!HMD.active && Settings.getValue("simplifiedUI/emoteIndicatorVisible", true)) { } else if (!HMD.active) {
handleEmoteIndicatorVisibleChanged(true); handleEmoteIndicatorVisibleChanged(true);
} }
} }
@ -520,8 +520,8 @@ function showEmoteAppBar() {
} }
function handleEmoteIndicatorVisibleChanged(newValue) { function handleEmoteIndicatorVisibleChanged(shouldBeVisible) {
if (newValue && !emoteAppBarWindow) { if (shouldBeVisible && !emoteAppBarWindow) {
showEmoteAppBar(); showEmoteAppBar();
} else if (emoteAppBarWindow) { } else if (emoteAppBarWindow) {
emoteAppBarWindow.fromQml.disconnect(onMessageFromEmoteAppBar); emoteAppBarWindow.fromQml.disconnect(onMessageFromEmoteAppBar);
@ -531,13 +531,6 @@ function handleEmoteIndicatorVisibleChanged(newValue) {
} }
function onSettingsValueChanged(settingName, newValue) {
if (settingName === "simplifiedUI/emoteIndicatorVisible") {
handleEmoteIndicatorVisibleChanged(newValue);
}
}
function onDisplayModeChanged(isHMDMode) { function onDisplayModeChanged(isHMDMode) {
reactionsBegun.forEach(function(react) { reactionsBegun.forEach(function(react) {
endReactionWrapper(react); endReactionWrapper(react);
@ -545,7 +538,7 @@ function onDisplayModeChanged(isHMDMode) {
if (isHMDMode) { if (isHMDMode) {
handleEmoteIndicatorVisibleChanged(false); handleEmoteIndicatorVisibleChanged(false);
} else if (Settings.getValue("simplifiedUI/emoteIndicatorVisible", true)) { } else {
handleEmoteIndicatorVisibleChanged(true); handleEmoteIndicatorVisibleChanged(true);
} }
} }
@ -584,12 +577,11 @@ function init() {
Window.minimizedChanged.connect(onWindowMinimizedChanged); Window.minimizedChanged.connect(onWindowMinimizedChanged);
Window.geometryChanged.connect(onGeometryChanged); Window.geometryChanged.connect(onGeometryChanged);
Settings.valueChanged.connect(onSettingsValueChanged);
HMD.displayModeChanged.connect(onDisplayModeChanged); HMD.displayModeChanged.connect(onDisplayModeChanged);
emojiAPI.startup(); emojiAPI.startup();
getSounds(); getSounds();
handleEmoteIndicatorVisibleChanged(Settings.getValue("simplifiedUI/emoteIndicatorVisible", true)); handleEmoteIndicatorVisibleChanged(true);
Controller.keyPressEvent.connect(keyPressHandler); Controller.keyPressEvent.connect(keyPressHandler);
Controller.keyReleaseEvent.connect(keyReleaseHandler); Controller.keyReleaseEvent.connect(keyReleaseHandler);
@ -621,7 +613,6 @@ function shutdown() {
Window.minimizedChanged.disconnect(onWindowMinimizedChanged); Window.minimizedChanged.disconnect(onWindowMinimizedChanged);
Window.geometryChanged.disconnect(onGeometryChanged); Window.geometryChanged.disconnect(onGeometryChanged);
Settings.valueChanged.disconnect(onSettingsValueChanged);
HMD.displayModeChanged.disconnect(onDisplayModeChanged); HMD.displayModeChanged.disconnect(onDisplayModeChanged);
if (keyPressSignalsConnected) { if (keyPressSignalsConnected) {

View file

@ -21,20 +21,24 @@ Rectangle {
id: root id: root
color: simplifiedUI.colors.white color: simplifiedUI.colors.white
anchors.fill: parent anchors.fill: parent
property int originalWidth: 48 property int originalWidth: 48
property int expandedWidth: mainEmojiContainer.width + drawerContainer.width 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` // For the below to work, the Repeater's Item's second child must be the individual button's `MouseArea`
property int requestedWidth: (drawerContainer.keepDrawerExpanded || property int requestedWidth: (
emoteIndicatorMouseArea.containsMouse || root.allowEmoteDrawerExpansion && (
emoteButtonsRepeater.itemAt(0).hovered || drawerContainer.keepDrawerExpanded ||
emoteButtonsRepeater.itemAt(1).hovered || emoteIndicatorMouseArea.containsMouse ||
emoteButtonsRepeater.itemAt(2).hovered || emoteButtonsRepeater.itemAt(0).hovered ||
emoteButtonsRepeater.itemAt(3).hovered || emoteButtonsRepeater.itemAt(1).hovered ||
emoteButtonsRepeater.itemAt(4).hovered || emoteButtonsRepeater.itemAt(2).hovered ||
emoteButtonsRepeater.itemAt(5).hovered) ? expandedWidth : originalWidth; 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 int totalEmojiDurationMS: 7000 // Must match `TOTAL_EMOJI_DURATION_MS` in `simplifiedEmoji.js`
readonly property string emoteIconSource: "images/emote_Icon.svg" readonly property string emoteIconSource: "images/emote_Icon.svg"
property bool allowEmoteDrawerExpansion: Settings.getValue("simplifiedUI/allowEmoteDrawerExpansion", true)
onRequestedWidthChanged: { onRequestedWidthChanged: {
root.requestNewWidth(root.requestedWidth); root.requestNewWidth(root.requestedWidth);
@ -45,6 +49,16 @@ Rectangle {
SmoothedAnimation { duration: 220 } SmoothedAnimation { duration: 220 }
} }
Connections {
target: Settings
onValueChanged: {
if (setting === "simplifiedUI/allowEmoteDrawerExpansion") {
root.allowEmoteDrawerExpansion = value;
}
}
}
SimplifiedConstants.SimplifiedConstants { SimplifiedConstants.SimplifiedConstants {
id: simplifiedUI id: simplifiedUI
} }
@ -158,7 +172,7 @@ Rectangle {
anchors.fill: lockIcon anchors.fill: lockIcon
source: lockIcon source: lockIcon
color: "#ffffff" color: "#ffffff"
visible: drawerContainer.keepDrawerExpanded visible: root.allowEmoteDrawerExpansion && drawerContainer.keepDrawerExpanded
} }
MouseArea { MouseArea {