[vlc-commits] qml: rearrange items in Player widget in their z order

Prince Gupta git at videolan.org
Mon Mar 15 10:32:48 UTC 2021


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Wed Feb  3 21:39:09 2021 +0530| [0b8f34c036a8e236e4be3aef7cb238b89e763539] | committer: Pierre Lamot

qml: rearrange items in Player widget in their z order

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

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

 modules/gui/qt/player/qml/Player.qml | 336 +++++++++++++++++------------------
 1 file changed, 162 insertions(+), 174 deletions(-)

diff --git a/modules/gui/qt/player/qml/Player.qml b/modules/gui/qt/player/qml/Player.qml
index a259a086c6..3e3f9b5a9e 100644
--- a/modules/gui/qt/player/qml/Player.qml
+++ b/modules/gui/qt/player/qml/Player.qml
@@ -86,141 +86,87 @@ Widgets.NavigableFocusScope {
         source: rootPlayer.coverSource
     }
 
-    Widgets.DrawerExt {
-        id: csdGroup
-
-        z: 4
-        anchors.right: parent.right
-        anchors.top: parent.top
-        state: topcontrolView.state
-        edge: Widgets.DrawerExt.Edges.Top
-        width: contentItem.width
-        focus: true
-
-        component: Column {
-            spacing: VLCStyle.margin_xxsmall
-            focus: true
-
-            onActiveFocusChanged: if (activeFocus) menu_selector.forceActiveFocus()
+    VideoSurface {
+        id: videoSurface
 
-            Loader {
-                focus: false
-                anchors.right: parent.right
-                height: VLCStyle.icon_normal
-                active: mainInterface.clientSideDecoration
-                enabled: mainInterface.clientSideDecoration
-                visible: mainInterface.clientSideDecoration
-                source: "qrc:///widgets/CSDWindowButtonSet.qml"
-                onLoaded: {
-                    item.color = Qt.binding(function() { return rootPlayer.colors.playerFg })
-                    item.hoverColor = Qt.binding(function() { return rootPlayer.colors.windowCSDButtonDarkBg })
-                }
-            }
+        ctx: mainctx
+        visible: rootPlayer.hasEmbededVideo
+        enabled: rootPlayer.hasEmbededVideo
+        anchors.fill: parent
 
-            Row {
-                anchors.right: parent.right
-                anchors.rightMargin: VLCStyle.applicationHorizontalMargin + VLCStyle.margin_xxsmall
-                focus: true
-                spacing: VLCStyle.margin_xxsmall
-                KeyNavigation.down: playlistpopup.state === "visible" ? playlistpopup : (audioControls.visible ? audioControls : controlBarView)
+        property point mousePosition: Qt.point(0,0)
 
-                Widgets.IconToolButton {
-                    id: menu_selector
+        onMouseMoved:{
+            //short interval for mouse events
+            toolbarAutoHide.setVisible(1000)
+            mousePosition = Qt.point(x, y)
+        }
+    }
 
-                    focus: true
-                    size: VLCStyle.banner_icon_size
-                    iconText: VLCIcons.ellipsis
-                    text: i18n.qtr("Menu")
-                    color: rootPlayer.colors.playerFg
-                    property bool acceptFocus: true
+    // background image
+    Rectangle {
+        visible: !rootPlayer.hasEmbededVideo
+        focus: false
+        color: rootPlayer.colors.bg
+        anchors.fill: parent
 
-                    onClicked: contextMenu.popup(this.mapToGlobal(0, height))
+        Item {
+            //destination aspect ration
+            readonly property real dar: parent.width / parent.height
 
-                    KeyNavigation.left: topcontrolView
-                    KeyNavigation.right: playlistBtn
+            anchors.centerIn: parent
+            width: (cover.sar < dar) ? parent.width :  parent.height * cover.sar
+            height: (cover.sar < dar) ? parent.width / cover.sar :  parent.height
 
-                    QmlGlobalMenu {
-                        id: contextMenu
-                        ctx: mainctx
-                    }
-                }
+            GaussianBlur {
+                id: blur
 
-                Widgets.IconToolButton {
-                    id: playlistBtn
+                anchors.fill: parent
+                source: cover
+                samples: 102
+                radius: 50
+                visible: false
+            }
 
-                    objectName: PlayerControlBarModel.PLAYLIST_BUTTON
-                    size: VLCStyle.banner_icon_size
-                    iconText: VLCIcons.playlist
-                    text: i18n.qtr("Playlist")
-                    color: rootPlayer.colors.playerFg
-                    focus: false
-                    onClicked:  {
-                        if (mainInterface.playlistDocked)
-                            playlistpopup.showPlaylist = !playlistpopup.showPlaylist
-                        else
-                            mainInterface.playlistVisible = !mainInterface.playlistVisible
-                    }
-                    property bool acceptFocus: true
+            Rectangle {
+                id: blurOverlay
 
-                    KeyNavigation.left: menu_selector
-                }
+                color: rootPlayer.colors.setColorAlpha(rootPlayer.colors.playerBg, .55)
+                anchors.fill: parent
+                visible: false
             }
-        }
-    }
-
-    Widgets.DrawerExt {
-        id: playlistpopup
 
-        property bool showPlaylist: false
-        property var previousFocus: undefined
+            Blend {
+                id:screen
 
-        z: 2
-        anchors {
-            top: parent.top
-            right: parent.right
-            bottom: parent.bottom
-            bottomMargin: parent.height - rootPlayer.positionSliderY
-        }
-        focus: false
-        edge: Widgets.DrawerExt.Edges.Right
-        state: showPlaylist && mainInterface.playlistDocked ? "visible" : "hidden"
-        component: Rectangle {
-            color: rootPlayer.colors.setColorAlpha(rootPlayer.colors.banner, 0.8)
-            width: rootPlayer.width/4
-            height: playlistpopup.height
+                anchors.fill: parent
+                foregroundSource: blurOverlay
+                source: blur
+                mode: "screen"
+                visible: false
+            }
 
-            PL.PlaylistListView {
-                id: playlistView
-                focus: true
+            Blend {
                 anchors.fill: parent
+                source: screen
+                foregroundSource: blurOverlay
+                mode: "multiply"
+            }
 
-                colors: rootPlayer.colors
-                navigationParent: rootPlayer
-                navigationUpItem: csdGroup
-                navigationDownItem: controlBarView
-                navigationLeft: closePlaylist
-                navigationCancel: closePlaylist
+            Rectangle {
+                id: colorOverlay
 
-                function closePlaylist() {
-                    playlistpopup.showPlaylist = false
-                    controlBarView.forceActiveFocus()
-                    if (audioControls.visible)
-                        audioControls.forceActiveFocus()
-                    else
-                        controlBarView.forceActiveFocus()
-                }
+                anchors.fill: parent
+                visible: true
+                opacity: .4
+                color: rootPlayer.colors.setColorAlpha(Qt.tint(rootPlayer.colors.playerFg, rootPlayer.colors.playerBg), 1)
             }
         }
-        onStateChanged: {
-            if (state === "hidden")
-                toolbarAutoHide.restart()
-        }
     }
 
     /// Backgrounds of topControlbar and controlBar are drawn separately since they outgrow their content
     /* top control bar background */
     Widgets.DrawerExt {
-        z: 1
         edge: Widgets.DrawerExt.Edges.Top
         state: topcontrolView.state
         width: parent.width
@@ -238,7 +184,6 @@ Widgets.NavigableFocusScope {
 
     /* bottom control bar background */
     Widgets.DrawerExt {
-        z: 1
         anchors.bottom: parent.bottom
         width: parent.width
         visible: rootPlayer.hasEmbededVideo
@@ -259,7 +204,6 @@ Widgets.NavigableFocusScope {
     //property alias centralLayout: mainLayout.centralLayout
     ColumnLayout {
         id: mainLayout
-        z: 1
         anchors.fill: parent
 
         Widgets.DrawerExt{
@@ -516,90 +460,134 @@ Widgets.NavigableFocusScope {
                 }
             }
         }
-
     }
 
-    //center image
-    Rectangle {
-        visible: !rootPlayer.hasEmbededVideo
-        focus: false
-        color: rootPlayer.colors.bg
-        anchors.fill: parent
+    Widgets.DrawerExt {
+        id: playlistpopup
 
-        z: 0
+        property bool showPlaylist: false
+        property var previousFocus: undefined
 
-        Item {
-            //destination aspect ration
-            readonly property real dar: parent.width / parent.height
+        anchors {
+            top: parent.top
+            right: parent.right
+            bottom: parent.bottom
+            bottomMargin: parent.height - rootPlayer.positionSliderY
+        }
+        focus: false
+        edge: Widgets.DrawerExt.Edges.Right
+        state: showPlaylist && mainInterface.playlistDocked ? "visible" : "hidden"
+        component: Rectangle {
+            color: rootPlayer.colors.setColorAlpha(rootPlayer.colors.banner, 0.8)
+            width: rootPlayer.width/4
+            height: playlistpopup.height
 
-            anchors.centerIn: parent
-            width: (cover.sar < dar) ? parent.width :  parent.height * cover.sar
-            height: (cover.sar < dar) ? parent.width / cover.sar :  parent.height
+            PL.PlaylistListView {
+                id: playlistView
+                focus: true
+                anchors.fill: parent
 
-            GaussianBlur {
-                id: blur
+                colors: rootPlayer.colors
+                navigationParent: rootPlayer
+                navigationUpItem: csdGroup
+                navigationDownItem: controlBarView
+                navigationLeft: closePlaylist
+                navigationCancel: closePlaylist
 
-                anchors.fill: parent
-                source: cover
-                samples: 102
-                radius: 50
-                visible: false
+                function closePlaylist() {
+                    playlistpopup.showPlaylist = false
+                    controlBarView.forceActiveFocus()
+                    if (audioControls.visible)
+                        audioControls.forceActiveFocus()
+                    else
+                        controlBarView.forceActiveFocus()
+                }
             }
+        }
+        onStateChanged: {
+            if (state === "hidden")
+                toolbarAutoHide.restart()
+        }
+    }
 
-            Rectangle {
-                id: blurOverlay
+    Widgets.DrawerExt {
+        id: csdGroup
 
-                color: rootPlayer.colors.setColorAlpha(rootPlayer.colors.playerBg, .55)
-                anchors.fill: parent
-                visible: false
-            }
+        anchors.right: parent.right
+        anchors.top: parent.top
+        state: topcontrolView.state
+        edge: Widgets.DrawerExt.Edges.Top
+        width: contentItem.width
+        focus: true
 
-            Blend {
-                id:screen
+        component: Column {
+            spacing: VLCStyle.margin_xxsmall
+            focus: true
 
-                anchors.fill: parent
-                foregroundSource: blurOverlay
-                source: blur
-                mode: "screen"
-                visible: false
-            }
+            onActiveFocusChanged: if (activeFocus) menu_selector.forceActiveFocus()
 
-            Blend {
-                anchors.fill: parent
-                source: screen
-                foregroundSource: blurOverlay
-                mode: "multiply"
+            Loader {
+                focus: false
+                anchors.right: parent.right
+                height: VLCStyle.icon_normal
+                active: mainInterface.clientSideDecoration
+                enabled: mainInterface.clientSideDecoration
+                visible: mainInterface.clientSideDecoration
+                source: "qrc:///widgets/CSDWindowButtonSet.qml"
+                onLoaded: {
+                    item.color = Qt.binding(function() { return rootPlayer.colors.playerFg })
+                    item.hoverColor = Qt.binding(function() { return rootPlayer.colors.windowCSDButtonDarkBg })
+                }
             }
 
-            Rectangle {
-                id: colorOverlay
+            Row {
+                anchors.right: parent.right
+                anchors.rightMargin: VLCStyle.applicationHorizontalMargin + VLCStyle.margin_xxsmall
+                focus: true
+                spacing: VLCStyle.margin_xxsmall
+                KeyNavigation.down: playlistpopup.state === "visible" ? playlistpopup : (audioControls.visible ? audioControls : controlBarView)
 
-                anchors.fill: parent
-                visible: true
-                opacity: .4
-                color: rootPlayer.colors.setColorAlpha(Qt.tint(rootPlayer.colors.playerFg, rootPlayer.colors.playerBg), 1)
-            }
+                Widgets.IconToolButton {
+                    id: menu_selector
 
-        }
+                    focus: true
+                    size: VLCStyle.banner_icon_size
+                    iconText: VLCIcons.ellipsis
+                    text: i18n.qtr("Menu")
+                    color: rootPlayer.colors.playerFg
+                    property bool acceptFocus: true
 
-    }
+                    onClicked: contextMenu.popup(this.mapToGlobal(0, height))
 
-    VideoSurface {
-        id: videoSurface
+                    KeyNavigation.left: topcontrolView
+                    KeyNavigation.right: playlistBtn
 
-        z: 0
+                    QmlGlobalMenu {
+                        id: contextMenu
+                        ctx: mainctx
+                    }
+                }
 
-        ctx: mainctx
-        visible: rootPlayer.hasEmbededVideo
-        enabled: rootPlayer.hasEmbededVideo
-        anchors.fill: parent
+                Widgets.IconToolButton {
+                    id: playlistBtn
 
-        property point mousePosition: Qt.point(0,0)
+                    objectName: PlayerControlBarModel.PLAYLIST_BUTTON
+                    size: VLCStyle.banner_icon_size
+                    iconText: VLCIcons.playlist
+                    text: i18n.qtr("Playlist")
+                    color: rootPlayer.colors.playerFg
+                    focus: false
+                    onClicked:  {
+                        if (mainInterface.playlistDocked)
+                            playlistpopup.showPlaylist = !playlistpopup.showPlaylist
+                        else
+                            mainInterface.playlistVisible = !mainInterface.playlistVisible
+                    }
+                    property bool acceptFocus: true
 
-        onMouseMoved:{
-            //short interval for mouse events
-            toolbarAutoHide.setVisible(1000)
-            mousePosition = Qt.point(x, y)
+                    KeyNavigation.left: menu_selector
+                }
+            }
         }
     }
 



More information about the vlc-commits mailing list