[vlc-devel] [PATCH 2/8] qml: reuse VideoGridItem in VideoDisplayRecentVideos
Prince Gupta
guptaprince8832 at gmail.com
Wed Apr 21 10:11:58 UTC 2021
---
.../qt/medialibrary/qml/MediaGroupList.qml | 6 +++++
modules/gui/qt/medialibrary/qml/VideoAll.qml | 6 +++++
.../qml/VideoDisplayRecentVideos.qml | 22 ++-----------------
.../gui/qt/medialibrary/qml/VideoGridItem.qml | 4 +---
4 files changed, 15 insertions(+), 23 deletions(-)
diff --git a/modules/gui/qt/medialibrary/qml/MediaGroupList.qml b/modules/gui/qt/medialibrary/qml/MediaGroupList.qml
index df030f1a89..068265da0d 100644
--- a/modules/gui/qt/medialibrary/qml/MediaGroupList.qml
+++ b/modules/gui/qt/medialibrary/qml/MediaGroupList.qml
@@ -263,6 +263,12 @@ Widgets.NavigableFocusScope {
delegate: VideoGridItem {
id: gridItem
+ //---------------------------------------------------------------------------------
+ // properties required by ExpandGridView
+
+ property var model: ({})
+ property int index: -1
+
//---------------------------------------------------------------------------------
// Settings
diff --git a/modules/gui/qt/medialibrary/qml/VideoAll.qml b/modules/gui/qt/medialibrary/qml/VideoAll.qml
index b7fbe61ad6..1b01b29a63 100644
--- a/modules/gui/qt/medialibrary/qml/VideoAll.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoAll.qml
@@ -246,6 +246,12 @@ Widgets.NavigableFocusScope {
delegate: VideoGridItem {
id: gridItem
+ //---------------------------------------------------------------------------------
+ // properties required by ExpandGridView
+
+ property var model: ({})
+ property int index: -1
+
//---------------------------------------------------------------------------------
// Settings
diff --git a/modules/gui/qt/medialibrary/qml/VideoDisplayRecentVideos.qml b/modules/gui/qt/medialibrary/qml/VideoDisplayRecentVideos.qml
index 41d62e4787..d25e6a0e95 100644
--- a/modules/gui/qt/medialibrary/qml/VideoDisplayRecentVideos.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoDisplayRecentVideos.qml
@@ -93,37 +93,19 @@ Widgets.NavigableFocusScope {
width: VLCStyle.margin_xlarge
}
- delegate: Widgets.GridItem {
+ delegate: VideoGridItem {
id: recentVideoGridItem
focus: true
x: selectedBorderWidth
y: selectedBorderWidth
-
- image: model.thumbnail || VLCStyle.noArtCover
- title: model.title || i18n.qtr("Unknown title")
- subtitle: Helpers.msToString(model.duration) || ""
- labels: [
- model.resolution_name || "",
- model.channel || ""
- ].filter(function(a) { return a !== "" } )
- progress: model.progress > 0 ? model.progress : 0
pictureWidth: VLCStyle.gridCover_video_width_large
pictureHeight: VLCStyle.gridCover_video_height_large
- playCoverBorder.width: VLCStyle.gridCover_video_border
- titleMargin: VLCStyle.margin_xxsmall
showNewIndicator: true
unselectedUnderlay: shadows.unselected
selectedUnderlay: shadows.selected
-
- onItemDoubleClicked: {
- if ( model.id !== undefined ) {
- g_mainDisplay.showPlayer()
- medialib.addAndPlay( model.id )
- }
- }
- onPlayClicked: {
+ onItemDoubleClicked: {
if ( model.id !== undefined ) {
g_mainDisplay.showPlayer()
medialib.addAndPlay( model.id )
diff --git a/modules/gui/qt/medialibrary/qml/VideoGridItem.qml b/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
index e090035814..56c857378b 100644
--- a/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
@@ -24,9 +24,6 @@ import "qrc:///util/Helpers.js" as Helpers
import "qrc:///style/"
Widgets.GridItem {
- property var model: ({})
- property int index: -1
-
image: model.thumbnail || VLCStyle.noArtCover
title: model.title || i18n.qtr("Unknown title")
subtitle: Helpers.msToString(model.duration) || ""
@@ -40,6 +37,7 @@ Widgets.GridItem {
playCoverBorder.width: VLCStyle.gridCover_video_border
titleMargin: VLCStyle.margin_xxsmall
showNewIndicator: true
+
onPlayClicked: {
if ( model.id !== undefined ) {
g_mainDisplay.showPlayer()
--
2.27.0
More information about the vlc-devel
mailing list