[vlc-devel] [PATCH 35/49] qml: no longer show the playlist as an overlay in the ML views, but aside

Pierre Lamot pierre at videolabs.io
Fri Oct 11 15:17:59 CEST 2019


---
 modules/gui/qt/qml/BannerSources.qml          |  9 +-
 .../gui/qt/qml/mediacenter/MCMainDisplay.qml  | 84 +++++++------------
 2 files changed, 33 insertions(+), 60 deletions(-)

diff --git a/modules/gui/qt/qml/BannerSources.qml b/modules/gui/qt/qml/BannerSources.qml
index 5f8341ec94..4a4328a779 100644
--- a/modules/gui/qt/qml/BannerSources.qml
+++ b/modules/gui/qt/qml/BannerSources.qml
@@ -47,8 +47,6 @@ Utils.NavigableFocusScope {
 
     property var extraLocalActions: undefined
 
-    property var playlistWidget: undefined
-
     // Triggered when the toogleView button is selected
     function toggleView () {
         medialib.gridView = !medialib.gridView
@@ -283,12 +281,7 @@ Utils.NavigableFocusScope {
                             size: VLCStyle.icon_normal
                             text: VLCIcons.playlist
 
-                            onClicked: {
-                                rootWindow.playlistVisible = !rootWindow.playlistVisible
-                                if (playlistWidget && rootWindow.playlistVisible && rootWindow.playlistDocked)
-                                    playlistWidget.gainFocus(playlist_btn)
-
-                            }
+                            onClicked:  rootWindow.playlistVisible = !rootWindow.playlistVisible
                         }
                     }
 
diff --git a/modules/gui/qt/qml/mediacenter/MCMainDisplay.qml b/modules/gui/qt/qml/mediacenter/MCMainDisplay.qml
index 12193ca94f..24345d17c8 100644
--- a/modules/gui/qt/qml/mediacenter/MCMainDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MCMainDisplay.qml
@@ -39,6 +39,7 @@ Utils.NavigableFocusScope {
         MCMusicDisplay {
             navigationParent: medialibId
             navigationUpItem: sourcesBanner
+            navigationRightItem: playlist
             navigationDownItem: miniPlayer.expanded ? miniPlayer : medialibId
             navigationCancelItem: stackViewZone
         }
@@ -49,6 +50,7 @@ Utils.NavigableFocusScope {
         MCVideoDisplay {
             navigationParent: medialibId
             navigationUpItem: sourcesBanner
+            navigationRightItem: playlist
             navigationDownItem: miniPlayer.expanded ? miniPlayer : medialibId
             navigationCancelItem: stackViewZone
         }
@@ -59,6 +61,7 @@ Utils.NavigableFocusScope {
         MCNetworkDisplay {
             navigationParent: medialibId
             navigationUpItem: sourcesBanner
+            navigationRightItem: playlist
             navigationDownItem: miniPlayer.expanded ? miniPlayer : medialibId
             navigationCancelItem: stackViewZone
         }
@@ -104,12 +107,6 @@ Utils.NavigableFocusScope {
             focus: true
             id: medialibId
             anchors.fill: parent
-            onActionRight: {
-                if (rootWindow.playlistDocked) {
-                    rootWindow.playlistVisible = true
-                    playlist.gainFocus(medialibId)
-                }
-            }
 
             ColumnLayout {
                 id: column
@@ -130,8 +127,6 @@ Utils.NavigableFocusScope {
                     focus: true
                     model: root.tabModel
 
-                    playlistWidget: playlist
-
                     onItemClicked: {
                         sourcesBanner.subTabModel = undefined
 
@@ -196,7 +191,12 @@ Utils.NavigableFocusScope {
 
                     Utils.StackViewExt {
                         id: stackView
-                        anchors.fill: parent
+                        anchors {
+                            top: parent.top
+                            left: parent.left
+                            bottom: parent.bottom
+                            right: playlist.visible ? playlist.left : parent.right
+                        }
 
                         Component.onCompleted: {
                             var found = stackView.loadView(root.pageModel, root.view, root.viewProperties)
@@ -214,54 +214,34 @@ Utils.NavigableFocusScope {
                                     return e.name === stackView.currentItem.view
                                 })
                         }
+                    }
 
-                        Utils.DrawerExt {
-                            z: 1
-                            id: playlist
-                            anchors {
-                                top: parent.top
-                                right: parent.right
-                                bottom: parent.bottom
-                            }
-                            focus: false
-                            edge: Utils.DrawerExt.Edges.Right
 
-                            property var previousFocus: undefined
+                    PL.PlaylistListView {
+                        id: playlist
+                        focus: true
+                        width: root.width/4
+                        visible: rootWindow.playlistDocked && rootWindow.playlistVisible
+                        anchors {
+                            top: parent.top
+                            right: parent.right
+                            bottom: parent.bottom
+                        }
 
-                            state: (rootWindow.playlistDocked && rootWindow.playlistVisible) ? "visible" : "hidden"
+                        navigationParent: medialibId
+                        navigationLeftItem: stackView
+                        navigationUpItem: sourcesBanner
+                        navigationDownItem: miniPlayer.expanded ? miniPlayer : undefined
+                        navigationCancelItem: stackViewZone
 
-                            function gainFocus(previous) {
-                                playlist.previousFocus = previous
-                                playlist.forceActiveFocus()
-                            }
-                            component: Rectangle {
-                                color: VLCStyle.colors.setColorAlpha(VLCStyle.colors.banner, 0.9)
-                                width: root.width/3
-                                height: playlist.height
-
-                                MouseArea {
-                                    anchors.fill: parent
-                                    propagateComposedEvents: false
-                                    hoverEnabled: true
-                                    preventStealing: true
-                                    onWheel: event.accepted = true
-
-                                    PL.PlaylistListView {
-                                        id: playlistView
-                                        focus: true
-                                        anchors.fill: parent
-                                        onActionLeft: playlist.closeAndFocus(stackView.currentItem)
-                                        onActionCancel: playlist.closeAndFocus(playlist.previousFocus)
-                                        onActionUp: playlist.closeAndFocus(playlist.previousFocus)
-                                    }
-                                }
-                            }
-                            function closeAndFocus(item){
-                                rootWindow.playlistVisible = false
-                                if (!item)
-                                    return
-                                item.forceActiveFocus()
+                        Rectangle {
+                            anchors {
+                                top: parent.top
+                                left: parent.left
+                                bottom: parent.bottom
                             }
+                            width: VLCStyle.margin_xxsmall
+                            color: VLCStyle.colors.banner
                         }
                     }
                 }
-- 
2.20.1



More information about the vlc-devel mailing list