[vlc-commits] qml: introduce MediaCover widget

Prince Gupta git at videolan.org
Wed Jun 24 17:42:03 CEST 2020


vlc | branch: master | Prince Gupta <guptaprince8832 at gmail.com> | Fri Jun 19 16:32:13 2020 +0530| [13ce4ab4d6bcde5d4afae20db9b2e1a796f2174b] | committer: Pierre Lamot

qml: introduce MediaCover widget

can be used to display image covers with play icons

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=13ce4ab4d6bcde5d4afae20db9b2e1a796f2174b
---

 modules/gui/qt/Makefile.am                |  1 +
 modules/gui/qt/vlc.qrc                    |  1 +
 modules/gui/qt/widgets/qml/MediaCover.qml | 83 +++++++++++++++++++++++++++++++
 3 files changed, 85 insertions(+)

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 130afcfdbe..e3c78a3008 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -669,6 +669,7 @@ libqt_plugin_la_QML = \
 	gui/qt/widgets/qml/LabelSeparator.qml \
 	gui/qt/widgets/qml/ListItem.qml \
 	gui/qt/widgets/qml/ListLabel.qml \
+	gui/qt/widgets/qml/MediaCover.qml \
 	gui/qt/widgets/qml/MenuExt.qml \
 	gui/qt/widgets/qml/MenuItemExt.qml \
 	gui/qt/widgets/qml/NavigableCol.qml \
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index 9fbf88ad31..6c12e06b2b 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -215,6 +215,7 @@
         <file alias="IconLabel.qml">widgets/qml/IconLabel.qml</file>
         <file alias="ListLabel.qml">widgets/qml/ListLabel.qml</file>
         <file alias="PlayCover.qml">widgets/qml/PlayCover.qml</file>
+        <file alias="MediaCover.qml">widgets/qml/MediaCover.qml</file>
     </qresource>
     <qresource prefix="/util">
         <file alias="SelectableDelegateModel.qml">util/qml/SelectableDelegateModel.qml</file>
diff --git a/modules/gui/qt/widgets/qml/MediaCover.qml b/modules/gui/qt/widgets/qml/MediaCover.qml
new file mode 100644
index 0000000000..02e97197ee
--- /dev/null
+++ b/modules/gui/qt/widgets/qml/MediaCover.qml
@@ -0,0 +1,83 @@
+
+/*****************************************************************************
+ * Copyright (C) 2020 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * ( at your option ) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+import QtQuick 2.11
+import QtQuick.Controls 2.4
+import QtQuick.Layouts 1.11
+
+import "qrc:///widgets/" as Widgets
+import "qrc:///style/"
+
+Widgets.RoundImage {
+    id: root
+
+    property var labels: []
+    property alias progress: progressBar.value
+    property alias playCoverVisible: playCover.visible
+    property alias playIconSize: playCover.iconSize
+    signal playIconClicked
+
+    height: VLCStyle.listAlbumCover_height
+    width: VLCStyle.listAlbumCover_width
+
+    RowLayout {
+        anchors {
+            top: parent.top
+            left: parent.left
+            right: parent.right
+            topMargin: VLCStyle.margin_xxsmall
+            leftMargin: VLCStyle.margin_xxsmall
+            rightMargin: VLCStyle.margin_xxsmall
+        }
+
+        spacing: VLCStyle.margin_xxsmall
+
+        Repeater {
+            model: labels
+            VideoQualityLabel {
+                Layout.preferredWidth: implicitWidth
+                Layout.preferredHeight: implicitHeight
+                text: modelData
+            }
+        }
+
+        Item {
+            Layout.fillWidth: true
+        }
+    }
+
+    Widgets.VideoProgressBar {
+        id: progressBar
+
+        visible: !playCover.visible && value > 0
+        anchors {
+            bottom: parent.bottom
+            left: parent.left
+            right: parent.right
+        }
+    }
+
+    Widgets.PlayCover {
+        id: playCover
+
+        anchors.fill: parent
+        iconSize: VLCStyle.play_root_small
+
+        onIconClicked: root.playIconClicked()
+    }
+}



More information about the vlc-commits mailing list