Warning, /plasma-bigscreen/peertube-voice-application/ui/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: sessionData.search_results.data
0039     property bool searchComplete: sessionData.search_completed
0040     property bool busyIndicate: false
0041     property var searchQuery
0042     readonly property bool delegateMiniMode: delegate.width <= 1200 ? 1 : 0   
0043     
0044     fillWidth: true
0045     
0046     leftPadding: 0
0047     rightPadding: 0
0048     topPadding: 0
0049     bottomPadding: 0
0050     
0051     skillBackgroundSource: sessionData.bgImage ? "https://source.unsplash.com/weekly?" + sessionData.bgImage : "https://source.unsplash.com/weekly?music"
0052 
0053     Connections {
0054         target: Mycroft.MycroftController
0055         onIntentRecevied: {
0056             if(type == "speak") {
0057                 busyIndicatorPop.close()
0058                 busyIndicate = false
0059             }
0060         }
0061     }
0062     
0063     onNewsListModelChanged: {
0064         newsCatView.model = newsListModel
0065         console.log(newsListModel)
0066     }
0067     
0068     onMusicListModelChanged: {
0069         musicCatView.model = musicListModel
0070     }
0071     
0072     onTechListModelChanged: {
0073         techCatView.model = techListModel
0074     }
0075     
0076     onPolListModelChanged: {
0077         polCatView.model = polListModel
0078     }
0079     
0080     onGamingListModelChanged: {
0081         gamingCatView.model = gamingListModel
0082     }
0083     
0084     onSearchListModelChanged: {
0085         searchCatView.model = searchListModel
0086         console.log("SearchListModelChanged")
0087         busyIndicatorPop.close()
0088     }
0089     
0090     onSearchCompleteChanged: {
0091         busyIndicatorPop.close()
0092     }
0093     
0094     onFocusChanged: {
0095         busyIndicatorPop.close()
0096         busyIndicate = false
0097         if(delegate.focus){
0098             console.log("focus is here")
0099         }
0100     }
0101     
0102     Keys.onBackPressed: {
0103         parent.parent.parent.currentIndex++
0104         parent.parent.parent.currentItem.contentItem.forceActiveFocus()
0105     }
0106     
0107     ColumnLayout {
0108         id: colLay1
0109         anchors.fill: parent
0110         
0111         Rectangle {
0112             color: Qt.rgba(0, 0, 0, 0.8)
0113             Layout.fillWidth: true
0114             Layout.preferredHeight: Kirigami.Units.gridUnit * 3 
0115             Layout.maximumHeight: Kirigami.Units.gridUnit * 4
0116             z: 100
0117             
0118             RowLayout {
0119                 id: categoryRepeater
0120                 anchors {
0121                     left: parent.left
0122                     right: parent.right
0123                     top: parent.top
0124                     bottom: parent.bottom
0125                 }
0126                 anchors.leftMargin: Kirigami.Units.gridUnit
0127                 anchors.rightMargin: Kirigami.Units.gridUnit
0128                 
0129                 Item {
0130                     Layout.preferredWidth: Kirigami.Units.gridUnit * 6
0131                     Layout.preferredHeight: Kirigami.Units.gridUnit * 2
0132                     Layout.alignment: Qt.AlignLeft
0133                     Layout.rightMargin: Kirigami.Units.gridUnit
0134                     enabled: !delegateMiniMode
0135                     visible: !delegateMiniMode
0136                     
0137                     Image {
0138                         source: "images/peertube-top-dark.png"
0139                         anchors.fill: parent
0140                         fillMode: Image.PreserveAspectFit
0141                     }
0142                 }
0143                 
0144                 TopBarTabButton {
0145                     id: homeCatButton
0146                     KeyNavigation.right: musicCatButton
0147                     KeyNavigation.down: categoryLayout
0148                     checked: categoryLayout.currentIndex == 0
0149                     text: "News"
0150                     minMode: delegateMiniMode
0151                     imageSource: "images/news.png"
0152                     onClicked: {
0153                         categoryLayout.currentIndex = 0
0154                     }
0155                 }
0156                 
0157                 TopBarTabButton {
0158                     id: musicCatButton
0159                     KeyNavigation.right: techCatButton
0160                     KeyNavigation.left: newsCatButton
0161                     KeyNavigation.down: categoryLayout
0162                     checked: categoryLayout.currentIndex == 1
0163                     text: "Music"
0164                     minMode: delegateMiniMode
0165                     imageSource: "images/music.png"
0166                     onClicked: {
0167                         categoryLayout.currentIndex = 1
0168                     }
0169                 }
0170                 
0171                 TopBarTabButton {
0172                     id: techCatButton
0173                     KeyNavigation.right: polCatButton
0174                     KeyNavigation.left: musicCatButton
0175                     KeyNavigation.down: categoryLayout
0176                     checked: categoryLayout.currentIndex == 2
0177                     text: "Technology"
0178                     minMode: delegateMiniMode
0179                     imageSource: "images/technology.png"
0180                     onClicked: {
0181                         categoryLayout.currentIndex = 2
0182                     }
0183                 }
0184                 
0185                 TopBarTabButton {
0186                     id: entertainmentCatButton
0187                     KeyNavigation.right: gamingCatButton
0188                     KeyNavigation.left: techCatButton
0189                     KeyNavigation.down: categoryLayout
0190                     checked: categoryLayout.currentIndex == 3
0191                     text: "Entertainment"
0192                     minMode: delegateMiniMode
0193                     imageSource: "images/entertainment.png"
0194                     onClicked: {
0195                         categoryLayout.currentIndex = 3
0196                     }
0197                 }
0198                 
0199                 TopBarTabButton {
0200                     id: gamingCatButton
0201                     KeyNavigation.left: polCatButton
0202                     KeyNavigation.right: searchCatButton
0203                     KeyNavigation.down: categoryLayout
0204                     checked: categoryLayout.currentIndex == 4
0205                     text: "Gaming"
0206                     minMode: delegateMiniMode
0207                     imageSource: "images/gaming.png"
0208                     onClicked: {
0209                         categoryLayout.currentIndex = 4
0210                     }
0211                 }
0212                 
0213                 TopBarTabButton {
0214                     id: searchCatButton
0215                     KeyNavigation.left: gamingCatButton
0216                     KeyNavigation.right: settingsButton
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