[vlc-devel] [PATCH 4/8] qml: move progressbar from Griditem

Prince Gupta guptaprince8832 at gmail.com
Wed Apr 21 10:12:00 UTC 2021


to VideoGridItem, they are only used with this widget
Improves creation time of GridItem
---
 .../gui/qt/medialibrary/qml/VideoGridItem.qml | 19 ++++++++++++++++++-
 modules/gui/qt/widgets/qml/GridItem.qml       |  1 -
 modules/gui/qt/widgets/qml/MediaCover.qml     | 12 ------------
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/modules/gui/qt/medialibrary/qml/VideoGridItem.qml b/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
index adcfcc8a0c..9abfb8e7b8 100644
--- a/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
+++ b/modules/gui/qt/medialibrary/qml/VideoGridItem.qml
@@ -36,12 +36,29 @@ Widgets.GridItem {
         model.resolution_name || "",
         model.channel || ""
     ].filter(function(a) { return a !== "" } )
-    progress: model.progress > 0 ? model.progress : 0
     pictureWidth: VLCStyle.gridCover_video_width
     pictureHeight: VLCStyle.gridCover_video_height
     playCoverBorder.width: VLCStyle.gridCover_video_border
     titleMargin: VLCStyle.margin_xxsmall
 
+    pictureOverlay: Item {
+        width: root.pictureWidth
+        height: root.pictureHeight
+
+        Widgets.VideoProgressBar {
+            id: progressBar
+
+            visible: !root.highlighted && value > 0
+            value: model.progress > 0 ? model.progress : 0
+            anchors {
+                bottom: parent.bottom
+                left: parent.left
+                right: parent.right
+                rightMargin: root.pictureRadius
+            }
+        }
+    }
+
     onPlayClicked: {
         if ( model.id !== undefined ) {
             g_mainDisplay.showPlayer()
diff --git a/modules/gui/qt/widgets/qml/GridItem.qml b/modules/gui/qt/widgets/qml/GridItem.qml
index dc384946e2..1e32f513d0 100644
--- a/modules/gui/qt/widgets/qml/GridItem.qml
+++ b/modules/gui/qt/widgets/qml/GridItem.qml
@@ -41,7 +41,6 @@ FocusScope {
     property alias unselectedUnderlay: unselectedUnderlayLoader.sourceComponent
     property alias selectedUnderlay: selectedUnderlayLoader.sourceComponent
 
-    property alias progress: picture.progress
     property alias labels: picture.labels
     property real pictureWidth: VLCStyle.colWidth(1)
     property real pictureHeight: pictureWidth
diff --git a/modules/gui/qt/widgets/qml/MediaCover.qml b/modules/gui/qt/widgets/qml/MediaCover.qml
index 2a2ff8e80d..14b8968c8b 100644
--- a/modules/gui/qt/widgets/qml/MediaCover.qml
+++ b/modules/gui/qt/widgets/qml/MediaCover.qml
@@ -27,7 +27,6 @@ Widgets.RoundImage {
     id: root
 
     property var labels: []
-    property alias progress: progressBar.value
     property alias playCoverOpacity: playCover.opacity
     property alias playCoverVisible: playCover.visible
     property alias playCoverOnlyBorders: playCover.onlyBorders
@@ -71,17 +70,6 @@ Widgets.RoundImage {
         }
     }
 
-    Widgets.VideoProgressBar {
-        id: progressBar
-
-        visible: !playCover.visible && value > 0
-        anchors {
-            bottom: parent.bottom
-            left: parent.left
-            right: parent.right
-        }
-    }
-
     Widgets.PlayCover {
         id: playCover
 
-- 
2.27.0



More information about the vlc-devel mailing list