Warning, /plasma/plasma-bigscreen/containments/homescreen/package/contents/ui/main.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.kquickcontrolsaddons 2.0 0015 import org.kde.kirigami 2.19 as Kirigami 0016 0017 import "launcher" 0018 import "indicators" as Indicators 0019 import org.kde.mycroft.bigscreen 1.0 as BigScreen 0020 import Qt5Compat.GraphicalEffects 0021 0022 ContainmentItem { 0023 id: root 0024 Layout.minimumWidth: Screen.desktopAvailableWidth 0025 Layout.minimumHeight: Screen.desktopAvailableHeight * 0.6 0026 0027 //property bool mycroftIntegration: Plasmoid.bigLauncherDbusAdapterInterface.mycroftIntegrationActive() ? 1 : 0 0028 property bool mycroftIntegration: false 0029 0030 property Item wallpaper 0031 0032 Connections { 0033 target: Plasmoid.bigLauncherDbusAdapterInterface 0034 0035 // function onEnableMycroftIntegrationChanged(mycroftIntegration) { 0036 // mycroftIntegration = Plasmoid.bigLauncherDbusAdapterInterface.mycroftIntegrationActive() 0037 // if(mycroftIntegration) { 0038 // mycroftIndicatorLoader.active = true 0039 // mycroftWindowLoader.active = true 0040 // } else { 0041 // mycroftIndicatorLoader.item.disconnectclose() 0042 // mycroftWindowLoader.item.disconnectclose() 0043 // } 0044 // } 0045 0046 function onEnablePmInhibitionChanged(pmInhibition) { 0047 var powerInhibition = Plasmoid.bigLauncherDbusAdapterInterface.pmInhibitionActive() 0048 if(powerInhibition) { 0049 pmInhibitItem.inhibit = true 0050 } else { 0051 pmInhibitItem.inhibit = false 0052 } 0053 } 0054 } 0055 0056 Containment.onAppletAdded: { 0057 addApplet(applet, x, y); 0058 } 0059 0060 PowerManagementItem { 0061 id: pmInhibitItem 0062 //inhibit: plasmoid.nativeInterface.bigLauncherDbusAdapterInterface.pmInhibitionActive() 0063 } 0064 0065 // PlasmaCore.ColorScope.colorGroup: PlasmaCore.Theme.ComplementaryColorGroup 0066 Kirigami.Theme.inherit: false 0067 Kirigami.Theme.colorSet: Kirigami.Theme.Complementary 0068 0069 Component.onCompleted: { 0070 for (var i in plasmoid.applets) { 0071 root.addApplet(plasmoid.applets[i], -1, -1) 0072 } 0073 console.log("checking for power inhibition") 0074 console.log(Plasmoid.bigLauncherDbusAdapterInterface.pmInhibitionActive()) 0075 pmInhibitItem.inhibit = Plasmoid.bigLauncherDbusAdapterInterface.pmInhibitionActive() 0076 } 0077 0078 function addApplet(applet, x, y) { 0079 var container = appletContainerComponent.createObject(appletsLayout) 0080 print("Applet added: " + applet + " " + applet.title) 0081 //container.width = Kirigami.Units.iconSizes.medium 0082 container.height = appletsLayout.height 0083 0084 const appletItem = root.itemFor(applet); 0085 appletItem.parent = container; 0086 container.applet = appletItem; 0087 appletItem.anchors.fill = container; 0088 appletItem.visible = true; 0089 appletItem.expanded = false; 0090 } 0091 0092 Component { 0093 id: appletContainerComponent 0094 Item { 0095 property Item applet 0096 visible: applet && applet.status !== PlasmaCore.Types.HiddenStatus && applet.status !== PlasmaCore.Types.PassiveStatus 0097 Layout.fillHeight: true 0098 Layout.minimumWidth: Math.max(applet.implicitWidth, applet.Layout.preferredWidth, applet.Layout.minimumWidth) + Kirigami.Units.gridUnit 0099 Layout.maximumWidth: Layout.minimumWidth 0100 } 0101 } 0102 0103 FeedbackWindow { 0104 id: feedbackWindow 0105 } 0106 0107 // Loader to make Mycroft completely optional 0108 // Won't actually work disable it for now 0109 // Loader { 0110 // id: mycroftWindowLoader 0111 // source: mycroftIntegration && Qt.resolvedUrl("MycroftWindow.qml") ? Qt.resolvedUrl("MycroftWindow.qml") : null 0112 // } 0113 0114 ConfigWindow { 0115 id: plasmoidConfig 0116 } 0117 0118 LinearGradient { 0119 anchors { 0120 top: parent.top 0121 bottom: parent.bottom 0122 } 0123 x: root.Window.active ? 0 : -width 0124 Behavior on x { 0125 XAnimator { 0126 duration: Kirigami.Units.longDuration 0127 easing.type: Easing.InOutQuad 0128 } 0129 } 0130 width: parent.width/2 0131 start: Qt.point(0, 0) 0132 end: Qt.point(width, 0) 0133 gradient: Gradient { 0134 GradientStop { 0135 position: 0.0 0136 color: Qt.rgba(0, 0, 0, 0.75) 0137 } 0138 GradientStop { 0139 position: 0.5 0140 color: Qt.rgba(0, 0, 0, 0.5) 0141 } 0142 GradientStop { 0143 position: 1.0 0144 color: "transparent" 0145 } 0146 } 0147 } 0148 0149 Item { 0150 id: topBar 0151 anchors { 0152 left: parent.left 0153 right: parent.right 0154 } 0155 z: launcher.z + 1 0156 Kirigami.Theme.colorSet: Kirigami.Theme.Window 0157 height: Kirigami.Units.iconSizes.medium + Kirigami.Units.smallSpacing * 2 0158 opacity: root.Window.active 0159 0160 y: root.Window.active ? 0 : -height 0161 Behavior on y { 0162 YAnimator { 0163 duration: Kirigami.Units.longDuration 0164 easing.type: Easing.InOutQuad 0165 } 0166 } 0167 Behavior on opacity { 0168 OpacityAnimator { 0169 duration: Kirigami.Units.longDuration 0170 easing.type: Easing.InOutQuad 0171 } 0172 } 0173 0174 Rectangle { 0175 anchors.fill: parent 0176 color: Kirigami.Theme.backgroundColor 0177 } 0178 RowLayout { 0179 id: appletsLayout 0180 anchors { 0181 left: parent.left 0182 top: parent.top 0183 bottom: parent.bottom 0184 margins: Kirigami.Units.smallSpacing 0185 } 0186 } 0187 0188 RowLayout { 0189 anchors { 0190 right: parent.right 0191 top: parent.top 0192 bottom: parent.bottom 0193 margins: Kirigami.Units.smallSpacing 0194 } 0195 0196 // Loader to make Mycroft completely optional 0197 // Won't actually work disable it for now 0198 // Loader { 0199 // id: mycroftIndicatorLoader 0200 // Layout.fillHeight: true 0201 // source: mycroftIntegration && Qt.resolvedUrl("MycroftIndicator.qml") ? Qt.resolvedUrl("MycroftIndicator.qml") : null 0202 // } 0203 0204 0205 // KF6 QML import org.kde.kdeconnect missing 0206 // Indicator does not load without this 0207 // Indicators.KdeConnect { 0208 // id: kdeconnectIndicator 0209 // Layout.fillHeight: true 0210 // implicitWidth: height 0211 // KeyNavigation.down: launcher 0212 // KeyNavigation.right: volumeIndicator 0213 // KeyNavigation.tab: volumeIndicator 0214 // KeyNavigation.backtab: launcher 0215 // KeyNavigation.left: kdeconnectIndicator 0216 // } 0217 0218 Indicators.Volume { 0219 id: volumeIndicator 0220 Layout.fillHeight: true 0221 implicitWidth: height 0222 KeyNavigation.down: launcher 0223 KeyNavigation.right: wifiIndicator 0224 KeyNavigation.tab: wifiIndicator 0225 KeyNavigation.backtab: launcher 0226 } 0227 0228 Indicators.Wifi { 0229 id: wifiIndicator 0230 Layout.fillHeight: true 0231 implicitWidth: height 0232 KeyNavigation.down: launcher 0233 KeyNavigation.right: shutdownIndicator 0234 KeyNavigation.tab: shutdownIndicator 0235 KeyNavigation.backtab: volumeIndicator 0236 KeyNavigation.left: volumeIndicator 0237 } 0238 Indicators.Shutdown { 0239 id: shutdownIndicator 0240 KeyNavigation.down: launcher 0241 KeyNavigation.right: launcher 0242 KeyNavigation.tab: launcher 0243 KeyNavigation.backtab: wifiIndicator 0244 KeyNavigation.left: wifiIndicator 0245 } 0246 } 0247 0248 LinearGradient { 0249 property int radius: Kirigami.Units.gridUnit 0250 implicitWidth: radius 0251 implicitHeight: radius 0252 anchors { 0253 left: parent.left 0254 right: parent.right 0255 top: parent.bottom 0256 } 0257 0258 start: Qt.point(0, 0) 0259 end: Qt.point(0, height) 0260 gradient: Gradient { 0261 GradientStop { 0262 position: 0.0 0263 color: Qt.rgba(0, 0, 0, 0.25) 0264 } 0265 GradientStop { 0266 position: 0.20 0267 color: Qt.rgba(0, 0, 0, 0.1) 0268 } 0269 GradientStop { 0270 position: 0.35 0271 color: Qt.rgba(0, 0, 0, 0.02) 0272 } 0273 GradientStop { 0274 position: 1.0 0275 color: "transparent" 0276 } 0277 } 0278 } 0279 } 0280 0281 LauncherMenu { 0282 id: launcher 0283 width: parent.width 0284 height: parent.height - topBar.height 0285 0286 0287 states: [ 0288 State { 0289 when: root.Window.activeFocusItem !== null 0290 PropertyChanges { 0291 target: launcher 0292 opacity: 1 0293 y: topBar.height 0294 } 0295 StateChangeScript { 0296 script: { 0297 launcher.activateAppView() 0298 } 0299 } 0300 }, 0301 State { 0302 when: root.Window.activeFocusItem === null 0303 PropertyChanges { 0304 target: launcher 0305 opacity: 0 0306 y: root.height / 4 0307 } 0308 } 0309 ] 0310 0311 transitions: [ 0312 Transition { 0313 ParallelAnimation { 0314 OpacityAnimator { 0315 duration: Kirigami.Units.longDuration 0316 easing.type: Easing.InOutQuad 0317 } 0318 YAnimator { 0319 duration: Kirigami.Units.longDuration 0320 easing.type: Easing.InOutQuad 0321 } 0322 } 0323 } 0324 ] 0325 } 0326 }