[vlc-devel] [PATCH 1/9] qml: introduce PlayCover widget

jagannatharjun guptaprince8832 at gmail.com
Fri Jun 5 17:27:17 CEST 2020


From: Prince Gupta <guptaprince8832 at gmail.com>

---
 modules/gui/qt/Makefile.am               |  2 +
 modules/gui/qt/pixmaps/play_button.svg   | 16 +++++++
 modules/gui/qt/vlc.qrc                   |  2 +
 modules/gui/qt/widgets/qml/PlayCover.qml | 54 ++++++++++++++++++++++++
 4 files changed, 74 insertions(+)
 create mode 100644 modules/gui/qt/pixmaps/play_button.svg
 create mode 100644 modules/gui/qt/widgets/qml/PlayCover.qml

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 1fec9a1937..58082e5439 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -449,6 +449,7 @@ libqt_plugin_la_RES = \
 	gui/qt/pixmaps/noart_artist_small.svg \
 	gui/qt/pixmaps/pause.svg \
 	gui/qt/pixmaps/play.svg \
+	gui/qt/pixmaps/play_button.svg \
 	gui/qt/pixmaps/playlist/add.svg \
 	gui/qt/pixmaps/playlist/playlist.svg \
 	gui/qt/pixmaps/playlist/remove.svg \
@@ -670,6 +671,7 @@ libqt_plugin_la_QML = \
 	gui/qt/widgets/qml/NavigableCol.qml \
 	gui/qt/widgets/qml/NavigableFocusScope.qml \
 	gui/qt/widgets/qml/NavigableRow.qml \
+	gui/qt/widgets/qml/PlayCover.qml \
 	gui/qt/widgets/qml/RoundButton.qml \
 	gui/qt/widgets/qml/RoundImage.qml \
 	gui/qt/widgets/qml/ScanProgressBar.qml \
diff --git a/modules/gui/qt/pixmaps/play_button.svg b/modules/gui/qt/pixmaps/play_button.svg
new file mode 100644
index 0000000000..52613d6c94
--- /dev/null
+++ b/modules/gui/qt/pixmaps/play_button.svg
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns="http://www.w3.org/2000/svg"
+   width="48" height="48"
+   viewBox="0 0 48 48"
+   version="1.1"
+   id="svg8">
+  <g transform="translate(0,-186.18266)">
+    <path
+       style="fill:#ffffff;fill-opacity:0.5;stroke:#ffffff;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 24.0009,232.68268 C 11.574837,232.68319 1.5009784,222.61057 1.4999822,210.18456 1.4989847,197.75854 11.571225,187.68432 23.997288,187.68283 c 12.42606,-0.002 22.500726,10.0703 22.50272,22.49812 0,12.42781 -10.073046,22.50122 -22.499108,22.50173 z"/>
+    <path
+       style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:4.0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 19.256804,201.93287 11.99988,8.24988 -11.99988,8.24988 z"/>
+  </g>
+</svg>
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index c2af781674..c349029c81 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -110,6 +110,7 @@
         <file alias="noart_album.svg">pixmaps/noart_album.svg</file>
         <file alias="noart_artist.svg">pixmaps/noart_artist.svg</file>
         <file alias="noart_artist_small.svg">pixmaps/noart_artist_small.svg</file>
+        <file alias="play_button.svg">pixmaps/play_button.svg</file>
     </qresource>
     <qresource prefix="/prefsmenu">
         <file alias="cone_audio_64.png">pixmaps/prefs/spref_cone_Audio_64.png</file>
@@ -212,6 +213,7 @@
         <file alias="CaptionLabel.qml">widgets/qml/CaptionLabel.qml</file>
         <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>
     </qresource>
     <qresource prefix="/util">
         <file alias="SelectableDelegateModel.qml">util/qml/SelectableDelegateModel.qml</file>
diff --git a/modules/gui/qt/widgets/qml/PlayCover.qml b/modules/gui/qt/widgets/qml/PlayCover.qml
new file mode 100644
index 0000000000..0e3573351a
--- /dev/null
+++ b/modules/gui/qt/widgets/qml/PlayCover.qml
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * 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 "qrc:///style/"
+
+Rectangle {
+    id: root
+
+    property alias iconSize: cover.width
+    signal iconClicked()
+
+    border.color: VLCStyle.colors.accent
+    border.width: VLCStyle.table_cover_border
+
+    opacity: visible ? 1 : 0
+
+    gradient: Gradient {
+        GradientStop { position: 0.0; color: Qt.rgba(0, 0, 0, .5) }
+        GradientStop { position: 1.0; color: Qt.rgba(0, 0, 0, .7) }
+    }
+
+    Behavior on opacity {
+        NumberAnimation { duration: 150; easing.type: Easing.OutQuad }
+    }
+
+    Image {
+        id: cover
+
+        anchors.centerIn: parent
+        fillMode: Image.PreserveAspectFit
+        source: "qrc:/play_button.svg"
+
+        MouseArea {
+            anchors.fill: parent
+            onClicked: root.iconClicked()
+        }
+    }
+}
-- 
2.25.1



More information about the vlc-devel mailing list