[vlc-commits] qml: change the global cancel beahvior to navigate back in history

Pierre Lamot git at videolan.org
Fri Jan 10 15:06:29 CET 2020


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Tue Dec 17 09:51:52 2019 +0100| [f9811b5517faa7c21651a9377dbc0e99782bc83b] | committer: Jean-Baptiste Kempf

qml: change the global cancel beahvior to navigate back in history

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f9811b5517faa7c21651a9377dbc0e99782bc83b
---

 modules/gui/qt/medialibrary/qml/MainDisplay.qml | 42 ++++---------------------
 1 file changed, 6 insertions(+), 36 deletions(-)

diff --git a/modules/gui/qt/medialibrary/qml/MainDisplay.qml b/modules/gui/qt/medialibrary/qml/MainDisplay.qml
index b5a1f38aca..11aa280800 100644
--- a/modules/gui/qt/medialibrary/qml/MainDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/MainDisplay.qml
@@ -60,6 +60,9 @@ Widgets.NavigableFocusScope {
             })
     }
 
+    navigationCancel: function() {
+        history.previous(History.Go)
+    }
 
     Component {
         id: musicComp
@@ -68,7 +71,6 @@ Widgets.NavigableFocusScope {
             navigationUpItem: sourcesBanner
             navigationRightItem: playlist
             navigationDownItem: miniPlayer.expanded ? miniPlayer : medialibId
-            navigationCancelItem: stackViewZone
         }
     }
 
@@ -79,7 +81,6 @@ Widgets.NavigableFocusScope {
             navigationUpItem: sourcesBanner
             navigationRightItem: playlist
             navigationDownItem: miniPlayer.expanded ? miniPlayer : medialibId
-            navigationCancelItem: stackViewZone
         }
     }
 
@@ -90,7 +91,6 @@ Widgets.NavigableFocusScope {
             navigationUpItem: sourcesBanner
             navigationRightItem: playlist
             navigationDownItem: miniPlayer.expanded ? miniPlayer : medialibId
-            navigationCancelItem: stackViewZone
         }
     }
 
@@ -135,6 +135,8 @@ Widgets.NavigableFocusScope {
             id: medialibId
             anchors.fill: parent
 
+            navigationParent: root
+
             ColumnLayout {
                 id: column
                 anchors.fill: parent
@@ -169,7 +171,7 @@ Widgets.NavigableFocusScope {
                         extraLocalActions = stackView.currentItem.extraLocalActions
                     }
 
-                    navigationParent: root
+                    navigationParent: medialibId
                     navigationDownItem: stackView
                 }
 
@@ -177,37 +179,6 @@ Widgets.NavigableFocusScope {
                     Layout.fillWidth: true
                     Layout.fillHeight: true
 
-                    Widgets.NavigableFocusScope {
-                        id: stackViewZone
-                        anchors.fill: parent
-
-                        onActionUp: sourcesBanner.focus = true
-                        onActionDown: {
-                            if (miniPlayer.expanded)
-                                miniPlayer.focus = true
-                        }
-
-                        Keys.onPressed: {
-                            if (!event.accepted)
-                                defaultKeyAction(event, 0)
-                        }
-                        Keys.onReleased: {
-                            if (!event.accepted && KeyHelper.matchOk(event)) {
-                                event.accepted = true
-                                stackView.focus = true
-                            }
-                        }
-                    }
-
-                    Rectangle {
-                        visible: stackViewZone.focus
-                        anchors.fill: stackViewZone
-                        z: 42
-                        color: VLCStyle.colors.setColorAlpha(VLCStyle.colors.accent, 0.08)
-                        border.width: VLCStyle.selectedBorder
-                        border.color: VLCStyle.colors.accent
-                    }
-
                     Widgets.StackViewExt {
                         id: stackView
                         anchors {
@@ -251,7 +222,6 @@ Widgets.NavigableFocusScope {
                         navigationLeftItem: stackView
                         navigationUpItem: sourcesBanner
                         navigationDownItem: miniPlayer.expanded ? miniPlayer : undefined
-                        navigationCancelItem: stackViewZone
 
                         Rectangle {
                             anchors {



More information about the vlc-commits mailing list