Warning, /plasma/plasma-workspace/wallpapers/image/imagepackage/contents/ui/mediacomponent/AnimatedImageComponent.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2022 Fushan Wen <qydwhotmail@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick
0008 
0009 import org.kde.plasma.wallpapers.image as PlasmaWallpaper
0010 
0011 import org.kde.kwindowsystem
0012 
0013 BaseMediaComponent {
0014     id: animatedImageComponent
0015 
0016     readonly property rect desktopRect: Window.window ? Qt.rect(Window.window.x, Window.window.y, Window.window.width, Window.window.height) : Qt.rect(0, 0, 0, 0)
0017     readonly property alias status: mainImage.status
0018 
0019     blurSource: blurLoader.item
0020 
0021     PlasmaWallpaper.MaximizedWindowMonitor {
0022         id: activeWindowMonitor
0023         regionGeometry: animatedImageComponent.desktopRect
0024     }
0025 
0026     AnimatedImage {
0027         id: mainImage
0028         anchors.fill: parent
0029         asynchronous: true
0030         cache: false
0031         autoTransform: true
0032 
0033         fillMode: animatedImageComponent.fillMode
0034         source: animatedImageComponent.source
0035         // sourceSize is read-only
0036         // https://github.com/qt/qtdeclarative/blob/23b4ab24007f489ac7c2b9ceabe72fa625a51f3d/src/quick/items/qquickanimatedimage_p.h#L39
0037 
0038         paused: activeWindowMonitor.count > 0 && !KWindowSystem.showingDesktop
0039     }
0040 
0041     Loader {
0042         id: blurLoader
0043         anchors.fill: parent
0044         active: animatedImageComponent.blurEnabled
0045         sourceComponent: Image {
0046             asynchronous: true
0047             cache: false
0048             autoTransform: true
0049             fillMode: Image.PreserveAspectCrop
0050             source: mainImage.source
0051             sourceSize: animatedImageComponent.sourceSize
0052             visible: false // will be rendered by the blur
0053         }
0054     }
0055 }