qml: split VideoDisplay content in VideoAllDisplay and VideoList
[vlc.git] / modules / gui / qt / medialibrary / qml / VideoAllDisplay.qml
blobe2f56759701e61599c0bbfff35b3f0f1912ca0e4
1 /*****************************************************************************
2  * Copyright (C) 2021 VLC authors and VideoLAN
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * ( at your option ) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
17  *****************************************************************************/
19 import QtQuick          2.11
20 import QtQuick.Controls 2.4
21 import QtQuick.Layouts  1.3
22 import QtQml.Models     2.2
24 import org.videolan.medialib 0.1
26 import "qrc:///widgets/" as Widgets
27 import "qrc:///main/"    as MainInterface
28 import "qrc:///util/"    as Util
29 import "qrc:///style/"
31 VideoAll {
32     id: root
34     //---------------------------------------------------------------------------------------------
35     // Events
36     //---------------------------------------------------------------------------------------------
38     onCurrentIndexChanged: {
39         history.update([ "mc", "video", { "initialIndex": currentIndex }])
40     }
42     //---------------------------------------------------------------------------------------------
43     // Settings
44     //---------------------------------------------------------------------------------------------
46     MLRecentsVideoModel {
47         id: modelRecent
49         ml: medialib
50     }
52     header: Column {
53         property Item focusItem: loader.item.focusItem
55         width: root.width
57         topPadding: VLCStyle.margin_normal
59         spacing: VLCStyle.margin_normal
61         Loader {
62             id: loader
64             width: parent.width
66             height: item.implicitHeight
68             active: (modelRecent.count)
70             visible: active
72             focus: true
74             sourceComponent: VideoDisplayRecentVideos {
75                 id: component
77                 width: parent.width
79                 model: modelRecent
81                 focus: true
83                 navigationParent: root
85                 navigationDown: function() {
86                     component.focus = false;
88                     currentItem.setCurrentItemFocus();
89                 }
90             }
91         }
93         Widgets.SubtitleLabel {
94             width: root.width
96             leftPadding  : VLCStyle.margin_xlarge
97             bottomPadding: VLCStyle.margin_xsmall
99             text: i18n.qtr("Videos")
100         }
101     }