[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml: keep the header visible in the ml playlist view

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Mon Feb 6 20:03:45 UTC 2023



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
29714e86 by Pierre Lamot at 2023-02-06T19:21:35+00:00
qml: keep the header visible in the ml playlist view

- - - - -
5298ac39 by Pierre Lamot at 2023-02-06T19:21:35+00:00
qml: fix icons alignment with texts in the tables header

- - - - -
3bb97f96 by Pierre Lamot at 2023-02-06T19:21:35+00:00
qml: fix header offset in genre subview

- - - - -


10 changed files:

- modules/gui/qt/medialibrary/qml/MusicAlbums.qml
- modules/gui/qt/medialibrary/qml/MusicGenresDisplay.qml
- modules/gui/qt/medialibrary/qml/MusicPlaylistsDisplay.qml
- modules/gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml
- modules/gui/qt/medialibrary/qml/UrlListDisplay.qml
- modules/gui/qt/medialibrary/qml/VideoPlaylistsDisplay.qml
- modules/gui/qt/network/qml/BrowseDeviceView.qml
- modules/gui/qt/network/qml/BrowseTreeDisplay.qml
- modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
- modules/gui/qt/widgets/qml/TableColumns.qml


Changes:

=====================================
modules/gui/qt/medialibrary/qml/MusicAlbums.qml
=====================================
@@ -57,6 +57,9 @@ FocusScope {
     property alias model: albumModelId
     property alias parentId: albumModelId.parentId
 
+    readonly property int contentLeftMargin: _currentView ? _currentView.contentLeftMargin : 0
+    readonly property int contentRightMargin: _currentView ? _currentView.contentRightMargin : 0
+
     property alias _currentView: view.currentItem
 
     onInitialIndexChanged:  resetFocus()


=====================================
modules/gui/qt/medialibrary/qml/MusicGenresDisplay.qml
=====================================
@@ -89,7 +89,8 @@ Widgets.PageLoader {
 
             header: Widgets.SubtitleLabel {
                 text: I18n.qtr("Genres - %1").arg(genreName)
-                leftPadding: (albumsView.gridViewRowX || VLCStyle.margin_large)
+                leftPadding: albumsView.contentLeftMargin
+                rightPadding: albumsView.contentRightMargin
                 topPadding: VLCStyle.margin_large
                 bottomPadding: VLCStyle.margin_normal
                 width: root.width


=====================================
modules/gui/qt/medialibrary/qml/MusicPlaylistsDisplay.qml
=====================================
@@ -81,8 +81,8 @@ Widgets.PageLoader {
     function _updateHistoryPlaylist(playlist) {
         History.update(["mc", "music", "playlists", "list", {
                             "initialIndex": playlist.currentIndex,
-                            "initialId"   : playlist.parentId,
-                            "initialName" : playlist.name
+                            "parentId"   : playlist.parentId,
+                            "name" : playlist.name
                         }]);
     }
 


=====================================
modules/gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml
=====================================
@@ -40,15 +40,11 @@ FocusScope {
     property int rightPadding: 0
 
     readonly property int currentIndex: view.currentIndex
+    property string name: ""
 
-    // NOTE: We need 'var' for properties altered by StackView.replace()..
-    property int    initialIndex: 0
-    property var    initialId
-    property string initialName
-
-    // NOTE: Specify an optional header for the view.
-    property Component header: null
+    property int initialIndex: 0
 
+    property alias header: view.header
     property Item headerItem: view.headerItem
 
     property bool isMusic: true
@@ -60,9 +56,6 @@ FocusScope {
     // NOTE: This is used to determine which media(s) shall be displayed..
     property alias parentId: model.parentId
 
-    // NOTE: The name of the playlist.
-    property alias name: label.text
-
     property alias model: model
 
     property alias dragItem: dragItem
@@ -109,8 +102,6 @@ FocusScope {
 
         ml: MediaLib
 
-        parentId: initialId
-
         onCountChanged: {
             // NOTE: We need to cancel the Drag item manually when resetting. Should this be called
             //       from 'onModelReset' only ?
@@ -123,23 +114,6 @@ FocusScope {
         }
     }
 
-    Widgets.SubtitleLabel {
-        id: label
-
-        anchors.left: parent.left
-        anchors.right: parent.right
-        anchors.top: parent.top
-
-        anchors.leftMargin: view.contentLeftMargin
-        anchors.rightMargin: view.contentRightMargin
-
-        anchors.topMargin: VLCStyle.margin_normal
-
-        bottomPadding: VLCStyle.margin_xsmall
-
-        text: initialName
-    }
-
     Widgets.MLDragItem {
         id: dragItem
 
@@ -170,10 +144,7 @@ FocusScope {
 
         // Settings
 
-        anchors.left  : parent.left
-        anchors.right : parent.right
-        anchors.top   : label.bottom
-        anchors.bottom: parent.bottom
+        anchors.fill: parent
 
         clip: true
 
@@ -185,14 +156,21 @@ FocusScope {
 
         dragItem: root.dragItem
 
-        header: root.header
+        header: Widgets.SubtitleLabel {
+            id: label
 
-        headerTopPadding: VLCStyle.margin_normal
+            leftPadding: view.contentLeftMargin
+            rightPadding: view.contentRightMargin
+            topPadding: VLCStyle.margin_normal
+            bottomPadding: VLCStyle.margin_xsmall
 
-        headerPositioning: ListView.InlineHeader
+            text: root.name
+        }
+
+
+        headerTopPadding: VLCStyle.margin_normal
 
         Navigation.parentItem: root
-        Navigation.upItem: (headerItem) ? headerItem.focusItem : null
 
         Navigation.cancelAction: function () {
             if (view.currentIndex <= 0) {


=====================================
modules/gui/qt/medialibrary/qml/UrlListDisplay.qml
=====================================
@@ -34,6 +34,9 @@ Widgets.KeyNavigableTableView {
     readonly property int _nbCols: VLCStyle.gridColumnsForWidth(
                                        listView_id.availableRowWidth)
     property Component urlHeaderDelegate: Widgets.IconLabel {
+        horizontalAlignment: Text.AlignHCenter
+        verticalAlignment: Text.AlignVCenter
+        font.pixelSize: VLCStyle.icon_tableHeader
         text: VLCIcons.history
         color: VLCStyle.colors.caption
     }


=====================================
modules/gui/qt/medialibrary/qml/VideoPlaylistsDisplay.qml
=====================================
@@ -80,9 +80,9 @@ Widgets.PageLoader {
 
     function _updateHistoryPlaylist(playlist) {
         History.update(["mc", "video", "playlists", "list", {
-                            "initialIndex": playlist.currentIndex,
-                            "initialId"   : playlist.parentId,
-                            "initialName" : playlist.name
+                            "currentIndex": playlist.currentIndex,
+                            "parentId"   : playlist.parentId,
+                            "name" : playlist.name
                         }]);
     }
 


=====================================
modules/gui/qt/network/qml/BrowseDeviceView.qml
=====================================
@@ -321,15 +321,14 @@ FocusScope {
             Component {
                 id: artworkHeader
 
-                Item {
-                    Widgets.IconLabel {
-                        width: VLCStyle.listAlbumCover_width
-                        height: VLCStyle.listAlbumCover_height
+                Widgets.IconLabel {
+                    text: VLCIcons.album_cover
 
-                        horizontalAlignment: Text.AlignHCenter
+                    horizontalAlignment: Text.AlignHCenter
+                    verticalAlignment: Text.AlignVCenter
+                    font.pixelSize: VLCStyle.icon_tableHeader
 
-                        color: VLCStyle.colors.caption
-                    }
+                    color: parent.foregroundColor
                 }
             }
 


=====================================
modules/gui/qt/network/qml/BrowseTreeDisplay.qml
=====================================
@@ -245,14 +245,14 @@ FocusScope {
 
             readonly property int _nbCols: VLCStyle.gridColumnsForWidth(tableView.availableRowWidth)
             readonly property int _nameColSpan: Math.max((_nbCols - 1) / 2, 1)
-            property Component thumbnailHeader: Item {
-                Widgets.IconLabel {
-                    height: VLCStyle.listAlbumCover_height
-                    width: VLCStyle.listAlbumCover_width
-                    horizontalAlignment: Text.AlignHCenter
-                    text: VLCIcons.album_cover
-                    color: VLCStyle.colors.caption
-                }
+            property Component thumbnailHeader: Widgets.IconLabel {
+                height: VLCStyle.listAlbumCover_height
+                width: VLCStyle.listAlbumCover_width
+                horizontalAlignment: Text.AlignHCenter
+                verticalAlignment: Text.AlignVCenter
+                font.pixelSize: VLCStyle.icon_tableHeader
+                text: VLCIcons.album_cover
+                color: VLCStyle.colors.caption
             }
 
             property Component thumbnailColumn: NetworkThumbnailItem {


=====================================
modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
=====================================
@@ -35,6 +35,9 @@ FocusScope {
     property var sortModel: []
 
     property Component tableHeaderDelegate: Widgets.CaptionLabel {
+        horizontalAlignment: Text.AlignHCenter
+        verticalAlignment: Text.AlignVCenter
+
         text: model.text || ""
     }
 
@@ -291,8 +294,8 @@ FocusScope {
             Column {
                 id: col
 
-                width: parent.width
-                height: implicitHeight
+                anchors.left: parent.left
+                anchors.right: parent.right
 
                 Loader {
                     id: headerLoader
@@ -317,13 +320,16 @@ FocusScope {
                     Repeater {
                         model: sortModel
                         MouseArea {
-                            height: childrenRect.height
 
+                            height: VLCStyle.dp(20, VLCStyle.scale)
                             width: VLCStyle.colWidth(modelData.size) || 1
 
                             //Layout.alignment: Qt.AlignVCenter
 
                             Loader {
+                                anchors.top: parent.top
+                                anchors.bottom: parent.bottom
+
                                 property var model: modelData.model
 
                                 sourceComponent: model.headerDelegate || root.tableHeaderDelegate
@@ -335,6 +341,8 @@ FocusScope {
                                 font.pixelSize: VLCStyle.fontSize_normal
                                 color: VLCStyle.colors.accent
                                 anchors {
+                                    top: parent.top
+                                    bottom: parent.bottom
                                     right: parent.right
                                     leftMargin: VLCStyle.margin_xsmall
                                     rightMargin: VLCStyle.margin_xsmall


=====================================
modules/gui/qt/widgets/qml/TableColumns.qml
=====================================
@@ -187,13 +187,20 @@ Item {
 
         Widgets.IconLabel {
             width: root.titleCover_width
+            height: parent.height
             horizontalAlignment: Text.AlignHCenter
-            text: VLCIcons.album_cover
+            verticalAlignment: Text.AlignVCenter
             font.pixelSize: VLCStyle.icon_tableHeader
             color: VLCStyle.colors.caption
+
+            text: VLCIcons.album_cover
         }
 
         Widgets.CaptionLabel {
+            horizontalAlignment: Text.AlignHCenter
+            verticalAlignment: Text.AlignVCenter
+            height: parent.height
+
             text: titleHeadDel.model
                     ? titleHeadDel.model.text || ""
                     : ""
@@ -204,6 +211,7 @@ Item {
     property Component timeHeaderDelegate: Widgets.IconLabel {
         width: timeTextMetric.width
         horizontalAlignment: Text.AlignHCenter
+        verticalAlignment: Text.AlignVCenter
         text: VLCIcons.time
         font.pixelSize: VLCStyle.icon_tableHeader
         color: VLCStyle.colors.caption



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/65b9b2de62f3d6f9af379dab1263689b4531f0d4...3bb97f96938971e945dcfb63c1524252df96491e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/65b9b2de62f3d6f9af379dab1263689b4531f0d4...3bb97f96938971e945dcfb63c1524252df96491e
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list