[vlc-commits] qml: use TableColumns.titleDelegate for cover column in VideoListDisplay

Prince Gupta git at videolan.org
Thu Dec 17 14:57:20 UTC 2020


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Mon Dec  7 19:30:24 2020 +0530| [ddb25356119dcac856b1e9a50414a6e9d78910c0] | committer: Pierre Lamot

qml: use TableColumns.titleDelegate for cover column in VideoListDisplay

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

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

 .../gui/qt/medialibrary/qml/VideoListDisplay.qml   | 44 ++++++----------------
 1 file changed, 12 insertions(+), 32 deletions(-)

diff --git a/modules/gui/qt/medialibrary/qml/VideoListDisplay.qml b/modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
index 93a3540aa0..a382045439 100644
--- a/modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
@@ -29,41 +29,10 @@ import "qrc:///style/"
 MainInterface.MainTableView {
     id: listView_id
 
-    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 )
-            labels: [
-                !rowModel ? "" : rowModel.resolution_name,
-                !rowModel ? "" : rowModel.channel
-            ].filter(function(a) { return a !== "" } )
-        }
-
-    }
-
     readonly property int _nbCols: VLCStyle.gridColumnsForWidth(listView_id.availableRowWidth)
 
     sortModel: [
-        { type: "image", criteria: "thumbnail", width: VLCStyle.colWidth(1), showSection: "", colDelegate: thumbnailColumn, headerDelegate: thumbnailHeader },
+        { type: "image", criteria: "thumbnail", width: VLCStyle.colWidth(1), showSection: "", colDelegate: tableColumns.titleDelegate, headerDelegate: tableColumns.titleHeaderDelegate },
         { isPrimary: true, criteria: "title",   width: VLCStyle.colWidth(Math.max(listView_id._nbCols - 2, 1)), text: i18n.qtr("Title"),    showSection: "title" },
         { criteria: "duration_short",            width: VLCStyle.colWidth(1), showSection: "", colDelegate: tableColumns.timeColDelegate, headerDelegate: tableColumns.timeHeaderDelegate, showContextButton: true },
     ]
@@ -78,5 +47,16 @@ MainInterface.MainTableView {
 
     Widgets.TableColumns {
         id: tableColumns
+
+        showTitleText: false
+        titleCover_height: VLCStyle.listAlbumCover_height
+        titleCover_width: VLCStyle.listAlbumCover_width
+        titleCover_radius: VLCStyle.listAlbumCover_radius
+
+        function titlecoverLabels(model) {
+            return [!model ? "" : model.resolution_name
+                    , model ? "" : model.channel
+                    ].filter(function(a) { return a !== "" })
+        }
     }
 }



More information about the vlc-commits mailing list