Warning, /plasma-bigscreen/youtube-voice-application/ui/+mediacenter/CategoryBoxHomeView.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * Copyright 2018 by Aditya Mehra <aix.m@outlook.com> 0003 * 0004 * This program is free software: you can redistribute it and/or modify 0005 * it under the terms of the GNU General Public License as published by 0006 * the Free Software Foundation, either version 3 of the License, or 0007 * (at your option) any later version. 0008 0009 * This program is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 * GNU General Public License for more details. 0013 0014 * You should have received a copy of the GNU General Public License 0015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0016 */ 0017 0018 import QtQuick 2.9 0019 import QtQuick.Layouts 1.4 0020 import QtGraphicalEffects 1.0 0021 import QtQuick.Controls 2.3 0022 import org.kde.kirigami 2.8 as Kirigami 0023 import org.kde.plasma.core 2.0 as PlasmaCore 0024 import org.kde.plasma.components 3.0 as PlasmaComponents3 0025 import org.kde.plasma.components 2.0 as PlasmaComponents 0026 import Mycroft 1.0 as Mycroft 0027 import org.kde.mycroft.bigscreen 1.0 as BigScreen 0028 import "+mediacenter/views" as Views 0029 import "+mediacenter/delegates" as Delegates 0030 0031 Item { 0032 property var recentHomeModel: sessionData.recentHomeListBlob.recentList 0033 property var historyListModel: sessionData.recentListBlob.recentList 0034 property var newsListModel: sessionData.newsListBlob.videoList 0035 property var musicListModel: sessionData.musicListBlob.videoList 0036 property var techListModel: sessionData.techListBlob.videoList 0037 property var polListModel: sessionData.polListBlob.videoList 0038 property var gamingListModel: sessionData.gamingListBlob.videoList 0039 property var searchListModel: sessionData.searchListBlob.videoList 0040 property var trendListModel: sessionData.trendListBlob.videoList 0041 Layout.fillWidth: true 0042 Layout.fillHeight: true 0043 0044 onFocusChanged: { 0045 if(focus && recentListView.visible){ 0046 recentListView.forceActiveFocus() 0047 } else if (focus && !recentListView.visible) { 0048 trendListView.forceActiveFocus() 0049 } 0050 } 0051 0052 onNewsListModelChanged: { 0053 newsListView.view.forceLayout() 0054 } 0055 onMusicListModelChanged: { 0056 musicListView.view.forceLayout() 0057 } 0058 onTechListModelChanged: { 0059 techListView.view.forceLayout() 0060 } 0061 onPolListModelChanged: { 0062 polListView.view.forceLayout() 0063 } 0064 onGamingListModelChanged: { 0065 gamingListView.view.forceLayout() 0066 } 0067 onRecentHomeModelChanged: { 0068 recentListView.view.forceLayout() 0069 } 0070 onTrendListModelChanged: { 0071 trendListView.view.forceLayout() 0072 } 0073 0074 ColumnLayout { 0075 id: contentLayout 0076 anchors { 0077 left: parent.left 0078 right: parent.right 0079 margins: Kirigami.Units.largeSpacing * 3 0080 } 0081 property Item currentSection 0082 readonly property int rowHeight: recentListView.cellWidth / 1.8 + Kirigami.Units.gridUnit * 7 0083 y: currentSection ? -currentSection.y : 0 0084 0085 Behavior on y { 0086 NumberAnimation { 0087 duration: Kirigami.Units.longDuration * 2 0088 easing.type: Easing.InOutQuad 0089 } 0090 } 0091 0092 spacing: Kirigami.Units.largeSpacing * 4 0093 0094 BigScreen.TileView { 0095 id: recentListView 0096 focus: true 0097 model: recentHomeModel 0098 title: "Recently Watched" 0099 cellWidth: parent.width / 4 0100 delegate: Delegates.ListVideoCard{} 0101 visible: recentListView.view.count > 0 ? 1 : 0 0102 onActiveFocusChanged: { 0103 if(activeFocus){ 0104 contentLayout.currentSection = recentListView 0105 } 0106 } 0107 0108 implicitHeight: contentLayout.rowHeight 0109 navigationUp: homeCatButton 0110 navigationDown: trendListView 0111 } 0112 0113 BigScreen.TileView { 0114 id: trendListView 0115 focus: false 0116 model: trendListModel 0117 title: "Trending" 0118 cellWidth: parent.width / 4 0119 delegate: Delegates.ListVideoCard{} 0120 onActiveFocusChanged: { 0121 if(activeFocus){ 0122 contentLayout.currentSection = trendListView 0123 } 0124 } 0125 0126 implicitHeight: contentLayout.rowHeight 0127 navigationUp: recentListView.visible ? recentListView : homeCatButton 0128 navigationDown: newsListView 0129 } 0130 0131 BigScreen.TileView { 0132 id: newsListView 0133 focus: false 0134 model: newsListModel 0135 title: "News" 0136 cellWidth: parent.width / 4 0137 delegate: Delegates.ListVideoCard{} 0138 onActiveFocusChanged: { 0139 if(activeFocus){ 0140 contentLayout.currentSection = newsListView 0141 } 0142 } 0143 0144 implicitHeight: contentLayout.rowHeight 0145 navigationUp: trendListView 0146 navigationDown: musicListView 0147 } 0148 0149 BigScreen.TileView { 0150 id: musicListView 0151 focus: false 0152 model: musicListModel 0153 title: "Music" 0154 cellWidth: parent.width / 4 0155 delegate: Delegates.ListVideoCard{} 0156 onActiveFocusChanged: { 0157 if(activeFocus){ 0158 contentLayout.currentSection = musicListView 0159 } 0160 } 0161 0162 implicitHeight: contentLayout.rowHeight 0163 navigationUp: newsListView 0164 navigationDown: techListView 0165 } 0166 0167 BigScreen.TileView { 0168 id: techListView 0169 focus: false 0170 model: techListModel 0171 title: "Technology" 0172 cellWidth: parent.width / 4 0173 delegate: Delegates.ListVideoCard{} 0174 onActiveFocusChanged: { 0175 if(activeFocus){ 0176 contentLayout.currentSection = techListView 0177 } 0178 } 0179 0180 implicitHeight: contentLayout.rowHeight 0181 navigationUp: musicListView 0182 navigationDown: polListView 0183 } 0184 0185 BigScreen.TileView { 0186 id: polListView 0187 focus: false 0188 model: polListModel 0189 title: "Politics" 0190 cellWidth: parent.width / 4 0191 delegate: Delegates.ListVideoCard{} 0192 onActiveFocusChanged: { 0193 if(activeFocus){ 0194 contentLayout.currentSection = polListView 0195 } 0196 } 0197 0198 implicitHeight: contentLayout.rowHeight 0199 navigationUp: techListView 0200 navigationDown: gamingListView 0201 } 0202 0203 BigScreen.TileView { 0204 id: gamingListView 0205 focus: false 0206 model: gamingListModel 0207 title: "Gaming" 0208 cellWidth: parent.width / 4 0209 delegate: Delegates.ListVideoCard{} 0210 onActiveFocusChanged: { 0211 if(activeFocus){ 0212 contentLayout.currentSection = gamingListView 0213 } 0214 } 0215 0216 implicitHeight: contentLayout.rowHeight 0217 navigationUp: polListView 0218 navigationDown: recentListView.visible ? recentListView : trendListView 0219 } 0220 } 0221 }