Warning, /plasma/plasma-workspace/lookandfeel/components/WallpaperFader.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2014 Aleix Pol Gonzalez <aleixpol@blue-systems.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.15 0008 import QtQuick.Layouts 1.15 0009 import Qt5Compat.GraphicalEffects 0010 0011 import org.kde.kirigami 2.20 as Kirigami 0012 import org.kde.plasma.private.sessions 2.0 0013 import org.kde.breeze.components 0014 0015 Item { 0016 id: wallpaperFader 0017 property Item clock 0018 property Item mainStack 0019 property Item footer 0020 property alias source: wallpaperBlur.source 0021 property real factor: 0 0022 readonly property bool lightColorScheme: Math.max(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b) > 0.5 0023 0024 property bool alwaysShowClock: typeof config === "undefined" || typeof config.alwaysShowClock === "undefined" || config.alwaysShowClock === true 0025 0026 state: "on" 0027 0028 Behavior on factor { 0029 NumberAnimation { 0030 target: wallpaperFader 0031 property: "factor" 0032 duration: Kirigami.Units.veryLongDuration * 2 0033 easing.type: Easing.InOutQuad 0034 } 0035 } 0036 FastBlur { 0037 id: wallpaperBlur 0038 anchors.fill: parent 0039 radius: 50 * wallpaperFader.factor 0040 } 0041 ShaderEffect { 0042 id: wallpaperShader 0043 anchors.fill: parent 0044 supportsAtlasTextures: true 0045 property var source: ShaderEffectSource { 0046 sourceItem: wallpaperBlur 0047 live: true 0048 hideSource: true 0049 textureMirroring: ShaderEffectSource.NoMirroring 0050 } 0051 0052 readonly property real contrast: 0.65 * wallpaperFader.factor + (1 - wallpaperFader.factor) 0053 readonly property real saturation: 1.6 * wallpaperFader.factor + (1 - wallpaperFader.factor) 0054 readonly property real intensity: (wallpaperFader.lightColorScheme ? 1.7 : 0.6) * wallpaperFader.factor + (1 - wallpaperFader.factor) 0055 0056 readonly property real transl: (1.0 - contrast) / 2.0; 0057 readonly property real rval: (1.0 - saturation) * 0.2126; 0058 readonly property real gval: (1.0 - saturation) * 0.7152; 0059 readonly property real bval: (1.0 - saturation) * 0.0722; 0060 0061 property var colorMatrix: Qt.matrix4x4( 0062 contrast, 0, 0, 0.0, 0063 0, contrast, 0, 0.0, 0064 0, 0, contrast, 0.0, 0065 transl, transl, transl, 1.0).times(Qt.matrix4x4( 0066 rval + saturation, rval, rval, 0.0, 0067 gval, gval + saturation, gval, 0.0, 0068 bval, bval, bval + saturation, 0.0, 0069 0, 0, 0, 1.0)).times(Qt.matrix4x4( 0070 intensity, 0, 0, 0, 0071 0, intensity, 0, 0, 0072 0, 0, intensity, 0, 0073 0, 0, 0, 1 0074 )); 0075 0076 fragmentShader: "qrc:/qt/qml/org/kde/breeze/components/shaders/WallpaperFader.frag.qsb" 0077 } 0078 0079 states: [ 0080 State { 0081 name: "on" 0082 PropertyChanges { 0083 target: mainStack 0084 opacity: 1 0085 } 0086 PropertyChanges { 0087 target: footer 0088 opacity: 1 0089 } 0090 PropertyChanges { 0091 target: wallpaperFader 0092 factor: 1 0093 } 0094 PropertyChanges { 0095 target: clock.shadow 0096 opacity: 0 0097 } 0098 PropertyChanges { 0099 target: clock 0100 opacity: 1 0101 } 0102 }, 0103 State { 0104 name: "off" 0105 PropertyChanges { 0106 target: mainStack 0107 opacity: 0 0108 } 0109 PropertyChanges { 0110 target: footer 0111 opacity: 0 0112 } 0113 PropertyChanges { 0114 target: wallpaperFader 0115 factor: 0 0116 } 0117 PropertyChanges { 0118 target: clock.shadow 0119 opacity: wallpaperFader.alwaysShowClock ? 1 : 0 0120 } 0121 PropertyChanges { 0122 target: clock 0123 opacity: wallpaperFader.alwaysShowClock ? 1 : 0 0124 } 0125 } 0126 ] 0127 transitions: [ 0128 Transition { 0129 from: "off" 0130 to: "on" 0131 //Note: can't use animators as they don't play well with parallelanimations 0132 NumberAnimation { 0133 targets: [mainStack, footer, clock] 0134 property: "opacity" 0135 duration: Kirigami.Units.veryLongDuration 0136 easing.type: Easing.InOutQuad 0137 } 0138 }, 0139 Transition { 0140 from: "on" 0141 to: "off" 0142 NumberAnimation { 0143 targets: [mainStack, footer, clock] 0144 property: "opacity" 0145 duration: Kirigami.Units.veryLongDuration 0146 easing.type: Easing.InOutQuad 0147 } 0148 } 0149 ] 0150 }