[vlc-commits] qml: dynamically sets the labels on the Video miniature
Pierre Lamot
git at videolan.org
Thu Feb 20 13:56:36 CET 2020
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Thu Feb 13 15:24:05 2020 +0100| [39c7f677d4d8b8bdb678d07f8a2ea8604dcbdebf] | committer: Jean-Baptiste Kempf
qml: dynamically sets the labels on the Video miniature
this avoids having a gap when one is missing
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=39c7f677d4d8b8bdb678d07f8a2ea8604dcbdebf
---
modules/gui/qt/medialibrary/qml/VideoGridItem.qml | 6 ++--
modules/gui/qt/widgets/qml/GridItem.qml | 34 ++++++++++++-----------
2 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/modules/gui/qt/medialibrary/qml/VideoGridItem.qml b/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
index 4591e88d03..368dd1b221 100644
--- a/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
@@ -27,8 +27,10 @@ Widgets.GridItem {
image: model.thumbnail || VLCStyle.noArtCover
title: model.title || i18n.qtr("Unknown title")
infoLeft: model.duration || ""
- resolution: model.resolution_name || ""
- channel: model.channel || ""
+ labels: [
+ model.resolution_name || "",
+ model.channel || ""
+ ].filter(function(a) { return a !== "" } )
isVideo: true
isNew: model.playcount < 1
progress: model.progress > 0 ? model.progress : 0
diff --git a/modules/gui/qt/widgets/qml/GridItem.qml b/modules/gui/qt/widgets/qml/GridItem.qml
index 9737c007e0..3aad512eeb 100644
--- a/modules/gui/qt/widgets/qml/GridItem.qml
+++ b/modules/gui/qt/widgets/qml/GridItem.qml
@@ -34,11 +34,10 @@ Item {
property bool selected: false
property string infoLeft: ""
- property string resolution: ""
property bool isVideo: false
property bool isNew: false
property double progress: 0
- property string channel: ""
+ property var labels: []
property real pictureWidth: isVideo ? VLCStyle.video_normal_width : VLCStyle.cover_small
property real pictureHeight: isVideo ? VLCStyle.video_normal_height : VLCStyle.cover_small
@@ -65,6 +64,7 @@ Item {
property real _picWidth: pictureWidth + (_zoomed ? 2*outterMargin : 0)
property real _picHeight: pictureHeight + (_zoomed ? 2*outterMargin : 0)
+
MouseArea {
id: mouseArea
hoverEnabled: true
@@ -143,28 +143,30 @@ Item {
source: image
- VideoQualityLabel {
- id: resolutionLabel
- visible: root.resolution !== ""
+ RowLayout {
anchors {
top: parent.top
left: parent.left
+ right: parent.right
topMargin: VLCStyle.margin_xxsmall
leftMargin: VLCStyle.margin_xxsmall
+ rightMargin: VLCStyle.margin_xxsmall
}
- text: root.resolution
- }
- VideoQualityLabel {
- anchors {
- top: parent.top
- left: resolutionLabel.right
- topMargin: VLCStyle.margin_xxsmall
- leftMargin: VLCStyle.margin_xxsmall
+ spacing: VLCStyle.margin_xxsmall
+
+ Repeater {
+ model: labels
+ VideoQualityLabel {
+ Layout.preferredWidth: implicitWidth
+ Layout.preferredHeight: implicitHeight
+ text: modelData
+ }
+ }
+
+ Item {
+ Layout.fillWidth: true
}
- visible: root.channel !== ""
- text: root.channel
- color: "limegreen"
}
VideoProgressBar {
More information about the vlc-commits
mailing list