[vlc-commits] [Git][videolan/vlc][master] 2 commits: qml: disable 'view more' panel when there is nothing to show

Steve Lhomme (@robUx4) gitlab at videolan.org
Sun Jun 9 15:33:30 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
8292f955 by Prince Gupta at 2024-06-09T15:19:54+00:00
qml: disable 'view more' panel when there is nothing to show

- - - - -
fe8ac5c4 by Prince Gupta at 2024-06-09T15:19:54+00:00
qml: simplify description list in VideoInfoExpandList

- - - - -


1 changed file:

- modules/gui/qt/medialibrary/qml/VideoInfoExpandPanel.qml


Changes:

=====================================
modules/gui/qt/medialibrary/qml/VideoInfoExpandPanel.qml
=====================================
@@ -218,6 +218,8 @@ FocusScope {
                     text: root._showMoreInfo ? qsTr("View Less") : qsTr("View More")
                     iconTxt: VLCIcons.expand
                     iconRotation: root._showMoreInfo ? -180 : 0
+                    visible: (root.model.audioDesc?.length > 0)
+                             || (root.model.videoDesc?.length > 0)
 
                     Behavior on iconRotation {
                         NumberAnimation {
@@ -249,91 +251,75 @@ FocusScope {
                         }
                     }
 
-                    Repeater {
-                        model: [
-                            {
-                                "title": qsTr("Video track"),
-                                "model": videoDescModel
-                            },
-                            {
-                                "title": qsTr("Audio track"),
-                                "model": audioDescModel
-                            }
-                        ]
+                    DescriptionList {
+                        title: qsTr("Video track")
 
-                        delegate: Column {
-                            visible: delgateRepeater.count > 0
+                        sourceModel: root.model.videoDesc
 
-                            Widgets.MenuCaption {
-                                text: modelData.title
-                                color: theme.fg.secondary
-                                font.bold: true
-                                bottomPadding: VLCStyle.margin_small
-                            }
+                        delegateModel:  [
+                            {text: qsTr("Codec:"), role: "codec" },
+                            {text: qsTr("Language:"), role: "language" },
+                            {text: qsTr("FPS:"), role: "fps" }
+                        ]
+                    }
 
-                            Repeater {
-                                id: delgateRepeater
+                    DescriptionList {
+                        title: qsTr("Audio track")
 
-                                model: modelData.model
-                            }
-                        }
+                        sourceModel: root.model.videoDesc
+
+                        delegateModel:  [
+                            {text: qsTr("Codec:"), role: "codec" },
+                            {text: qsTr("Language:"), role: "language" },
+                            {text: qsTr("Channel:"), role: "nbchannels" }
+                        ]
                     }
                 }
             }
         }
     }
 
-    ObjectModel {
-        id: videoDescModel
+    component DescriptionList : Column {
+        id: column
 
-        Repeater {
-            model: root.model.videoDesc
+        property alias title: titleTxt.text
 
-            // TODO: use inline Component for Qt > 5.14
-            delegate: Repeater {
-                id: videoDescRepeaterDelegate
+        property alias sourceModel: sourceRepeater.model
 
-                readonly property bool isFirst: (index === 0)
+        // [["caption": <str>, "role": <str>].,.]
+        property var delegateModel
 
-                model: [
-                    {text: qsTr("Codec:"), data: modelData.codec },
-                    {text: qsTr("Language:"), data: modelData.language },
-                    {text: qsTr("FPS:"), data: modelData.fps }
-                ]
+        Widgets.MenuCaption {
+            id: titleTxt
 
-                delegate: Widgets.MenuCaption {
-                    topPadding: (!videoDescRepeaterDelegate.isFirst) && (index === 0) ? VLCStyle.margin_small : 0
-                    text: modelData.text + " " + modelData.data
-                    color: theme.fg.secondary
-                    bottomPadding: VLCStyle.margin_xsmall
-                }
-            }
+            color: theme.fg.secondary
+            font.bold: true
+            bottomPadding: VLCStyle.margin_small
         }
-    }
-
-    ObjectModel {
-        id: audioDescModel
 
-        // TODO: use inline Component for Qt > 5.14
         Repeater {
-            model: root.model.audioDesc
+            id: sourceRepeater
 
             delegate: Repeater {
-                id: audioDescRepeaterDelegate
+                id: delegateRepeater
 
-                readonly property bool isFirst: (index === 0)
+                model: column.delegateModel
 
-                model: [
-                    {text: qsTr("Codec:"), data: modelData.codec },
-                    {text: qsTr("Language:"), data: modelData.language },
-                    {text: qsTr("Channel:"), data: modelData.nbchannels }
-                ]
+                required property var modelData
+                required property int index
+                readonly property bool isFirst: (index === 0)
 
                 delegate: Widgets.MenuCaption {
-                    topPadding: (!audioDescRepeaterDelegate.isFirst) && (index === 0) ? VLCStyle.margin_small : 0
-                    text: modelData.text + " " + modelData.data
-                    bottomPadding: VLCStyle.margin_xsmall
+                    required property var modelData
+                    required property int index
+
+                    property string description: delegateRepeater.modelData[modelData.role] ?? ""
+
+                    visible: !!description
+                    text: modelData.text + " " + description
+                    topPadding: (!delegateRepeater.isFirst) && (index === 0) ? VLCStyle.margin_small : 0
                     color: theme.fg.secondary
+                    bottomPadding: VLCStyle.margin_xsmall
                 }
             }
         }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3325767f19267ed77afe84af1e63ed4cb3dd5acd...fe8ac5c4fa5708e4a0885cc23c545cf3310317f4

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3325767f19267ed77afe84af1e63ed4cb3dd5acd...fe8ac5c4fa5708e4a0885cc23c545cf3310317f4
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list