[vlc-commits] qml: redesign genres grid items

Prince Gupta git at videolan.org
Tue Aug 18 17:14:47 CEST 2020


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Fri Jul 31 00:46:20 2020 +0530| [eba456ab4d435aef04e734f5fd34cd35a786b096] | committer: Pierre Lamot

qml: redesign genres grid items

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

 modules/gui/qt/medialibrary/qml/MusicGenres.qml | 46 +++++++++++++++++++++----
 1 file changed, 39 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt/medialibrary/qml/MusicGenres.qml b/modules/gui/qt/medialibrary/qml/MusicGenres.qml
index 4d35ef041a..66098707b2 100644
--- a/modules/gui/qt/medialibrary/qml/MusicGenres.qml
+++ b/modules/gui/qt/medialibrary/qml/MusicGenres.qml
@@ -147,26 +147,58 @@ Widgets.NavigableFocusScope {
             model: genreModel
             topMargin: VLCStyle.margin_large
 
-            delegate: AudioGridItem {
-                id: gridItem
+            delegate: Widgets.GridItem {
+                id: item
 
+                property var model: ({})
+                property int index: -1
+
+                width: VLCStyle.colWidth(2)
+                height: width / 2
+                pictureWidth: width
+                pictureHeight: height
                 image: model.cover || VLCStyle.noArtAlbum
-                title: model.name || "Unknown genre"
-                subtitle: ""
+                playCoverBorder.width: VLCStyle.dp(3, VLCStyle.scale)
 
+                onItemDoubleClicked: root.showAlbumView(model)
                 onItemClicked: {
                     selectionModel.updateSelection( modifier , view.currentItem.currentIndex, index)
                     view.currentItem.currentIndex = index
                     view.currentItem.forceActiveFocus()
                 }
+                onPlayClicked: {
+                    if (model.id)
+                        medialib.addAndPlay(model.id)
+                }
 
-                onItemDoubleClicked: root.showAlbumView(model)
+                Column {
+                    anchors.centerIn: parent
+                    opacity: item._highlighted ? .3 : 1
+
+                    Label {
+                         width: item.width
+                         elide: Text.ElideRight
+                         font.pixelSize: VLCStyle.fontSize_large
+                         font.weight: Font.DemiBold
+                         text: model.name
+                         color: "white"
+                         horizontalAlignment: Text.AlignHCenter
+                    }
+
+                    Widgets.CaptionLabel {
+                        width: item.width
+                        text: model.nb_tracks > 1 ? i18n.qtr("%1 Tracks").arg(model.nb_tracks) : i18n.qtr("%1 Track").arg(model.nb_tracks)
+                        opacity: .7
+                        color: "white"
+                        horizontalAlignment: Text.AlignHCenter
+                    }
+                }
             }
 
             focus: true
 
-            cellWidth: VLCStyle.gridItem_music_width
-            cellHeight: VLCStyle.gridItem_music_height
+            cellWidth: VLCStyle.colWidth(2)
+            cellHeight: cellWidth / 2
 
             onSelectAll: selectionModel.selectAll()
             onSelectionUpdated:  selectionModel.updateSelection( keyModifiers, oldIndex, newIndex )



More information about the vlc-commits mailing list