Warning, /plasma/plasma-bigscreen/containments/homescreen/package/contents/ui/launcher/LauncherHome.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2019 Aditya Mehra <aix.m@outlook.com> 0003 SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 import QtQuick 2.15 0009 import QtQuick.Layouts 1.15 0010 import QtQuick.Controls 2.15 as Controls 0011 import QtQuick.Window 2.15 0012 import org.kde.plasma.plasmoid 2.0 0013 import org.kde.plasma.core 2.0 as PlasmaCore 0014 import org.kde.plasma.components 3.0 as PlasmaComponents 0015 import org.kde.kquickcontrolsaddons 2.0 0016 import org.kde.kirigami 2.19 as Kirigami 0017 import org.kde.kitemmodels 1.0 as KItemModels 0018 0019 import "delegates" as Delegates 0020 import org.kde.mycroft.bigscreen 1.0 as BigScreen 0021 import org.kde.private.biglauncher 1.0 0022 import org.kde.plasma.private.kicker 0.1 as Kicker 0023 0024 FocusScope { 0025 property bool mycroftIntegration: false 0026 0027 // Mycroft Integration Is Disabled 0028 // property bool mycroftIntegration: Plasmoid.bigLauncherDbusAdapterInterface.mycroftIntegrationActive() ? 1 : 0 0029 0030 // Connections { 0031 // target: Plasmoid.bigLauncherDbusAdapterInterface 0032 0033 // function onEnableMycroftIntegrationChanged(mycroftIntegration) { 0034 // mycroftIntegration = Plasmoid.bigLauncherDbusAdapterInterface.mycroftIntegrationActive() 0035 // if(mycroftIntegration){ 0036 // voiceAppsView.visible = voiceAppsView.count > 0 ? 1 : 0 0037 // } else { 0038 // voiceAppsView.visible = false 0039 // } 0040 // } 0041 // } 0042 0043 anchors { 0044 fill: parent 0045 leftMargin: Kirigami.Units.largeSpacing * 4 0046 topMargin: Kirigami.Units.largeSpacing * 3 0047 } 0048 0049 ColumnLayout { 0050 id: launcherHomeColumn 0051 anchors { 0052 left: parent.left 0053 right: parent.right 0054 } 0055 property Item currentSection 0056 y: currentSection ? -currentSection.y + parent.height/2 - currentSection.height/2 : parent.height/2 0057 0058 Behavior on y { 0059 YAnimator { 0060 duration: Kirigami.Units.longDuration * 2 0061 easing.type: Easing.InOutQuad 0062 } 0063 } 0064 //height: parent.height 0065 spacing: Kirigami.Units.largeSpacing*3 0066 0067 0068 BigScreen.TileRepeater { 0069 id: recentView 0070 title: i18n("Recent") 0071 compactMode: plasmoid.expandingTiles 0072 model: Kicker.RecentUsageModel { 0073 shownItems: Kicker.RecentUsageModel.OnlyApps 0074 } 0075 0076 visible: count > 0 0077 currentIndex: 0 0078 focus: true 0079 onActiveFocusChanged: if (activeFocus) launcherHomeColumn.currentSection = recentView 0080 delegate: Delegates.AppDelegate { 0081 property var modelData: typeof model !== "undefined" ? model : null 0082 iconImage: model.decoration 0083 text: model.display 0084 comment: model.description 0085 onClicked: (mouse)=> { 0086 recentView.model.trigger(index, "", null); 0087 } 0088 } 0089 0090 navigationUp: shutdownIndicator 0091 navigationDown: voiceAppsView.visible ? voiceAppsView : appsView 0092 } 0093 0094 BigScreen.TileRepeater { 0095 id: voiceAppsView 0096 title: i18n("Voice Apps") 0097 compactMode: plasmoid.configuration.expandingTiles 0098 model: KItemModels.KSortFilterProxyModel { 0099 sourceModel: plasmoid.applicationListModel 0100 filterRoleName: "ApplicationCategoriesRole" 0101 filterRowCallback: function(source_row, source_parent) { 0102 return sourceModel.data(sourceModel.index(source_row, 0, source_parent), ApplicationListModel.ApplicationCategoriesRole).indexOf("VoiceApp") !== -1; 0103 } 0104 } 0105 0106 visible: mycroftIntegration && count > 0 0107 currentIndex: 0 0108 focus: false 0109 onActiveFocusChanged: if (activeFocus) launcherHomeColumn.currentSection = voiceAppsView 0110 delegate: Delegates.VoiceAppDelegate { 0111 property var modelData: typeof model !== "undefined" ? model : null 0112 0113 } 0114 0115 navigationUp: recentView.visible ? recentView : shutdownIndicator 0116 navigationDown: appsView.visible ? appsView : (gamesView.visible ? gamesView : settingsView) 0117 } 0118 0119 BigScreen.TileRepeater { 0120 id: appsView 0121 title: i18n("Applications") 0122 compactMode: plasmoid.configuration.expandingTiles 0123 visible: count > 0 0124 enabled: count > 0 0125 model: KItemModels.KSortFilterProxyModel { 0126 sourceModel: plasmoid.applicationListModel 0127 filterRoleName: "ApplicationCategoriesRole" 0128 filterRowCallback: function(source_row, source_parent) { 0129 var cats = sourceModel.data(sourceModel.index(source_row, 0, source_parent), ApplicationListModel.ApplicationCategoriesRole); 0130 return cats.indexOf("Game") === -1 && cats.indexOf("VoiceApp") === -1; 0131 } 0132 } 0133 0134 currentIndex: 0 0135 focus: false 0136 onActiveFocusChanged: if (activeFocus) launcherHomeColumn.currentSection = appsView 0137 delegate: Delegates.AppDelegate { 0138 property var modelData: typeof model !== "undefined" ? model : null 0139 comment: model.ApplicationCommentRole 0140 } 0141 0142 navigationUp: voiceAppsView.visible ? voiceAppsView : recentView.visible ? recentView : shutdownIndicator 0143 navigationDown: gamesView.visible ? gamesView : settingsView 0144 } 0145 0146 BigScreen.TileRepeater { 0147 id: gamesView 0148 title: i18n("Games") 0149 compactMode: plasmoid.configuration.expandingTiles 0150 visible: count > 0 0151 enabled: count > 0 0152 model: KItemModels.KSortFilterProxyModel { 0153 sourceModel: plasmoid.applicationListModel 0154 filterRoleName: "ApplicationCategoriesRole" 0155 filterRowCallback: function(source_row, source_parent) { 0156 return sourceModel.data(sourceModel.index(source_row, 0, source_parent), ApplicationListModel.ApplicationCategoriesRole).indexOf("Game") !== -1; 0157 } 0158 } 0159 0160 currentIndex: 0 0161 focus: false 0162 onActiveFocusChanged: if (activeFocus) launcherHomeColumn.currentSection = gamesView 0163 delegate: Delegates.AppDelegate { 0164 property var modelData: typeof model !== "undefined" ? model : null 0165 } 0166 0167 navigationUp: appsView.visible ? appsView : (voiceAppsView.visible ? voiceAppsView : (recentView.visible ? recentView : shutdownIndicator)) 0168 navigationDown: settingsView 0169 } 0170 0171 SettingActions { 0172 id: settingActions 0173 } 0174 0175 BigScreen.TileRepeater { 0176 id: settingsView 0177 title: i18n("Settings") 0178 model: plasmoid.kcmsListModel 0179 compactMode: plasmoid.configuration.expandingTiles 0180 0181 onActiveFocusChanged: if (activeFocus) launcherHomeColumn.currentSection = settingsView 0182 delegate: Delegates.SettingDelegate { 0183 property var modelData: typeof model !== "undefined" ? model : null 0184 } 0185 0186 navigationUp: gamesView.visible ? gamesView : (appsView.visible ? appsView : (voiceAppsView.visible ? voiceAppsView : (recentView.visible ? recentView : shutdownIndicator))) 0187 navigationDown: null 0188 } 0189 0190 Component.onCompleted: { 0191 if (recentView.visible) { 0192 recentView.forceActiveFocus(); 0193 } else if(voiceAppsView.visible) { 0194 voiceAppsView.forceActiveFocus(); 0195 } else { 0196 appsView.forceActiveFocus(); 0197 } 0198 } 0199 0200 Connections { 0201 target: root 0202 function onActivateAppView() { 0203 if (recentView.visible) { 0204 recentView.forceActiveFocus(); 0205 } else if(voiceAppsView.visible) { 0206 voiceAppsView.forceActiveFocus(); 0207 } else { 0208 appsView.forceActiveFocus(); 0209 } 0210 } 0211 } 0212 } 0213 }