[vlc-devel] [PATCH 07/14] qml: use colDelegate for MCVideoListDisplay

Abel Tesfaye abeltesfaye45 at gmail.com
Tue Aug 6 11:18:41 CEST 2019


From: Abel Tesfaye <Abeltesfaye45 at gmail.com>

---
 .../qt/qml/mediacenter/MCVideoListDisplay.qml | 76 +++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/modules/gui/qt/qml/mediacenter/MCVideoListDisplay.qml b/modules/gui/qt/qml/mediacenter/MCVideoListDisplay.qml
index 383aa96911..7fd41d99ca 100644
--- a/modules/gui/qt/qml/mediacenter/MCVideoListDisplay.qml
+++ b/modules/gui/qt/qml/mediacenter/MCVideoListDisplay.qml
@@ -40,6 +40,82 @@ Utils.KeyNavigableTableView {
 
     rowHeight: VLCStyle.video_small_height + VLCStyle.margin_normal
 
+    colDelegate: Item {
+        id: colDel
+        anchors.fill: parent
+
+        property var rowModel: parent.rowModel
+        property var model: parent.colModel
+
+        Loader{
+            anchors.centerIn: parent
+            active: model.type === "image"
+            sourceComponent: Utils.RoundImage{
+                id: cover
+                height: VLCStyle.video_small_height
+                width: VLCStyle.video_small_width
+                source: !rowModel ? "" : rowModel[model.criteria]
+
+                MCVideoQualityLabel {
+                    id: resolutionLabel
+                    anchors {
+                        top: cover.top
+                        left: cover.left
+                        topMargin: VLCStyle.margin_xxsmall
+                        leftMargin: VLCStyle.margin_xxsmall
+                    }
+                    text: !rowModel ? "" : rowModel.resolution_name
+                }
+                MCVideoQualityLabel {
+                    anchors {
+                        top: cover.top
+                        left: resolutionLabel.right
+                        topMargin: VLCStyle.margin_xxsmall
+                        leftMargin: VLCStyle.margin_xxxsmall
+                    }
+                    visible: !rowModel ? "" : rowModel.channel.length > 0
+                    text: !rowModel ? "" : rowModel.channel
+                    color: "limegreen"
+                }
+                MCVideoProgressBar {
+                    value: !rowModel ? "" : rowModel.saved_position
+                    anchors {
+                        bottom: parent.bottom
+                        left: parent.left
+                        right: parent.right
+                    }
+                }
+
+            }
+        }
+        Loader{
+            anchors.fill:parent
+
+            active: model.type === "contextButton"
+            sourceComponent: Utils.ContextButton{
+                onClicked: listView_id.contextMenuButtonClicked(this,rowModel)
+            }
+        }
+        Loader{
+            anchors.fill:parent
+            active: model.type !== "image"
+            sourceComponent: Text {
+                text: !rowModel ? "" : rowModel[model.criteria] || ""
+                elide: Text.ElideRight
+                font.pixelSize: VLCStyle.fontSize_normal
+                color: (model.isPrimary)? VLCStyle.colors.text : VLCStyle.colors.textInactive
+
+                anchors {
+                    fill: parent
+                    leftMargin: VLCStyle.margin_xsmall
+                    rightMargin: VLCStyle.margin_xsmall
+                }
+                verticalAlignment: Text.AlignVCenter
+                horizontalAlignment: Text.AlignLeft
+            }
+        }
+    }
+
     headerColor: VLCStyle.colors.bg
     spacing: VLCStyle.margin_small
 
-- 
2.21.0



More information about the vlc-devel mailing list