[vlc-devel] [PATCH 2/3] qml: use cover attribute from genre model

Pierre Lamot pierre at videolabs.io
Tue Oct 29 14:47:17 CET 2019


---
 .../qt/qml/mediacenter/MusicGenresDisplay.qml | 33 ++++---------------
 1 file changed, 6 insertions(+), 27 deletions(-)

diff --git a/modules/gui/qt/qml/mediacenter/MusicGenresDisplay.qml b/modules/gui/qt/qml/mediacenter/MusicGenresDisplay.qml
index 7569fa3f08..8bc53e1919 100644
--- a/modules/gui/qt/qml/mediacenter/MusicGenresDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MusicGenresDisplay.qml
@@ -48,11 +48,11 @@ Utils.NavigableFocusScope {
                 width: root.width
                 height: VLCStyle.icon_normal + VLCStyle.margin_small
 
-                cover:  Utils.MultiCoverPreview {
-                    albums: MLAlbumModel {
-                        ml: medialib
-                        parentId: model.id
-                    }
+                cover: Image {
+                    id: cover_obj
+                    fillMode: Image.PreserveAspectFit
+                    source: model.cover || VLCStyle.noArtAlbum
+                    sourceSize: Qt.size(width, height)
                 }
 
                 line1: (model.name || "Unknown genre")+" - "+model.nb_tracks+" tracks"
@@ -115,7 +115,7 @@ Utils.NavigableFocusScope {
             delegate: AudioGridItem {
                 id: gridItem
 
-                image: VLCStyle.noArtAlbum
+                image: model.cover || VLCStyle.noArtAlbum
                 title: model.name || "Unknown genre"
                 subtitle: ""
                 //selected: element.DelegateModel.inSelected
@@ -129,27 +129,6 @@ Utils.NavigableFocusScope {
                 onItemDoubleClicked: {
                     history.push(["mc", "music", "albums", { parentId: model.id } ], History.Go)
                 }
-
-                //replace image with a mutlicovers preview
-                Utils.MultiCoverPreview {
-                    id: multicover
-                    visible: false
-                    width: VLCStyle.cover_normal
-                    height: VLCStyle.cover_normal
-
-                    albums: MLAlbumModel {
-                        ml: medialib
-                        parentId: model.id
-                    }
-                }
-
-                Component.onCompleted: {
-                    multicover.grabToImage(function(result) {
-                        gridItem.sourceSize = undefined
-                        gridItem.image = result.url
-                        //multicover.destroy()
-                    })
-                }
             }
 
             focus: true
-- 
2.17.1



More information about the vlc-devel mailing list