Warning, /plasma-bigscreen/peertube-voice-application/ui/+mediacenter/PeerTubeHomePage.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * Copyright 2018 by Aditya Mehra <aix.m@outlook.com> 0003 * Copyright 2018 Marco Martin <mart@kde.org> 0004 * 0005 * This program is free software: you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 3 of the License, or 0008 * (at your option) any later version. 0009 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0017 */ 0018 0019 import QtQuick 2.9 0020 import QtQuick.Layouts 1.4 0021 import QtGraphicalEffects 1.0 0022 import QtQuick.Controls 2.3 0023 import org.kde.kirigami 2.8 as Kirigami 0024 import org.kde.plasma.core 2.0 as PlasmaCore 0025 import org.kde.plasma.components 3.0 as PlasmaComponents3 0026 import org.kde.plasma.components 2.0 as PlasmaComponents 0027 import Mycroft 1.0 as Mycroft 0028 import "+mediacenter/views" as Views 0029 import "+mediacenter/delegates" as Delegates 0030 0031 Mycroft.Delegate { 0032 id: delegate 0033 property var newsListModel: sessionData.news_category_list.data 0034 property var musicListModel: sessionData.music_category_list.data 0035 property var techListModel: sessionData.technology_category_list.data 0036 property var polListModel: sessionData.entertainment_category_list.data 0037 property var gamingListModel: sessionData.gaming_category_list.data 0038 property var searchListModel: "" 0039 property var historyListModel: "" 0040 property bool searchComplete: true 0041 property bool busyIndicate: false 0042 property var searchQuery 0043 readonly property bool delegateMiniMode: delegate.width <= 1200 ? 1 : 0 0044 0045 fillWidth: true 0046 0047 leftPadding: 0 0048 rightPadding: 0 0049 topPadding: 0 0050 bottomPadding: 0 0051 0052 skillBackgroundSource: sessionData.bgImage ? "https://source.unsplash.com/weekly?" + sessionData.bgImage : "https://source.unsplash.com/weekly?music" 0053 0054 Connections { 0055 target: Mycroft.MycroftController 0056 onIntentRecevied: { 0057 if(type == "speak") { 0058 busyIndicatorPop.close() 0059 busyIndicate = false 0060 } 0061 } 0062 } 0063 0064 onNewsListModelChanged: { 0065 newsCatView.model = newsListModel 0066 console.log(newsListModel) 0067 } 0068 0069 onMusicListModelChanged: { 0070 musicCatView.model = musicListModel 0071 } 0072 0073 onTechListModelChanged: { 0074 techCatView.model = techListModel 0075 } 0076 0077 onPolListModelChanged: { 0078 polCatView.model = polListModel 0079 } 0080 0081 onGamingListModelChanged: { 0082 gamingCatView.model = gamingListModel 0083 } 0084 0085 onSearchListModelChanged: { 0086 searchCatView.model = searchListModel 0087 console.log("SearchListModelChanged") 0088 busyIndicatorPop.close() 0089 } 0090 0091 onSearchCompleteChanged: { 0092 busyIndicatorPop.close() 0093 } 0094 0095 onFocusChanged: { 0096 busyIndicatorPop.close() 0097 busyIndicate = false 0098 if(delegate.focus){ 0099 console.log("focus is here") 0100 } 0101 } 0102 0103 Keys.onBackPressed: { 0104 parent.parent.parent.currentIndex++ 0105 parent.parent.parent.currentItem.contentItem.forceActiveFocus() 0106 } 0107 0108 ColumnLayout { 0109 id: colLay1 0110 anchors.fill: parent 0111 0112 Rectangle { 0113 color: Qt.rgba(0, 0, 0, 0.8) 0114 Layout.fillWidth: true 0115 Layout.preferredHeight: Kirigami.Units.gridUnit * 3 0116 Layout.maximumHeight: Kirigami.Units.gridUnit * 4 0117 z: 100 0118 0119 RowLayout { 0120 id: categoryRepeater 0121 anchors { 0122 left: parent.left 0123 right: parent.right 0124 top: parent.top 0125 bottom: parent.bottom 0126 } 0127 anchors.leftMargin: Kirigami.Units.gridUnit 0128 anchors.rightMargin: Kirigami.Units.gridUnit 0129 0130 Item { 0131 Layout.preferredWidth: Kirigami.Units.gridUnit * 6 0132 Layout.preferredHeight: Kirigami.Units.gridUnit * 2 0133 Layout.alignment: Qt.AlignLeft 0134 Layout.rightMargin: Kirigami.Units.gridUnit 0135 enabled: !delegateMiniMode 0136 visible: !delegateMiniMode 0137 0138 Image { 0139 source: "./images/peertube-top-dark.png" 0140 anchors.fill: parent 0141 fillMode: Image.PreserveAspectFit 0142 } 0143 } 0144 0145 TopBarTabButton { 0146 id: homeCatButton 0147 KeyNavigation.right: musicCatButton 0148 KeyNavigation.down: categoryLayout 0149 checked: categoryLayout.currentIndex == 0 0150 text: "News" 0151 minMode: delegateMiniMode 0152 imageSource: "./images/news.png" 0153 onClicked: { 0154 categoryLayout.currentIndex = 0 0155 } 0156 } 0157 0158 TopBarTabButton { 0159 id: musicCatButton 0160 KeyNavigation.right: techCatButton 0161 KeyNavigation.left: newsCatButton 0162 KeyNavigation.down: categoryLayout 0163 checked: categoryLayout.currentIndex == 1 0164 text: "Music" 0165 minMode: delegateMiniMode 0166 imageSource: "./images/music.png" 0167 onClicked: { 0168 categoryLayout.currentIndex = 1 0169 } 0170 } 0171 0172 TopBarTabButton { 0173 id: techCatButton 0174 KeyNavigation.right: polCatButton 0175 KeyNavigation.left: musicCatButton 0176 KeyNavigation.down: categoryLayout 0177 checked: categoryLayout.currentIndex == 2 0178 text: "Technology" 0179 minMode: delegateMiniMode 0180 imageSource: "./images/technology.png" 0181 onClicked: { 0182 categoryLayout.currentIndex = 2 0183 } 0184 } 0185 0186 TopBarTabButton { 0187 id: entertainmentCatButton 0188 KeyNavigation.right: gamingCatButton 0189 KeyNavigation.left: techCatButton 0190 KeyNavigation.down: categoryLayout 0191 checked: categoryLayout.currentIndex == 3 0192 text: "Entertainment" 0193 minMode: delegateMiniMode 0194 imageSource: "./images/entertainment.png" 0195 onClicked: { 0196 categoryLayout.currentIndex = 3 0197 } 0198 } 0199 0200 TopBarTabButton { 0201 id: gamingCatButton 0202 KeyNavigation.left: polCatButton 0203 KeyNavigation.right: searchCatButton 0204 KeyNavigation.down: categoryLayout 0205 checked: categoryLayout.currentIndex == 4 0206 text: "Gaming" 0207 minMode: delegateMiniMode 0208 imageSource: "./images/gaming.png" 0209 onClicked: { 0210 categoryLayout.currentIndex = 4 0211 } 0212 } 0213 0214 TopBarTabButton { 0215 id: searchCatButton 0216 KeyNavigation.left: gamingCatButton 0217 KeyNavigation.down: categoryLayout 0218 checked: categoryLayout.currentIndex == 5 0219 text: "Search" 0220 minMode: delegateMiniMode 0221 imageSource: "./images/search.png" 0222 onClicked: { 0223 categoryLayout.currentIndex = 5 0224 } 0225 } 0226 0227 TopBarTabButton { 0228 id: settingsButton 0229 KeyNavigation.left: searchCatButton 0230 KeyNavigation.down: categoryLayout 0231 minMode: true 0232 imageSource: "./images/settings.png" 0233 onClicked: { 0234 triggerGuiEvent("PeerTube.SettingsPage", {"settings_open": true}) 0235 } 0236 } 0237 } 0238 } 0239 0240 StackLayout { 0241 id: categoryLayout 0242 Layout.fillWidth: true 0243 Layout.fillHeight: true 0244 Layout.topMargin: Kirigami.Units.largeSpacing * 2 0245 currentIndex: 0 0246 0247 onFocusChanged: { 0248 if(focus){ 0249 categoryLayout.itemAt(currentIndex).forceActiveFocus() 0250 } 0251 } 0252 0253 CategoryBoxView { 0254 id: newsCatView 0255 property string catName: "News" 0256 } 0257 0258 CategoryBoxView { 0259 id: musicCatView 0260 property string catName: "Music" 0261 } 0262 0263 CategoryBoxView { 0264 id: techCatView 0265 property string catName: "Technology" 0266 } 0267 0268 CategoryBoxView { 0269 id: polCatView 0270 property string catName: "Entertainment" 0271 } 0272 0273 CategoryBoxView { 0274 id: gamingCatView 0275 property string catName: "Gaming" 0276 } 0277 0278 CategoryBoxViewSearch { 0279 id: searchCatView 0280 property string catName: "Search Results" 0281 } 0282 } 0283 } 0284 0285 Popup { 0286 id: busyIndicatorPop 0287 width: parent.width 0288 height: parent.height 0289 background: Rectangle { 0290 anchors.fill: parent 0291 color: Qt.rgba(0, 0, 0, 0.5) 0292 } 0293 closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent 0294 0295 BusyIndicator { 0296 running: busyIndicate 0297 anchors.centerIn: parent 0298 } 0299 0300 onOpened: { 0301 busyIndicate = true 0302 } 0303 0304 onClosed: { 0305 busyIndicate = false 0306 } 0307 } 0308 0309 Component.onCompleted: { 0310 categoryLayout.itemAt(categoryLayout.currentIndex).forceActiveFocus() 0311 } 0312 } 0313