add loader to wallpicker to consume less ram

This commit is contained in:
lucy 2026-03-20 11:41:56 +01:00
parent e0808edeb5
commit d3b1789b99
5 changed files with 83 additions and 73 deletions

View File

@ -3,24 +3,24 @@ import QtQuick
QtObject { QtObject {
// --- The Backgrounds (Darkest to Lightest) --- // --- The Backgrounds (Darkest to Lightest) ---
readonly property string base00: "#181616" // Default Background readonly property string base00: "#1d1f21" // Default Background
readonly property string base01: "#282727" // Lighter Background (Status bars, panels) readonly property string base01: "#282a2e" // Lighter Background (Status bars, panels)
readonly property string base02: "#393836" // Selection Background readonly property string base02: "#373b41" // Selection Background
readonly property string base03: "#625e5a" // Comments, Invisibles, line highlighting readonly property string base03: "#969896" // Comments, Invisibles, line highlighting
// --- The Foregrounds (Darkest to Lightest) --- // --- The Foregrounds (Darkest to Lightest) ---
readonly property string base04: "#737c73" // Dark Foreground (Used for status bars) readonly property string base04: "#b4b7b4" // Dark Foreground (Used for status bars)
readonly property string base05: "#c5c9c5" // Default Foreground, Caret readonly property string base05: "#c5c8c6" // Default Foreground, Caret
readonly property string base06: "#c8c093" // Light Foreground (Rarely used) readonly property string base06: "#e0e0e0" // Light Foreground (Rarely used)
readonly property string base07: "#c5c9c5" // Lightest Foreground readonly property string base07: "#ffffff" // Lightest Foreground
// --- The Accent Colors --- // --- The Accent Colors ---
readonly property string base08: "#c4746e" // Red (Variables, errors) readonly property string base08: "#cc6666" // Red (Variables, errors)
readonly property string base09: "#b6927b" // Orange (Integers, booleans, constants) readonly property string base09: "#de935f" // Orange (Integers, booleans, constants)
readonly property string base0A: "#c4b28a" // Yellow (Classes, search text bg, warnings) readonly property string base0A: "#f0c674" // Yellow (Classes, search text bg, warnings)
readonly property string base0B: "#8a9a7b" // Green (Strings, success states) readonly property string base0B: "#b5bd68" // Green (Strings, success states)
readonly property string base0C: "#8ea4a2" // Cyan (Support, regex, escape chars) readonly property string base0C: "#8abeb7" // Cyan (Support, regex, escape chars)
readonly property string base0D: "#8ba4b0" // Blue (Functions, methods, headings) readonly property string base0D: "#81a2be" // Blue (Functions, methods, headings)
readonly property string base0E: "#a292a3" // Purple/Mauve (Keywords, storage, selectors) readonly property string base0E: "#b294bb" // Purple/Mauve (Keywords, storage, selectors)
readonly property string base0F: "#b98d7b" // Brown/Flamingo (Deprecated, embedded tags) readonly property string base0F: "#a3685a" // Brown/Flamingo (Deprecated, embedded tags)
} }

View File

@ -32,7 +32,7 @@ Variants {
color: Colors.base00 color: Colors.base00
RowLayout { RowLayout {
id: left id: left
anchors.leftMargin: Settings.config.floating ? 3 : 10 spacing: Settings.config.barSpacing
anchors { anchors {
left: parent.left left: parent.left
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
@ -45,6 +45,7 @@ Variants {
} }
RowLayout { RowLayout {
id: center id: center
spacing: Settings.config.barSpacing
anchors { anchors {
centerIn: parent centerIn: parent
} }
@ -52,10 +53,11 @@ Variants {
} }
RowLayout { RowLayout {
id: right id: right
spacing: Settings.config.barSpacing
anchors { anchors {
right: parent.right right: parent.right
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
rightMargin: Settings.config.floating ? Settings.config.barmargins : 10 rightMargin: Settings.config.floating ? Settings.config.barmargins : 10
} }
StatusIcons {} StatusIcons {}
Tray {} Tray {}

View File

@ -7,61 +7,67 @@ import Qt.labs.folderlistmodel 2.10
import qs import qs
import qs.settings import qs.settings
FloatingWindow { Loader {
id: root active: Settings.config.wallswitchershown
implicitWidth: 700 sourceComponent: root
title: "qs-wallpicker" Component {
implicitHeight: 600 id: root
color: Colors.base00 FloatingWindow {
visible: Settings.config.wallswitchershown implicitWidth: 700
onClosed: Settings.config.wallswitchershown = false title: "qs-wallpicker"
implicitHeight: 600
color: Colors.base00
visible: Settings.config.wallswitchershown
onClosed: Settings.config.wallswitchershown = false
Rectangle {
id: container
radius: Settings.config.rounding
anchors {
fill: parent
margins: 8
}
color: Colors.base02
FolderListModel {
id: wpModel
folder: "file:///home/lucy/.walls/"
nameFilters: ["*.png"]
}
Component {
id: wallDelegate
Rectangle { Rectangle {
id: wpPreview id: container
required property var filePath radius: Settings.config.rounding
implicitWidth: 80 anchors {
implicitHeight: 60 fill: parent
color: "transparent" margins: 8
Image {
asynchronous: true
anchors.fill: parent
source: wpPreview.filePath ? wpPreview.filePath : null
} }
MouseArea { color: Colors.base02
id: updater FolderListModel {
acceptedButtons: Qt.LeftButton id: wpModel
cursorShape: Qt.PointingHandCursor folder: "file:///home/lucy/.walls/"
anchors.fill: parent nameFilters: ["*.png"]
onClicked: { }
Settings.config.currentWall = wpPreview.filePath; Component {
id: wallDelegate
Rectangle {
id: wpPreview
required property var filePath
implicitWidth: 80
implicitHeight: 60
color: "transparent"
Image {
asynchronous: true
anchors.fill: parent
source: wpPreview.filePath ? wpPreview.filePath : null
}
MouseArea {
id: updater
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onClicked: {
Settings.config.currentWall = wpPreview.filePath;
}
}
} }
} }
GridView {
id: wallLayout
anchors.centerIn: parent
anchors.margins: 20
anchors.leftMargin: 40
anchors.fill: parent
clip: true
model: wpModel
delegate: wallDelegate
}
} }
} }
GridView {
id: wallLayout
anchors.centerIn: parent
anchors.margins: 20
anchors.leftMargin: 40
anchors.fill: parent
clip: true
model: wpModel
delegate: wallDelegate
}
} }
} }

View File

@ -25,6 +25,7 @@ Singleton {
property var currentWall property var currentWall
property bool wallswitchershown property bool wallswitchershown
property int barmargins property int barmargins
property int barSpacing
} }
} }
} }

View File

@ -1,11 +1,12 @@
{ {
"barHeight": 38, "barHeight": 32,
"currentWall": "/home/lucy/.walls/mooon.png", "barSpacing": 10,
"barmargins": 6,
"currentWall": "/home/lucy/.walls/frierensuff.png",
"floating": true, "floating": true,
"font": "Maple Mono", "font": "Lora",
"fontSize": 12, "fontSize": 14,
"margins": 10, "margins": 10,
"rounding": 26, "rounding": 26,
"wallswitchershown": false, "wallswitchershown": false
"barmargins": 8
} }