[vlc-commits] qml: Create PlaylistMedia

Benjamin Arnaud git at videolan.org
Tue Feb 23 08:54:18 UTC 2021


vlc | branch: master | Benjamin Arnaud <benjamin.arnaud at videolabs.io> | Fri Feb 19 11:25:36 2021 +0100| [9e5d70e99756e2c212cb1f86929699ca926b11ea] | committer: Pierre Lamot

qml: Create PlaylistMedia

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

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

 modules/gui/qt/Makefile.am                        |  1 +
 modules/gui/qt/medialibrary/qml/PlaylistMedia.qml | 98 +++++++++++++++++++++++
 modules/gui/qt/vlc.qrc                            |  1 +
 po/POTFILES.in                                    |  1 +
 4 files changed, 101 insertions(+)

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 9a313611a7..cebb02f019 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -667,6 +667,7 @@ libqt_plugin_la_QML = \
 	gui/qt/medialibrary/qml/VideoAll.qml \
 	gui/qt/medialibrary/qml/VideoAllDisplay.qml \
 	gui/qt/medialibrary/qml/PlaylistMediaList.qml \
+	gui/qt/medialibrary/qml/PlaylistMedia.qml \
 	gui/qt/medialibrary/qml/VideoDisplayRecentVideos.qml \
 	gui/qt/medialibrary/qml/VideoGridItem.qml \
 	gui/qt/medialibrary/qml/VideoInfoExpandPanel.qml \
diff --git a/modules/gui/qt/medialibrary/qml/PlaylistMedia.qml b/modules/gui/qt/medialibrary/qml/PlaylistMedia.qml
new file mode 100644
index 0000000000..f5139786b4
--- /dev/null
+++ b/modules/gui/qt/medialibrary/qml/PlaylistMedia.qml
@@ -0,0 +1,98 @@
+/*****************************************************************************
+ * Copyright (C) 2021 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 QtQml.Models     2.2
+
+import org.videolan.medialib 0.1
+
+import "qrc:///widgets/" as Widgets
+import "qrc:///main/"    as MainInterface
+import "qrc:///style/"
+
+MainInterface.MainTableView {
+    id: playlistDisplay
+
+    //---------------------------------------------------------------------------------------------
+    // Properties
+    //---------------------------------------------------------------------------------------------
+
+    readonly property int columns: VLCStyle.gridColumnsForWidth(playlistDisplay.availableRowWidth)
+
+    //---------------------------------------------------------------------------------------------
+    // Settings
+    //---------------------------------------------------------------------------------------------
+
+    rowHeight: VLCStyle.tableCoverRow_height
+
+    headerColor: VLCStyle.colors.bg
+
+    sortModel: [{
+        criteria: "thumbnail",
+
+        width: VLCStyle.colWidth(1),
+
+        type: "image",
+
+        headerDelegate: table.titleHeaderDelegate,
+        colDelegate   : table.titleDelegate
+    }, {
+        isPrimary: true,
+
+        criteria: "title",
+
+        width: VLCStyle.colWidth(Math.max(columns - 2, 1)),
+
+        text: i18n.qtr("Title")
+    }, {
+        criteria: "duration_short",
+
+        width: VLCStyle.colWidth(1),
+
+        headerDelegate: table.timeHeaderDelegate,
+        colDelegate   : table.timeColDelegate
+    }]
+
+    //---------------------------------------------------------------------------------------------
+    // Events
+    //---------------------------------------------------------------------------------------------
+
+    onActionForSelection: medialib.addAndPlay(model.getIdsForIndexes(selection))
+
+    //---------------------------------------------------------------------------------------------
+    // Childs
+    //---------------------------------------------------------------------------------------------
+
+    Widgets.TableColumns {
+        id: table
+
+        titleCover_width : VLCStyle.listAlbumCover_width
+        titleCover_height: VLCStyle.listAlbumCover_height
+        titleCover_radius: VLCStyle.listAlbumCover_radius
+
+        showTitleText: false
+
+        function titlecoverLabels(model) {
+            return [
+                (model) ? model.resolution_name : "",
+                (model) ? model.channel         : ""
+            ].filter(function(a) { return a !== "" })
+        }
+    }
+}
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index e211c8e3da..dbc9dec717 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -273,6 +273,7 @@
         <file alias="VideoAll.qml">medialibrary/qml/VideoAll.qml</file>
         <file alias="VideoAllDisplay.qml">medialibrary/qml/VideoAllDisplay.qml</file>
         <file alias="PlaylistMediaList.qml">medialibrary/qml/PlaylistMediaList.qml</file>
+        <file alias="PlaylistMedia.qml">medialibrary/qml/PlaylistMedia.qml</file>
         <file alias="MusicAlbumsDisplay.qml">medialibrary/qml/MusicAlbumsDisplay.qml</file>
         <file alias="MusicAlbumsGridExpandDelegate.qml">medialibrary/qml/MusicAlbumsGridExpandDelegate.qml</file>
         <file alias="MusicArtist.qml">medialibrary/qml/MusicArtist.qml</file>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4c15ca20e1..cf159d1ae3 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -829,6 +829,7 @@ modules/gui/qt/medialibrary/qml/VideoListDisplay.qml
 modules/gui/qt/medialibrary/qml/VideoAll.qml
 modules/gui/qt/medialibrary/qml/VideoAllDisplay.qml
 modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
+modules/gui/qt/medialibrary/qml/PlaylistMedia.qml
 modules/gui/qt/menus/qml/Menubar.qml
 modules/gui/qt/network/qml/DiscoverDisplay.qml
 modules/gui/qt/network/qml/DiscoverUrlDisplay.qml



More information about the vlc-commits mailing list