Files
z-bar-qt/Modules/Settings/Pages/Wallpaper/WallpaperSelect.qml
T
zach 7d6f3cc275
C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 20s
JS/TS / lint (pull_request) Successful in 22s
Python / static (pull_request) Successful in 57s
Rust / fmt (pull_request) Successful in 1m2s
C++ / build (pull_request) Successful in 2m10s
Rust / build (pull_request) Successful in 1m50s
Rust / clippy (pull_request) Successful in 1m25s
Python / verify (pull_request) Successful in 2m58s
C++ / clang-tidy (pull_request) Successful in 7m8s
initial commit for media widget update + anim tokens restructure
2026-08-18 16:14:41 +02:00

100 lines
2.1 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import ZShell.Models
import qs.Paths
import qs.Helpers
import qs.Components
import ZShell.Config
import qs.Modules.Settings.Common
import qs.Services
PageBase {
id: root
isSubPage: true
title: qsTr("Wallpapers")
ColumnLayout {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
spacing: Tokens.spacing.small
width: root.cappedWidth
CustomText {
Layout.topMargin: Tokens.spacing.largeIncreased
font.pointSize: Tokens.font.size.large
text: qsTr("Wallpapers")
}
GridLayout {
Layout.fillWidth: true
columnSpacing: Tokens.spacing.extraSmall
columns: 4
rowSpacing: Tokens.spacing.extraSmall
visible: localWalls.count > 0
Repeater {
id: localWalls
model: {
const walls = [...Wallpapers.list];
var baseDir = Paths.wallsdir;
walls.sort((a, b) => ((a.parentDir === baseDir) - (b.parentDir === baseDir)) || a.name.localeCompare(b.name));
while (walls.length < 4)
walls.push(null);
return walls;
}
WallItem {
required property FileSystemEntry modelData
enabled: modelData
opacity: modelData ? 1 : 0
source: String(modelData?.path ?? "")
onClicked: {
Wallpapers.setWallpaper(modelData.path);
root.sState.closeSubPage();
}
}
}
}
Loader {
Layout.fillWidth: true
active: localWalls.count === 0
asynchronous: true
visible: active
sourceComponent: CustomRect {
color: Colors.tPalette.m3surfaceContainer
implicitHeight: noWallsLayout.implicitHeight + Tokens.padding.extraLarge * 3
radius: Tokens.rounding.largeIncreased
ColumnLayout {
id: noWallsLayout
anchors.centerIn: parent
spacing: Tokens.spacing.extraSmall
MaterialIcon {
Layout.alignment: Qt.AlignHCenter
color: Colors.palette.m3outline
text: "hide_image"
}
CustomText {
Layout.alignment: Qt.AlignHCenter
color: Colors.palette.m3outline
text: qsTr("No local wallpapers found")
}
}
}
}
}
}