Warning, /plasma/plasma-nano/components/qml/StartupFeedback.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2015 Marco Martin <notmart@gmail.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.12 0008 import QtQuick.Layouts 1.1 0009 import QtQuick.Window 2.2 0010 import org.kde.plasma.core as PlasmaCore 0011 import Qt5Compat.GraphicalEffects 0012 0013 import org.kde.kirigami 2.20 as Kirigami 0014 import org.kde.plasma.private.nanoshell 2.0 as NanoShell 0015 0016 pragma Singleton 0017 0018 Window { 0019 id: window 0020 0021 flags: Qt.FramelessWindowHint 0022 property alias backgroundColor: background.color 0023 Kirigami.ImageColors { 0024 id: colorGenerator 0025 source: icon.source 0026 } 0027 0028 function open(splashIcon, title, x, y, sourceIconSize, color) { 0029 iconParent.scale = sourceIconSize/iconParent.width; 0030 background.scale = 0; 0031 backgroundParent.x = -window.width/2 + x 0032 backgroundParent.y = -window.height/2 + y 0033 window.title = title; 0034 icon.source = splashIcon; 0035 0036 if (color !== undefined) { 0037 // Break binding to use custom color 0038 background.color = color 0039 } else { 0040 // Recreate binding 0041 background.color = Qt.binding(function() { return colorGenerator.dominant}) 0042 } 0043 0044 background.state = "open"; 0045 } 0046 0047 Connections { 0048 target: NanoShell.StartupNotifier 0049 enabled: NanoShell.StartupNotifier.isValid 0050 0051 function onActivationStarted(appId, iconName) { 0052 icon.source = iconName 0053 background.state = "open"; 0054 } 0055 } 0056 0057 property alias state: background.state 0058 property alias icon: icon.source 0059 0060 width: Screen.width 0061 height: Screen.height 0062 color: "transparent" 0063 onVisibleChanged: { 0064 if (!visible) { 0065 background.state = "closed"; 0066 } 0067 } 0068 onActiveChanged: { 0069 if (!active) { 0070 background.state = "closed"; 0071 } 0072 } 0073 0074 0075 Item { 0076 id: backgroundParent 0077 width: window.width 0078 height: window.height 0079 0080 Item { 0081 id: iconParent 0082 z: 2 0083 anchors.centerIn: background 0084 width: Kirigami.Units.iconSizes.enormous 0085 height: width 0086 Kirigami.Icon { 0087 id: icon 0088 anchors.fill:parent 0089 Kirigami.Theme.colorSet: Kirigami.Theme.ComplementaryColorGroup 0090 } 0091 DropShadow { 0092 anchors.fill: icon 0093 horizontalOffset: 0 0094 verticalOffset: 0 0095 radius: 8.0 0096 samples: 17 0097 color: "#80000000" 0098 source: icon 0099 } 0100 } 0101 0102 Rectangle { 0103 id: background 0104 anchors.fill: parent 0105 0106 color: colorGenerator.dominant 0107 0108 state: "closed" 0109 0110 states: [ 0111 State { 0112 name: "closed" 0113 PropertyChanges { 0114 target: window 0115 visible: false 0116 } 0117 }, 0118 State { 0119 name: "open" 0120 0121 PropertyChanges { 0122 target: window 0123 visible: true 0124 } 0125 } 0126 ] 0127 0128 transitions: [ 0129 Transition { 0130 from: "closed" 0131 SequentialAnimation { 0132 ScriptAction { 0133 script: { 0134 window.showMaximized(); 0135 } 0136 } 0137 ParallelAnimation { 0138 ScaleAnimator { 0139 target: background 0140 from: background.scale 0141 to: 1 0142 duration: Kirigami.Units.longDuration 0143 easing.type: Easing.InOutQuad 0144 } 0145 ScaleAnimator { 0146 target: iconParent 0147 from: iconParent.scale 0148 to: 1 0149 duration: Kirigami.Units.longDuration 0150 easing.type: Easing.InOutQuad 0151 } 0152 XAnimator { 0153 target: backgroundParent 0154 from: backgroundParent.x 0155 to: 0 0156 duration: Kirigami.Units.longDuration 0157 easing.type: Easing.InOutQuad 0158 } 0159 YAnimator { 0160 target: backgroundParent 0161 from: backgroundParent.y 0162 to: 0 0163 duration: Kirigami.Units.longDuration 0164 easing.type: Easing.InOutQuad 0165 } 0166 } 0167 } 0168 } 0169 ] 0170 } 0171 } 0172 }