[vlc-commits] qml: Create VideoPlaylistsDisplay
Benjamin Arnaud
git at videolan.org
Tue Feb 23 08:54:21 UTC 2021
vlc | branch: master | Benjamin Arnaud <benjamin.arnaud at videolabs.io> | Fri Feb 19 11:25:38 2021 +0100| [327226c4edb20d629508c2a783f71b291681c6bf] | committer: Pierre Lamot
qml: Create VideoPlaylistsDisplay
Signed-off-by: Pierre Lamot <pierre at videolabs.io>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=327226c4edb20d629508c2a783f71b291681c6bf
---
modules/gui/qt/Makefile.am | 1 +
.../qt/medialibrary/qml/VideoPlaylistsDisplay.qml | 115 +++++++++++++++++++++
modules/gui/qt/vlc.qrc | 1 +
po/POTFILES.in | 1 +
4 files changed, 118 insertions(+)
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
More information about the vlc-commits
mailing list