import qs import qs.services import qs.modules.common import qs.modules.common.widgets import qs.modules.common.functions import QtQuick import QtQuick.Controls import QtQuick.Layouts import Qt5Compat.GraphicalEffects import Quickshell import Quickshell.Io MouseArea { id: root required property var fileModelData property bool isDirectory: fileModelData.fileIsDir property bool useThumbnail: Images.isValidImageByName(fileModelData.fileName) property alias colBackground: background.color property alias colText: wallpaperItemName.color property alias radius: background.radius property alias padding: background.anchors.margins signal activated hoverEnabled: true onClicked: root.activated() Rectangle { id: background anchors { fill: parent margins: 8 } radius: Appearance.rounding.normal Behavior on color { animation: Appearance.animation.elementMoveFast.colorAnimation.createObject(this) } ColumnLayout { id: wallpaperItemColumnLayout anchors { fill: parent margins: 6 } spacing: 4 Item { id: wallpaperItemImageContainer Layout.fillHeight: true Layout.fillWidth: true Loader { id: thumbnailShadowLoader active: thumbnailImageLoader.active && thumbnailImageLoader.item.status === Image.Ready anchors.fill: thumbnailImageLoader sourceComponent: StyledRectangularShadow { target: thumbnailImageLoader anchors.fill: undefined radius: Appearance.rounding.small } } Loader { id: thumbnailImageLoader anchors.fill: parent active: root.useThumbnail sourceComponent: ThumbnailImage { id: thumbnailImage sourcePath: fileModelData.filePath fillMode: Image.PreserveAspectCrop clip: true sourceSize.width: wallpaperItemColumnLayout.width sourceSize.height: wallpaperItemColumnLayout.height - wallpaperItemColumnLayout.spacing - wallpaperItemName.height layer.enabled: true layer.effect: OpacityMask { maskSource: Rectangle { width: wallpaperItemImageContainer.width height: wallpaperItemImageContainer.height radius: Appearance.rounding.small } } } } Loader { id: iconLoader active: !root.useThumbnail anchors.fill: parent sourceComponent: DirectoryIcon { fileModelData: root.fileModelData sourceSize.width: wallpaperItemColumnLayout.width sourceSize.height: wallpaperItemColumnLayout.height - wallpaperItemColumnLayout.spacing - wallpaperItemName.height } } } StyledText { id: wallpaperItemName Layout.fillWidth: true Layout.leftMargin: 10 Layout.rightMargin: 10 horizontalAlignment: Text.AlignHCenter elide: Text.ElideRight font.pixelSize: Appearance.font.pixelSize.smaller Behavior on color { animation: Appearance.animation.elementMoveFast.colorAnimation.createObject(this) } text: fileModelData.fileName } } } }