feat: add browse and random buttons to wall select
This commit is contained in:
parent
0bbb1c04b7
commit
da3b58118f
2 changed files with 45 additions and 0 deletions
|
|
@ -2,9 +2,12 @@ pragma ComponentBehavior: Bound
|
|||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Caelestia.Components
|
||||
import Caelestia.Config
|
||||
import Caelestia.Models
|
||||
import qs.components
|
||||
import qs.components.controls
|
||||
import qs.components.filedialog
|
||||
import qs.services
|
||||
import qs.utils
|
||||
import qs.modules.nexus.common
|
||||
|
|
@ -21,6 +24,44 @@ PageBase {
|
|||
width: root.cappedWidth
|
||||
spacing: Tokens.spacing.small
|
||||
|
||||
ButtonRow {
|
||||
Layout.bottomMargin: Tokens.spacing.medium
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
spacing: Tokens.spacing.small
|
||||
|
||||
IconTextButton {
|
||||
icon: "photo_library"
|
||||
text: qsTr("Browse")
|
||||
font: Tokens.font.body.large
|
||||
isRound: true
|
||||
shapeMorph: true
|
||||
horizontalPadding: Tokens.padding.extraLarge
|
||||
verticalPadding: Tokens.padding.medium
|
||||
onClicked: browseDialog.open()
|
||||
|
||||
FileDialog {
|
||||
id: browseDialog
|
||||
|
||||
title: qsTr("Select an image")
|
||||
filterLabel: qsTr("Image files")
|
||||
filters: Images.validImageExtensions
|
||||
onAccepted: path => Wallpapers.setWallpaper(path)
|
||||
}
|
||||
}
|
||||
|
||||
IconTextButton {
|
||||
icon: "shuffle"
|
||||
text: qsTr("Random")
|
||||
font: Tokens.font.body.large
|
||||
isRound: true
|
||||
shapeMorph: true
|
||||
horizontalPadding: Tokens.padding.extraLarge
|
||||
verticalPadding: Tokens.padding.medium
|
||||
type: IconTextButton.Tonal
|
||||
onClicked: Wallpapers.setRandom()
|
||||
}
|
||||
}
|
||||
|
||||
WallItem {
|
||||
imgHeight: Math.round(width * 0.3)
|
||||
radius: Tokens.rounding.extraLarge
|
||||
|
|
|
|||
|
|
@ -27,6 +27,10 @@ Searcher {
|
|||
return category;
|
||||
}
|
||||
|
||||
function setRandom(): void {
|
||||
Quickshell.execDetached(["caelestia", "wallpaper", "-r", ...smartArg]);
|
||||
}
|
||||
|
||||
function setWallpaper(path: string): void {
|
||||
actualCurrent = path;
|
||||
Quickshell.execDetached(["caelestia", "wallpaper", "-f", path, ...smartArg]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue