From 00d3c1a472888817d7649391d4a8485c5fc6f6f5 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sat, 3 May 2025 23:56:37 +1000 Subject: feat: launcher wallpaper selector --- modules/launcher/WallpaperItem.qml | 91 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 modules/launcher/WallpaperItem.qml (limited to 'modules/launcher/WallpaperItem.qml') diff --git a/modules/launcher/WallpaperItem.qml b/modules/launcher/WallpaperItem.qml new file mode 100644 index 0000000..bbd611c --- /dev/null +++ b/modules/launcher/WallpaperItem.qml @@ -0,0 +1,91 @@ +import "root:/widgets" +import "root:/services" +import "root:/config" +import Quickshell +import QtQuick +import QtQuick.Effects + +StyledRect { + id: root + + required property Wallpapers.Wallpaper modelData + + scale: PathView.isCurrentItem ? 1 : PathView.onPath ? 0.8 : 0 + opacity: PathView.onPath ? 1 : 0 + z: PathView.isCurrentItem ? 1 : 0 + + implicitWidth: image.width + Appearance.padding.larger * 2 + implicitHeight: image.height + label.height + Appearance.spacing.small / 2 + Appearance.padding.normal * 2 + + StateLayer { + radius: Appearance.rounding.normal + + function onClicked(): void { + console.log("clicked"); + } + } + + Image { + id: image + + anchors.horizontalCenter: parent.horizontalCenter + y: Appearance.padding.normal + + visible: false + source: `file://${root.modelData.path}` + asynchronous: true + fillMode: Image.PreserveAspectCrop + smooth: !root.PathView.view.moving + + width: LauncherConfig.sizes.wallpaperWidth + height: width / 16 * 9 + sourceSize.width: width + sourceSize.height: height + } + + Rectangle { + id: mask + + layer.enabled: true + visible: false + anchors.fill: image + width: image.width + height: image.height + radius: Appearance.rounding.normal + } + + MultiEffect { + anchors.fill: image + source: image + maskEnabled: true + maskSource: mask + } + + StyledText { + id: label + + anchors.top: image.bottom + anchors.topMargin: Appearance.spacing.small / 2 + anchors.horizontalCenter: parent.horizontalCenter + + renderType: Text.QtRendering + text: root.modelData.name + font.pointSize: Appearance.font.size.small + } + + Behavior on scale { + NumberAnimation { + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard + } + } + + Behavior on opacity { + NumberAnimation { + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard + } + } +} -- cgit v1.2.3-freya