[vlc-devel] [PATCH 14/17] qml: introduce MediaCover widget

Prince Gupta guptaprince8832 at gmail.com
Fri Jun 19 16:06:27 CEST 2020


can be used to display image covers with play icons
---
 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(+)
 create mode 100644 modules/gui/qt/widgets/qml/MediaCover.qml

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index f804bcbd6a..1a9187ac2f 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -666,6 +666,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()
+    }
+}
-- 
2.25.1



More information about the vlc-devel mailing list