[vlc-commits] qml: modularise Audio grid item

Pierre Lamot git at videolan.org
Fri Sep 6 18:01:59 CEST 2019


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Tue Aug 27 14:46:04 2019 +0200| [33443c19980651dfddaddbb1b26ed1857341d843] | committer: Jean-Baptiste Kempf

qml: modularise Audio grid item

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

 modules/gui/qt/Makefile.am                       |  1 +
 modules/gui/qt/qml/mediacenter/AudioGridItem.qml | 35 ++++++++++++++++++++++++
 modules/gui/qt/vlc.qrc                           |  1 +
 3 files changed, 37 insertions(+)

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 964acf31d5..bfae436032 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -616,6 +616,7 @@ libqt_plugin_la_QML = \
 	gui/qt/qml/menus/ViewMenu.qml \
 	gui/qt/qml/menus/VideoMenu.qml \
 	gui/qt/qml/mediacenter/ArtistTopBanner.qml \
+	gui/qt/qml/mediacenter/AudioGridItem.qml \
 	gui/qt/qml/mediacenter/MCMainDisplay.qml \
 	gui/qt/qml/mediacenter/MCMusicDisplay.qml \
 	gui/qt/qml/mediacenter/MCVideoDisplay.qml \
diff --git a/modules/gui/qt/qml/mediacenter/AudioGridItem.qml b/modules/gui/qt/qml/mediacenter/AudioGridItem.qml
new file mode 100644
index 0000000000..cfec1c8c70
--- /dev/null
+++ b/modules/gui/qt/qml/mediacenter/AudioGridItem.qml
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * Copyright (C) 2019 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 org.videolan.medialib 0.1
+
+import "qrc:///utils/" as Utils
+import "qrc:///style/"
+
+Utils.GridItem {
+    property var model: ({})
+    image: model.cover || VLCStyle.noArtAlbum
+    title: model.title || qsTr("Unknown title")
+    subtitle: model.main_artist || qsTr("Unknown artist")
+    isVideo: false
+    pictureWidth: VLCStyle.cover_normal
+    pictureHeight: VLCStyle.cover_normal
+    onPlayClicked: if ( model.id !== undefined ) { medialib.addAndPlay( model.id ) }
+    onAddToPlaylistClicked : if ( model.id !== undefined ) { medialib.addToPlaylist( model.id ) }
+}
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index 10cd8247b9..132b18cdc7 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -226,6 +226,7 @@
         <file alias="MCVideoListDisplay.qml">qml/mediacenter/MCVideoListDisplay.qml</file>
         <file alias="NetworkFileDisplayGrid.qml">qml/mediacenter/NetworkFileDisplayGrid.qml</file>
         <file alias="NetworkDriveDisplayGrid.qml">qml/mediacenter/NetworkDriveDisplayGrid.qml</file>
+        <file alias="AudioGridItem.qml">qml/mediacenter/AudioGridItem.qml</file>
     </qresource>
     <qresource prefix="/style">
         <file alias="qmldir">qml/style/qmldir</file>



More information about the vlc-commits mailing list