From e0972efdb4b906c719c5f5f80f3040e28a869843 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Wed, 18 Jun 2025 22:33:38 +1000 Subject: feat: dashboard pfp picker --- modules/dashboard/dash/User.qml | 82 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) (limited to 'modules/dashboard/dash') diff --git a/modules/dashboard/dash/User.qml b/modules/dashboard/dash/User.qml index bf989c6..ead6fcd 100644 --- a/modules/dashboard/dash/User.qml +++ b/modules/dashboard/dash/User.qml @@ -5,10 +5,13 @@ import "root:/utils" import Quickshell import Quickshell.Io import QtQuick +import QtQuick.Dialogs Row { id: root + required property PersistentProperties visibilities + padding: Appearance.padding.large spacing: Appearance.spacing.normal @@ -28,9 +31,88 @@ Row { } CachingImage { + id: pfp + anchors.fill: parent path: `${Paths.home}/.face` } + + MouseArea { + anchors.fill: parent + + cursorShape: Qt.PointingHandCursor + hoverEnabled: true + + onClicked: { + root.visibilities.launcher = false; + dialog.open(); + } + + StyledRect { + anchors.fill: parent + + color: Qt.alpha(Colours.palette.m3primary, 0.1) + opacity: parent.containsMouse ? 1 : 0 + + Behavior on opacity { + NumberAnimation { + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard + } + } + } + + StyledRect { + anchors.centerIn: parent + + implicitWidth: selectIcon.implicitHeight + Appearance.padding.small * 2 + implicitHeight: selectIcon.implicitHeight + Appearance.padding.small * 2 + + radius: Appearance.rounding.normal + color: Colours.palette.m3primary + scale: parent.containsMouse ? 1 : 0.5 + opacity: parent.containsMouse ? 1 : 0 + + MaterialIcon { + id: selectIcon + + anchors.centerIn: parent + anchors.horizontalCenterOffset: -font.pointSize * 0.02 + + text: "frame_person" + color: Colours.palette.m3onPrimary + font.pointSize: Appearance.font.size.extraLarge + } + + Behavior on scale { + NumberAnimation { + duration: Appearance.anim.durations.expressiveFastSpatial + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial + } + } + + Behavior on opacity { + NumberAnimation { + duration: Appearance.anim.durations.expressiveFastSpatial + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial + } + } + } + } + + FileDialog { + id: dialog + + nameFilters: [`Image files (${Wallpapers.extensions.map(e => `*.${e}`).join(" ")})`] + + onAccepted: { + Paths.copy(selectedFile, `${Paths.home}/.face`); + pfp.pathChanged(); + } + } } Column { -- cgit v1.2.3-freya