Warning, /plasma-bigscreen/youtube-voice-application/ui/+mediacenter/YoutubeLiveSearch.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 bool busyIndicate: false 0034 0035 fillWidth: true 0036 0037 leftPadding: 0 0038 rightPadding: 0 0039 topPadding: 0 0040 bottomPadding: 0 0041 0042 skillBackgroundSource: sessionData.bgImage ? "https://source.unsplash.com/weekly?" + sessionData.bgImage : "https://source.unsplash.com/weekly?music" 0043 0044 function highlightActiveCategory(cat){ 0045 switch(cat){ 0046 case "Home": 0047 historyCatButton.checked = false 0048 searchCatButton.checked = false 0049 homeCatButton.checked = true 0050 break; 0051 case "History": 0052 searchCatButton.checked = false 0053 homeCatButton.checked = false 0054 historyCatButton.checked = true 0055 break; 0056 case "Search": 0057 homeCatButton.checked = false 0058 historyCatButton.checked = false 0059 searchCatButton.checked = true 0060 break; 0061 } 0062 } 0063 0064 Connections { 0065 target: Mycroft.MycroftController 0066 onIntentRecevied: { 0067 if(type == "speak") { 0068 busyIndicatorPop.close() 0069 busyIndicate = false 0070 } 0071 } 0072 } 0073 0074 onFocusChanged: { 0075 busyIndicatorPop.close() 0076 busyIndicate = false 0077 if(delegate.focus){ 0078 console.log("focus is here") 0079 } 0080 } 0081 0082 Keys.onBackPressed: { 0083 parent.parent.parent.currentIndex++ 0084 parent.parent.parent.currentItem.contentItem.forceActiveFocus() 0085 } 0086 0087 0088 contentItem: ColumnLayout { 0089 id: colLay1 0090 0091 Rectangle { 0092 color: Qt.rgba(0, 0, 0, 0.8) 0093 Layout.fillWidth: true 0094 Layout.preferredHeight: Kirigami.Units.gridUnit * 3 0095 Layout.maximumHeight: Kirigami.Units.gridUnit * 4 0096 z: 100 0097 0098 RowLayout { 0099 id: categoryRepeater 0100 anchors { 0101 left: parent.left 0102 top: parent.top 0103 bottom: parent.bottom 0104 } 0105 width: parent.width / 2 0106 anchors.leftMargin: Kirigami.Units.gridUnit 0107 anchors.rightMargin: Kirigami.Units.gridUnit 0108 0109 TopBarTabButton { 0110 id: homeCatButton 0111 KeyNavigation.right: historyCatButton 0112 KeyNavigation.down: categoryLayout 0113 checked: true 0114 text: "Home" 0115 onClicked: { 0116 categoryLayout.pop(categoryLayout.find(function(item) { 0117 return item.name == "homeCat";})) 0118 highlightActiveCategory("Home") 0119 } 0120 } 0121 0122 TopBarTabButton { 0123 id: historyCatButton 0124 KeyNavigation.left: homeCatButton 0125 KeyNavigation.right: searchCatButton 0126 KeyNavigation.down: categoryLayout 0127 checked: false 0128 text: "History" 0129 onClicked: { 0130 if(categoryLayout.depth >= 2) { 0131 categoryLayout.pop(null) 0132 } 0133 categoryLayout.push(historyCat) 0134 highlightActiveCategory("History") 0135 } 0136 } 0137 0138 TopBarTabButton { 0139 id: searchCatButton 0140 KeyNavigation.left: historyCatButton 0141 KeyNavigation.down: categoryLayout 0142 checked: false 0143 text: "Search" 0144 onClicked: { 0145 if(categoryLayout.depth >= 2) { 0146 categoryLayout.pop(null) 0147 } 0148 categoryLayout.push(searchCat) 0149 highlightActiveCategory("Search") 0150 } 0151 } 0152 } 0153 } 0154 0155 Component { 0156 id: homeCat 0157 CategoryBoxHomeView { 0158 id: homeCatView 0159 } 0160 } 0161 0162 Component { 0163 id: historyCat 0164 CategoryBoxHistoryView { 0165 id: historyCatView 0166 } 0167 } 0168 0169 Component { 0170 id: searchCat 0171 CategoryBoxSearchView { 0172 id: searchCatView 0173 } 0174 } 0175 0176 StackView { 0177 id: categoryLayout 0178 Layout.fillWidth: true 0179 Layout.fillHeight: true 0180 0181 Component.onCompleted: { 0182 categoryLayout.push(homeCat) 0183 } 0184 } 0185 } 0186 0187 Popup { 0188 id: busyIndicatorPop 0189 width: parent.width 0190 height: parent.height 0191 background: Rectangle { 0192 anchors.fill: parent 0193 color: Qt.rgba(0, 0, 0, 0.5) 0194 } 0195 closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent 0196 0197 BusyIndicator { 0198 running: busyIndicate 0199 anchors.centerIn: parent 0200 } 0201 0202 onOpened: { 0203 busyIndicate = true 0204 } 0205 0206 onClosed: { 0207 busyIndicate = false 0208 } 0209 } 0210 } 0211