vlc | branch: master | Prince Gupta <guptaprince8...@gmail.com> | Tue Aug  4 
18:41:49 2020 +0530| [adf018f674856a84edce68ae9d5e64c06e707389] | committer: 
Pierre Lamot

qml: change cover width in list view for genres

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

 modules/gui/qt/medialibrary/qml/MusicGenres.qml | 37 +++++++++++++++++++++----
 1 file changed, 31 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt/medialibrary/qml/MusicGenres.qml 
b/modules/gui/qt/medialibrary/qml/MusicGenres.qml
index 57e66390e7..7ab58c65e0 100644
--- a/modules/gui/qt/medialibrary/qml/MusicGenres.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicGenres.qml
@@ -214,7 +214,35 @@ Widgets.NavigableFocusScope {
         Widgets.KeyNavigableTableView {
             id: tableView_id
 
-            readonly property int _nbCols: 
VLCStyle.gridColumnsForWidth(tableView_id.availableRowWidth)
+            readonly property int _nameColSpan: Math.max(
+                                                    
VLCStyle.gridColumnsForWidth(tableView_id.availableRowWidth - 
VLCStyle.listAlbumCover_width - VLCStyle.column_margin_width) - 1
+                                                    , 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 thumbnailColumn: Item {
+
+                property var rowModel: parent.rowModel
+                property var model: parent.colModel
+                readonly property bool currentlyFocused: 
parent.currentlyFocused
+                readonly property bool containsMouse: parent.containsMouse
+
+                Widgets.MediaCover {
+                    anchors.verticalCenter: parent.verticalCenter
+                    source: ( !rowModel ? undefined : rowModel[model.criteria] 
) || VLCStyle.noArtCover
+                    playCoverVisible: currentlyFocused || containsMouse
+                    playIconSize: VLCStyle.play_cover_small
+                    onPlayIconClicked:  medialib.addAndPlay( rowModel.id )
+                }
+            }
 
             model: genreModel
             headerColor: VLCStyle.colors.bg
@@ -223,7 +251,8 @@ Widgets.NavigableFocusScope {
             navigationParent: root
 
             sortModel:  [
-                { isPrimary: true, criteria: "name", width: 
VLCStyle.colWidth(Math.max(tableView_id._nbCols - 1, 1)), text: 
i18n.qtr("Name"), headerDelegate: tableColumns.titleHeaderDelegate, 
colDelegate: tableColumns.titleDelegate },
+                { isPrimary: true, criteria: "cover", width: 
VLCStyle.listAlbumCover_width, headerDelegate: thumbnailHeader, colDelegate: 
thumbnailColumn },
+                { criteria: "name", width: 
VLCStyle.colWidth(tableView_id._nameColSpan), text: i18n.qtr("Name") },
                 { criteria: "nb_tracks", width: VLCStyle.colWidth(1), text: 
i18n.qtr("Tracks") }
             ]
 
@@ -235,10 +264,6 @@ Widgets.NavigableFocusScope {
                 contextMenu.model = menuModel
                 contextMenu.popup(menuParent)
             }
-
-            Widgets.TableColumns {
-                id: tableColumns
-            }
         }
     }
 

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to