pragma ComponentBehavior: Bound import QtQuick import QtQuick.Layouts import Caelestia.Config import Caelestia.Models import qs.components import qs.services import qs.utils import qs.modules.nexus.common PageBase { id: root title: qsTr("Wallpaper") isSubPage: true ColumnLayout { anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top width: root.cappedWidth spacing: Tokens.spacing.small WallItem { imgHeight: Math.round(width * 0.3) radius: Tokens.rounding.extraLarge source: Wallpapers.current text: qsTr("Featured wallpaper") fillLabel: false onClicked: ; // TODO } StyledText { Layout.topMargin: Tokens.spacing.large text: qsTr("Local wallpapers") font: Tokens.font.title.small } GridLayout { Layout.fillWidth: true columns: Config.nexus.wallpapersPerRow rowSpacing: Tokens.spacing.medium columnSpacing: Tokens.spacing.large Repeater { model: { const walls = Wallpapers.list; const baseDir = Paths.wallsdir; const categories = {}; for (const w of walls) { if (w.parentDir !== baseDir) { const category = Wallpapers.getCategoryFor(w); if (category && !(category in categories)) categories[category] = w; } } return Object.values(categories); } WallItem { required property FileSystemEntry modelData source: modelData.path text: { if (modelData.parentDir !== Paths.wallsdir) { const category = Wallpapers.getCategoryFor(modelData); return category.slice(0, 1).toUpperCase() + category.slice(1); } return modelData.name; } onClicked: { if (modelData.parentDir !== Paths.wallsdir) { root.nState.selectedWallpaperCategory = Wallpapers.getCategoryFor(modelData); root.nState.openSubPage(2); } else { Wallpapers.setWallpaper(modelData.path); } } } } } } }