From 44e518f5a14c319e4aa2c57ca030bdaa2880088e Mon Sep 17 00:00:00 2001 From: milad Date: Tue, 3 Sep 2019 18:06:25 -0700 Subject: [PATCH 1/4] working fix --- .../settingsApp/general/General.qml | 9 ++-- .../simplifiedEmote/simplifiedEmote.js | 25 +++++------ .../ui/qml/SimplifiedEmoteIndicator.qml | 43 ++++++++++++++----- 3 files changed, 51 insertions(+), 26 deletions(-) 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 { From 669fef763a91177508835ce1347122fa157a9604 Mon Sep 17 00:00:00 2001 From: milad Date: Tue, 3 Sep 2019 18:11:56 -0700 Subject: [PATCH 2/4] removed logs --- .../hifi/simplifiedUI/settingsApp/general/General.qml | 1 - .../simplifiedUI/simplifiedEmote/simplifiedEmote.js | 10 ---------- .../ui/qml/SimplifiedEmoteIndicator.qml | 8 -------- 3 files changed, 19 deletions(-) diff --git a/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml b/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml index 2260bc312a..c74a01f31d 100644 --- a/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml +++ b/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml @@ -138,7 +138,6 @@ Flickable { labelTextOn: "Show Emote UI" checked: Settings.getValue("simplifiedUI/showEmoteUI", true) onClicked: { - console.log("CLICKED GENERAL SETTING") var currentSetting = Settings.getValue("simplifiedUI/showEmoteUI", true); Settings.setValue("simplifiedUI/showEmoteUI", !currentSetting); } diff --git a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js index 6697807b67..ab2cef7cb2 100644 --- a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js +++ b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js @@ -530,16 +530,6 @@ function handleEmoteIndicatorVisibleChanged(shouldBeVisible) { } } -function handleEmoteIndictaorTrayDisabledChanged(shouldBeDisabled) { - emoteAppBarWindow.sendToQml({ - "source": "simplifiedEmote.js", - "method": "updateTrayDisabled", - "data": { - "shouldBeDisabled": shouldBeDisabled - } - }); -} - function onDisplayModeChanged(isHMDMode) { reactionsBegun.forEach(function(react) { diff --git a/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml b/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml index b178b9eef5..b8b983c19c 100644 --- a/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml +++ b/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml @@ -21,13 +21,9 @@ 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` - // Here property int requestedWidth: ( root.showEmoteUI && ( drawerContainer.keepDrawerExpanded || @@ -46,8 +42,6 @@ Rectangle { onRequestedWidthChanged: { - console.log("root.tryDisabled on requested widthChanged", root.showEmoteUI); - console.log(root.requestedWidth); root.requestNewWidth(root.requestedWidth); } @@ -60,9 +54,7 @@ Rectangle { target: Settings onValueChanged: { - console.log("in on value changed", setting, value) if (setting === "simplifiedUI/showEmoteUI") { - console.log("on root tray disabled"); root.showEmoteUI = value; } } From 6c9c22a5fbe9d48360cd526385e3ce568e59fa83 Mon Sep 17 00:00:00 2001 From: milad Date: Tue, 3 Sep 2019 18:14:15 -0700 Subject: [PATCH 3/4] removed old code --- .../simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml b/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml index b8b983c19c..8032edce84 100644 --- a/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml +++ b/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml @@ -37,7 +37,6 @@ Rectangle { ) ? 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) From 5fdcf0ecaf8152441015014dc70de2ff92987973 Mon Sep 17 00:00:00 2001 From: milad Date: Wed, 4 Sep 2019 12:59:17 -0700 Subject: [PATCH 4/4] updated setting name and changed default value to true for show tray --- .../hifi/simplifiedUI/settingsApp/general/General.qml | 8 ++++---- .../ui/qml/SimplifiedEmoteIndicator.qml | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml b/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml index c74a01f31d..24fff2dae4 100644 --- a/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml +++ b/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml @@ -136,17 +136,17 @@ Flickable { Layout.preferredHeight: 18 Layout.preferredWidth: parent.width labelTextOn: "Show Emote UI" - checked: Settings.getValue("simplifiedUI/showEmoteUI", true) + checked: Settings.getValue("simplifiedUI/allowEmoteDrawerExpansion", true) onClicked: { - var currentSetting = Settings.getValue("simplifiedUI/showEmoteUI", true); - Settings.setValue("simplifiedUI/showEmoteUI", !currentSetting); + var currentSetting = Settings.getValue("simplifiedUI/allowEmoteDrawerExpansion", true); + Settings.setValue("simplifiedUI/allowEmoteDrawerExpansion", !currentSetting); } Connections { target: Settings onValueChanged: { - if (setting === "simplifiedUI/showEmoteUI") { + if (setting === "simplifiedUI/allowEmoteDrawerExpansion") { emoteSwitch.checked = value; } } diff --git a/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml b/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml index 8032edce84..787ccadd62 100644 --- a/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml +++ b/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml @@ -25,7 +25,7 @@ Rectangle { 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: ( - root.showEmoteUI && ( + root.allowEmoteDrawerExpansion && ( drawerContainer.keepDrawerExpanded || emoteIndicatorMouseArea.containsMouse || emoteButtonsRepeater.itemAt(0).hovered || @@ -37,7 +37,7 @@ Rectangle { ) ? 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 showEmoteUI: Settings.getValue("simplifiedUI/showEmoteUI", false) + property bool allowEmoteDrawerExpansion: Settings.getValue("simplifiedUI/allowEmoteDrawerExpansion", true) onRequestedWidthChanged: { @@ -53,8 +53,8 @@ Rectangle { target: Settings onValueChanged: { - if (setting === "simplifiedUI/showEmoteUI") { - root.showEmoteUI = value; + if (setting === "simplifiedUI/allowEmoteDrawerExpansion") { + root.allowEmoteDrawerExpansion = value; } } } @@ -172,7 +172,7 @@ Rectangle { anchors.fill: lockIcon source: lockIcon color: "#ffffff" - visible: root.showEmoteUI && drawerContainer.keepDrawerExpanded + visible: root.allowEmoteDrawerExpansion && drawerContainer.keepDrawerExpanded } MouseArea {