[vlc-devel] [PATCH 14/17] qml: Create VideoPlaylistsDisplay
Benjamin Arnaud
benjamin.arnaud at videolabs.io
Fri Feb 19 10:25:38 UTC 2021
---
modules/gui/qt/Makefile.am | 1 +
.../qml/VideoPlaylistsDisplay.qml | 115 ++++++++++++++++++
modules/gui/qt/vlc.qrc | 1 +
po/POTFILES.in | 1 +
4 files changed, 118 insertions(+)
create mode 100644 modules/gui/qt/medialibrary/qml/VideoPlaylistsDisplay.qml
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 1b9909bf18..1869d8adb4 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -669,6 +669,7 @@ libqt_plugin_la_QML = \
gui/qt/medialibrary/qml/PlaylistMediaList.qml \
gui/qt/medialibrary/qml/PlaylistMedia.qml \
gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml \
+ gui/qt/medialibrary/qml/VideoPlaylistsDisplay.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/VideoPlaylistsDisplay.qml b/modules/gui/qt/medialibrary/qml/VideoPlaylistsDisplay.qml
new file mode 100644
index 0000000000..f453b3ea15
--- /dev/null
+++ b/modules/gui/qt/medialibrary/qml/VideoPlaylistsDisplay.qml
@@ -0,0 +1,115 @@
+/*****************************************************************************
+ * 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 QtQuick.Controls 2.4
+import QtQuick.Layouts 1.3
+import QtQml.Models 2.2
+
+import org.videolan.medialib 0.1
+
+import "qrc:///widgets/" as Widgets
+import "qrc:///style/"
+
+Widgets.PageLoader {
+ id: root
+
+ //---------------------------------------------------------------------------------------------
+ // Aliases
+ //---------------------------------------------------------------------------------------------
+
+ property bool isViewMultiView: true
+
+ property variant model
+ property variant sortModel
+
+ //---------------------------------------------------------------------------------------------
+ // Settings
+ //---------------------------------------------------------------------------------------------
+
+ defaultPage: "all"
+
+ pageModel: [{
+ name: "all",
+ component: componentAll
+ }, {
+ name: "list",
+ component: componentList
+ }]
+
+ //---------------------------------------------------------------------------------------------
+ // Events
+ //---------------------------------------------------------------------------------------------
+
+ onCurrentItemChanged: {
+ model = currentItem.model;
+ sortModel = currentItem.sortModel;
+
+ isViewMultiView = (currentItem.isViewMultiView === undefined
+ ||
+ currentItem.isViewMultiView);
+ }
+
+ //---------------------------------------------------------------------------------------------
+ // Functions
+ //---------------------------------------------------------------------------------------------
+ // Private
+
+ function _updateHistoryList(index) {
+ history.update(["mc", "video", "playlists", "all", { "initialIndex": index }]);
+ }
+
+ function _updateHistoryPlaylist(playlist) {
+ history.update(["mc", "video", "playlists", "list", {
+ "initialIndex": playlist.currentIndex,
+ "initialId" : playlist.parentId,
+ "initialName" : playlist.name
+ }]);
+ }
+
+ //---------------------------------------------------------------------------------------------
+ // Childs
+ //---------------------------------------------------------------------------------------------
+
+ Component {
+ id: componentAll
+
+ PlaylistMediaList {
+ anchors.fill: parent
+
+ onCurrentIndexChanged: _updateHistoryList(currentIndex)
+
+ onShowList: history.push(["mc", "video", "playlists", "list",
+ { parentId: model.id, name: model.name }])
+ }
+ }
+
+ Component {
+ id: componentList
+
+ PlaylistMediaDisplay {
+ id: playlist
+
+ anchors.fill: parent
+
+ onCurrentIndexChanged: _updateHistoryPlaylist(playlist)
+ onParentIdChanged : _updateHistoryPlaylist(playlist)
+ onNameChanged : _updateHistoryPlaylist(playlist)
+ }
+ }
+}
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index d0f705191e..006f6b89a4 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -275,6 +275,7 @@
<file alias="PlaylistMediaList.qml">medialibrary/qml/PlaylistMediaList.qml</file>
<file alias="PlaylistMedia.qml">medialibrary/qml/PlaylistMedia.qml</file>
<file alias="PlaylistMediaDisplay.qml">medialibrary/qml/PlaylistMediaDisplay.qml</file>
+ <file alias="VideoPlaylistsDisplay.qml">medialibrary/qml/VideoPlaylistsDisplay.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 bf6a78a9f8..1d21a038c9 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -831,6 +831,7 @@ modules/gui/qt/medialibrary/qml/VideoAllDisplay.qml
modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
modules/gui/qt/medialibrary/qml/PlaylistMedia.qml
modules/gui/qt/medialibrary/qml/PlaylistMediaDisplay.qml
+modules/gui/qt/medialibrary/qml/VideoPlaylistsDisplay.qml
modules/gui/qt/menus/qml/Menubar.qml
modules/gui/qt/network/qml/DiscoverDisplay.qml
modules/gui/qt/network/qml/DiscoverUrlDisplay.qml
--
2.25.1
More information about the vlc-devel
mailing list