1
mirror of https://code.videolan.org/videolan/vlc synced 2024-08-27 04:21:53 +02:00

qml: Create MusicPlaylistsDisplay

Signed-off-by: Pierre Lamot <pierre@videolabs.io>
This commit is contained in:
Benjamin Arnaud 2021-02-19 11:25:40 +01:00 committed by Pierre Lamot
parent be03295aca
commit fc3e927d00
4 changed files with 118 additions and 0 deletions

View File

@ -660,6 +660,7 @@ libqt_plugin_la_QML = \
gui/qt/medialibrary/qml/MusicDisplay.qml \
gui/qt/medialibrary/qml/MusicGenres.qml \
gui/qt/medialibrary/qml/MusicGenresDisplay.qml \
gui/qt/medialibrary/qml/MusicPlaylistsDisplay.qml \
gui/qt/medialibrary/qml/MusicTrackListDisplay.qml \
gui/qt/medialibrary/qml/MusicTracksDisplay.qml \
gui/qt/medialibrary/qml/UrlListDisplay.qml \

View File

@ -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", "music", "playlists", "all", { "initialIndex": index }]);
}
function _updateHistoryPlaylist(playlist) {
history.update(["mc", "music", "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", "music", "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)
}
}
}

View File

@ -282,6 +282,7 @@
<file alias="MusicArtistsAlbums.qml">medialibrary/qml/MusicArtistsAlbums.qml</file>
<file alias="MusicArtistsDisplay.qml">medialibrary/qml/MusicArtistsDisplay.qml</file>
<file alias="MusicGenresDisplay.qml">medialibrary/qml/MusicGenresDisplay.qml</file>
<file alias="MusicPlaylistsDisplay.qml">medialibrary/qml/MusicPlaylistsDisplay.qml</file>
<file alias="MusicTracksDisplay.qml">medialibrary/qml/MusicTracksDisplay.qml</file>
<file alias="MusicTrackListDisplay.qml">medialibrary/qml/MusicTrackListDisplay.qml</file>
<file alias="ArtistTopBanner.qml">medialibrary/qml/ArtistTopBanner.qml</file>

View File

@ -818,6 +818,7 @@ modules/gui/qt/medialibrary/qml/MusicArtistsDisplay.qml
modules/gui/qt/medialibrary/qml/MusicDisplay.qml
modules/gui/qt/medialibrary/qml/MusicGenres.qml
modules/gui/qt/medialibrary/qml/MusicGenresDisplay.qml
modules/gui/qt/medialibrary/qml/MusicPlaylistsDisplay.qml
modules/gui/qt/medialibrary/qml/MusicTrackListDisplay.qml
modules/gui/qt/medialibrary/qml/MusicTracksDisplay.qml
modules/gui/qt/medialibrary/qml/UrlListDisplay.qml