feat: dashboard pfp picker
This commit is contained in:
parent
c94b761459
commit
e0972efdb4
4 changed files with 93 additions and 9 deletions
|
|
@ -85,6 +85,7 @@ Item {
|
||||||
|
|
||||||
Dash {
|
Dash {
|
||||||
shouldUpdate: visible && this === view.currentItem
|
shouldUpdate: visible && this === view.currentItem
|
||||||
|
visibilities: root.visibilities
|
||||||
}
|
}
|
||||||
|
|
||||||
Media {
|
Media {
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ GridLayout {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property bool shouldUpdate
|
required property bool shouldUpdate
|
||||||
|
required property var visibilities
|
||||||
|
|
||||||
rowSpacing: Appearance.spacing.normal
|
rowSpacing: Appearance.spacing.normal
|
||||||
columnSpacing: Appearance.spacing.normal
|
columnSpacing: Appearance.spacing.normal
|
||||||
|
|
@ -20,6 +21,8 @@ GridLayout {
|
||||||
|
|
||||||
User {
|
User {
|
||||||
id: user
|
id: user
|
||||||
|
|
||||||
|
visibilities: root.visibilities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,13 @@ import "root:/utils"
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Dialogs
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
padding: Appearance.padding.large
|
padding: Appearance.padding.large
|
||||||
spacing: Appearance.spacing.normal
|
spacing: Appearance.spacing.normal
|
||||||
|
|
||||||
|
|
@ -28,9 +31,88 @@ Row {
|
||||||
}
|
}
|
||||||
|
|
||||||
CachingImage {
|
CachingImage {
|
||||||
|
id: pfp
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
path: `${Paths.home}/.face`
|
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 {
|
Column {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
|
||||||
import Qt.labs.platform
|
import Qt.labs.platform
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
|
|
@ -17,16 +16,15 @@ Singleton {
|
||||||
|
|
||||||
readonly property url imagecache: `${cache}/imagecache`
|
readonly property url imagecache: `${cache}/imagecache`
|
||||||
|
|
||||||
|
function strip(path: url): string {
|
||||||
|
return path.toString().replace("file://", "");
|
||||||
|
}
|
||||||
|
|
||||||
function mkdir(path: url): void {
|
function mkdir(path: url): void {
|
||||||
mkdirProc.path = path.toString().replace("file://", "");
|
Quickshell.execDetached(["mkdir", "-p", strip(path)]);
|
||||||
mkdirProc.startDetached();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
function copy(from: url, to: url): void {
|
||||||
id: mkdirProc
|
Quickshell.execDetached(["cp", strip(from), strip(to)]);
|
||||||
|
|
||||||
property string path
|
|
||||||
|
|
||||||
command: ["mkdir", "-p", path]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue