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

qml: Create VideoGroupsDisplay

Signed-off-by: Pierre Lamot <pierre@videolabs.io>
This commit is contained in:
Benjamin Arnaud 2021-03-18 10:01:45 +01:00 committed by Pierre Lamot
parent ed036a2ef6
commit 01abb31ed5
5 changed files with 125 additions and 1 deletions

View File

@ -689,6 +689,7 @@ libqt_plugin_la_QML = \
gui/qt/medialibrary/qml/VideoDisplay.qml \
gui/qt/medialibrary/qml/VideoAll.qml \
gui/qt/medialibrary/qml/VideoAllDisplay.qml \
gui/qt/medialibrary/qml/VideoGroupsDisplay.qml \
gui/qt/medialibrary/qml/PlaylistMediaList.qml \
gui/qt/medialibrary/qml/PlaylistMedia.qml \
gui/qt/medialibrary/qml/PlaylistMediaDelegate.qml \

View File

@ -67,7 +67,11 @@ Widgets.PageLoader {
name: "all",
displayText: i18n.qtr("All"),
url: "qrc:///medialibrary/VideoAllDisplay.qml"
}, {
},{
name: "groups",
displayText: i18n.qtr("Groups"),
url: "qrc:///medialibrary/VideoGroupsDisplay.qml"
},{
name: "playlists",
displayText: i18n.qtr("Playlists"),
url: "qrc:///medialibrary/VideoPlaylistsDisplay.qml"

View File

@ -0,0 +1,117 @@
/*****************************************************************************
* Copyright (C) 2021 VLC authors and VideoLAN
*
* Authors: Benjamin Arnaud <bunjee@omega.gg>
*
* 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 _updateHistoryAll(index) {
history.update(["mc", "video", "groups", "all", { "initialIndex": index }]);
}
function _updateHistoryList(list) {
history.update(["mc", "video", "groups", "list", {
"initialIndex": list.currentIndex,
"initialId" : list.parentId,
"initialName" : list.name
}]);
}
//---------------------------------------------------------------------------------------------
// Childs
//---------------------------------------------------------------------------------------------
Component {
id: componentAll
MediaGroupList {
anchors.fill: parent
onCurrentIndexChanged: _updateHistoryAll(currentIndex)
onShowList: history.push(["mc", "video", "groups", "list",
{ parentId: model.id, name: model.name }])
}
}
Component {
id: componentList
MediaGroupDisplay {
id: list
anchors.fill: parent
onCurrentIndexChanged: _updateHistoryList(list)
onParentIdChanged : _updateHistoryList(list)
onNameChanged : _updateHistoryList(list)
}
}
}

View File

@ -279,6 +279,7 @@
<file alias="VideoDisplay.qml">medialibrary/qml/VideoDisplay.qml</file>
<file alias="VideoAll.qml">medialibrary/qml/VideoAll.qml</file>
<file alias="VideoAllDisplay.qml">medialibrary/qml/VideoAllDisplay.qml</file>
<file alias="VideoGroupsDisplay.qml">medialibrary/qml/VideoGroupsDisplay.qml</file>
<file alias="PlaylistMediaList.qml">medialibrary/qml/PlaylistMediaList.qml</file>
<file alias="PlaylistMedia.qml">medialibrary/qml/PlaylistMedia.qml</file>
<file alias="PlaylistMediaDelegate.qml">medialibrary/qml/PlaylistMediaDelegate.qml</file>

View File

@ -840,6 +840,7 @@ modules/gui/qt/medialibrary/qml/VideoInfoExpandPanel.qml
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/VideoGroupsDisplay.qml
modules/gui/qt/medialibrary/qml/PlaylistMediaList.qml
modules/gui/qt/medialibrary/qml/PlaylistMedia.qml
modules/gui/qt/medialibrary/qml/PlaylistMediaDelegate.qml