[vlc-commits] qml: modularise Video grid item

Pierre Lamot git at videolan.org
Fri Sep 6 18:02:00 CEST 2019


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

qml: modularise Video grid item

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

 modules/gui/qt/Makefile.am                       |  1 +
 modules/gui/qt/qml/mediacenter/VideoGridItem.qml | 39 ++++++++++++++++++++++++
 modules/gui/qt/vlc.qrc                           |  1 +
 3 files changed, 41 insertions(+)

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index bfae436032..88e3d92b33 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -636,6 +636,7 @@ libqt_plugin_la_QML = \
 	gui/qt/qml/mediacenter/NetworkDriveDisplayGrid.qml \
 	gui/qt/qml/mediacenter/NetworkListItem.qml \
 	gui/qt/qml/mediacenter/VideoExpandableGrid.qml \
+	gui/qt/qml/mediacenter/VideoGridItem.qml \
 	gui/qt/qml/playlist/PlaylistListView.qml \
 	gui/qt/qml/playlist/PlaylistMainView.qml \
 	gui/qt/qml/playlist/PLItem.qml \
diff --git a/modules/gui/qt/qml/mediacenter/VideoGridItem.qml b/modules/gui/qt/qml/mediacenter/VideoGridItem.qml
new file mode 100644
index 0000000000..9408491152
--- /dev/null
+++ b/modules/gui/qt/qml/mediacenter/VideoGridItem.qml
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * 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.thumbnail || VLCStyle.noArtCover
+    title: model.title || qsTr("Unknown title")
+    infoLeft: model.duration || ""
+    resolution: model.resolution_name || ""
+    channel: model.channel || ""
+    isVideo: true
+    isNew: model.playcount < 1
+    progress: model.saved_position > 0 ? model.saved_position : 0
+    pictureWidth: VLCStyle.video_normal_width
+    pictureHeight: VLCStyle.video_normal_height
+    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 132b18cdc7..6a54bc89ce 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="VideoGridItem.qml">qml/mediacenter/VideoGridItem.qml</file>
         <file alias="AudioGridItem.qml">qml/mediacenter/AudioGridItem.qml</file>
     </qresource>
     <qresource prefix="/style">



More information about the vlc-commits mailing list