From 4cee6b720a10a8ccfe26994140d91f5579fa0d74 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 7 Aug 2018 11:49:32 -0700 Subject: [PATCH 1/7] Implement auto-scrolling on Places cards (TODO for Connections) --- interface/resources/qml/hifi/Feed.qml | 49 +++++++++++++++++-- .../qml/hifi/tablet/TabletAddressDialog.qml | 2 + 2 files changed, 48 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/hifi/Feed.qml b/interface/resources/qml/hifi/Feed.qml index 785b586dd2..4ff26b8057 100644 --- a/interface/resources/qml/hifi/Feed.qml +++ b/interface/resources/qml/hifi/Feed.qml @@ -41,6 +41,8 @@ Column { property var goFunction: null; property var http: null; + property bool autoScrollTimerEnabled; + HifiConstants { id: hifi } Component.onCompleted: suggestions.getFirstPage(); HifiModels.PSFListModel { @@ -102,9 +104,12 @@ Column { id: scroll; model: suggestions; orientation: ListView.Horizontal; - highlightFollowsCurrentItem: false - highlightMoveDuration: -1; - highlightMoveVelocity: -1; + highlightFollowsCurrentItem: true; + preferredHighlightBegin: 0; + preferredHighlightEnd: cardWidth; + highlightRangeMode: ListView.StrictlyEnforceRange; + highlightMoveDuration: 800; + highlightMoveVelocity: 1; currentIndex: -1; spacing: 12; @@ -137,5 +142,43 @@ Column { hoverThunk: function () { hovered = true } unhoverThunk: function () { hovered = false } } + + onCountChanged: { + if (scroll.currentIndex === -1 && scroll.count > 0 && root.autoScrollTimerEnabled) { + scroll.currentIndex = 0; + autoScrollTimer.start(); + } + } + + MouseArea { + id: feedMouseArea; + enabled: root.autoScrollTimerEnabled; + anchors.fill: parent; + hoverEnabled: true; + onEntered: { + if (autoScrollTimer.running) { + autoScrollTimer.stop(); + } + } + onExited: { + autoScrollTimer.restart(); + } + } + } + + Timer { + id: autoScrollTimer; + interval: 3000; + running: false; + repeat: true; + onTriggered: { + if (scroll.currentIndex !== -1) { + if (scroll.currentIndex === scroll.count - 1) { + scroll.currentIndex = 0; + } else { + scroll.currentIndex++; + } + } + } } } diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index 9a472de046..4a3f7ea905 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -325,6 +325,7 @@ StackView { filter: addressLine.text; goFunction: goCard; http: http; + autoScrollTimerEnabled: true; } Feed { id: places; @@ -337,6 +338,7 @@ StackView { filter: addressLine.text; goFunction: goCard; http: http; + autoScrollTimerEnabled: true; } Feed { id: snapshots; From af9dc8acca516c832808dce51b0175df8580548f Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 7 Aug 2018 11:51:38 -0700 Subject: [PATCH 2/7] Turn on only for Annoucements --- interface/resources/qml/hifi/Feed.qml | 2 +- interface/resources/qml/hifi/tablet/TabletAddressDialog.qml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/interface/resources/qml/hifi/Feed.qml b/interface/resources/qml/hifi/Feed.qml index 4ff26b8057..c81e3c2389 100644 --- a/interface/resources/qml/hifi/Feed.qml +++ b/interface/resources/qml/hifi/Feed.qml @@ -41,7 +41,7 @@ Column { property var goFunction: null; property var http: null; - property bool autoScrollTimerEnabled; + property bool autoScrollTimerEnabled: false; HifiConstants { id: hifi } Component.onCompleted: suggestions.getFirstPage(); diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index 4a3f7ea905..5dce74f2dd 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -338,7 +338,6 @@ StackView { filter: addressLine.text; goFunction: goCard; http: http; - autoScrollTimerEnabled: true; } Feed { id: snapshots; From c0e2b3a24026d7642a66fbf0dfcbadce52877abf Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 9 Aug 2018 11:49:29 -0700 Subject: [PATCH 3/7] Happening Now -> Featured --- interface/resources/qml/hifi/Pal.qml | 1 + interface/resources/qml/hifi/tablet/TabletAddressDialog.qml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/Pal.qml b/interface/resources/qml/hifi/Pal.qml index 915213508c..dc5aa9dade 100644 --- a/interface/resources/qml/hifi/Pal.qml +++ b/interface/resources/qml/hifi/Pal.qml @@ -1046,6 +1046,7 @@ Rectangle { enabled: myData.userName !== "Unknown user" && !userInfoViewer.visible; hoverEnabled: true; onClicked: { + // TODO: Change language from "Happening Now" to something else (or remove entirely) popupComboDialog("Set your availability:", availabilityComboBox.availabilityStrings, ["Your username will be visible in everyone's 'Nearby' list. Anyone will be able to jump to your location from within the 'Nearby' list.", diff --git a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml index 5dce74f2dd..c9d05aea51 100644 --- a/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml +++ b/interface/resources/qml/hifi/tablet/TabletAddressDialog.qml @@ -320,7 +320,7 @@ StackView { width: parent.width; cardWidth: 312 + (2 * 4); cardHeight: 163 + (2 * 4); - labelText: 'HAPPENING NOW'; + labelText: 'FEATURED'; actions: 'announcement'; filter: addressLine.text; goFunction: goCard; From 1699d3ed6a23c196b64e2eac1a2cc4d553ae81d3 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 10 Aug 2018 09:35:40 -0700 Subject: [PATCH 4/7] Wording change in Availability --- interface/resources/qml/hifi/Pal.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/hifi/Pal.qml b/interface/resources/qml/hifi/Pal.qml index dc5aa9dade..cbab83ea28 100644 --- a/interface/resources/qml/hifi/Pal.qml +++ b/interface/resources/qml/hifi/Pal.qml @@ -1050,9 +1050,9 @@ Rectangle { popupComboDialog("Set your availability:", availabilityComboBox.availabilityStrings, ["Your username will be visible in everyone's 'Nearby' list. Anyone will be able to jump to your location from within the 'Nearby' list.", - "Your location will be visible in the 'Connections' list only for those with whom you are connected or friends. They'll be able to jump to your location if the domain allows.", - "Your location will be visible in the 'Connections' list only for those with whom you are friends. They'll be able to jump to your location if the domain allows. You will only receive 'Happening Now' notifications in 'Go To' from friends.", - "You will appear offline in the 'Connections' list, and you will not receive 'Happening Now' notifications in 'Go To'."], + "Your location will be visible in the 'Connections' list only for those with whom you are connected or friends. They'll be able to jump to your location if the domain allows, and you will see 'Snaps' Blasts from them in 'Go To'.", + "Your location will be visible in the 'Connections' list only for those with whom you are friends. They'll be able to jump to your location if the domain allows, and you will see 'Snaps' Blasts from them in 'Go To'", + "You will appear offline in the 'Connections' list, and you will not receive Snaps Blasts from connections or friends in 'Go To'."], ["all", "connections", "friends", "none"]); } onEntered: availabilityComboBox.color = hifi.colors.lightGrayText; From e39dd250cd1e5ddcd308482ce19c527c79aa020f Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 10 Aug 2018 10:01:09 -0700 Subject: [PATCH 5/7] Things will 'just work' once backend is in place --- interface/resources/qml/hifi/Feed.qml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/hifi/Feed.qml b/interface/resources/qml/hifi/Feed.qml index c81e3c2389..593ebdcbea 100644 --- a/interface/resources/qml/hifi/Feed.qml +++ b/interface/resources/qml/hifi/Feed.qml @@ -90,7 +90,9 @@ Column { online_users: data.details.connections || data.details.concurrency || 0, // Server currently doesn't give isStacked (undefined). Could give bool. drillDownToPlace: data.is_stacked || (data.action === 'concurrency'), - isStacked: !!data.is_stacked + isStacked: !!data.is_stacked, + + time_before_autoscroll_ms: data.hold_time || 3000 }; } @@ -146,6 +148,14 @@ Column { onCountChanged: { if (scroll.currentIndex === -1 && scroll.count > 0 && root.autoScrollTimerEnabled) { scroll.currentIndex = 0; + autoScrollTimer.interval = suggestions.get(scroll.currentIndex).time_before_autoscroll_ms; + autoScrollTimer.start(); + } + } + + onCurrentIndexChanged: { + if (root.autoScrollTimerEnabled) { + autoScrollTimer.interval = suggestions.get(scroll.currentIndex).time_before_autoscroll_ms; autoScrollTimer.start(); } } @@ -170,7 +180,7 @@ Column { id: autoScrollTimer; interval: 3000; running: false; - repeat: true; + repeat: false; onTriggered: { if (scroll.currentIndex !== -1) { if (scroll.currentIndex === scroll.count - 1) { From 1a6a55680c169f8a149ec1c098024de58aa13a2a Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 10 Aug 2018 15:30:32 -0700 Subject: [PATCH 6/7] PropagateComposedEvents --- interface/resources/qml/hifi/Feed.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/resources/qml/hifi/Feed.qml b/interface/resources/qml/hifi/Feed.qml index 593ebdcbea..0605c72f26 100644 --- a/interface/resources/qml/hifi/Feed.qml +++ b/interface/resources/qml/hifi/Feed.qml @@ -165,6 +165,7 @@ Column { enabled: root.autoScrollTimerEnabled; anchors.fill: parent; hoverEnabled: true; + propagateComposedEvents: true; onEntered: { if (autoScrollTimer.running) { autoScrollTimer.stop(); From 096be16bb10423ac3b4df62e07de3944a7164d3b Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 10 Aug 2018 15:32:31 -0700 Subject: [PATCH 7/7] Only restart timer if feedMouseArea doesn't contain mouse --- interface/resources/qml/hifi/Feed.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/Feed.qml b/interface/resources/qml/hifi/Feed.qml index 0605c72f26..e1c712db1f 100644 --- a/interface/resources/qml/hifi/Feed.qml +++ b/interface/resources/qml/hifi/Feed.qml @@ -156,7 +156,9 @@ Column { onCurrentIndexChanged: { if (root.autoScrollTimerEnabled) { autoScrollTimer.interval = suggestions.get(scroll.currentIndex).time_before_autoscroll_ms; - autoScrollTimer.start(); + if (!feedMouseArea.containsMouse) { + autoScrollTimer.start(); + } } }