summaryrefslogtreecommitdiff
path: root/services/Wallpapers.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-23 13:50:38 +0800
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-23 13:50:38 +0800
commitd3462ee56bf689b40738cdf5e9a3b378e9996d4e (patch)
tree0eb6b5838193383e787d6d0a889c4460d89d1827 /services/Wallpapers.qml
parentdashboard: fix bongo cat playing when no media (diff)
downloadcaelestia-shell-d3462ee56bf689b40738cdf5e9a3b378e9996d4e.tar.gz
caelestia-shell-d3462ee56bf689b40738cdf5e9a3b378e9996d4e.tar.bz2
caelestia-shell-d3462ee56bf689b40738cdf5e9a3b378e9996d4e.zip
internal: fix memory leaks
Diffstat (limited to 'services/Wallpapers.qml')
-rw-r--r--services/Wallpapers.qml24
1 files changed, 10 insertions, 14 deletions
diff --git a/services/Wallpapers.qml b/services/Wallpapers.qml
index 1d2a097..4bfa72f 100644
--- a/services/Wallpapers.qml
+++ b/services/Wallpapers.qml
@@ -12,7 +12,7 @@ Singleton {
readonly property string currentNamePath: `${StandardPaths.standardLocations(StandardPaths.GenericStateLocation)[0]}/caelestia/wallpaper/last.txt`.slice(7)
readonly property string path: `${StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]}/Wallpapers`.slice(7)
- property list<Wallpaper> list
+ readonly property list<Wallpaper> list: wallpapers.instances
property bool showPreview: false
readonly property string current: showPreview ? previewPath : actualCurrent
property string previewPath
@@ -84,23 +84,19 @@ Singleton {
command: ["fd", ".", root.path, "-t", "f", "-e", "jpg", "-e", "jpeg", "-e", "png", "-e", "svg"]
stdout: SplitParser {
splitMarker: ""
- onRead: data => {
- const list = data.trim().split("\n");
- root.list = list.map(p => wallpaperComp.createObject(root, {
- path: p
- }));
- }
+ onRead: data => wallpapers.model = data.trim().split("\n")
}
}
- component Wallpaper: QtObject {
- required property string path
- readonly property string name: path.slice(path.lastIndexOf("/") + 1, path.lastIndexOf("."))
- }
-
- Component {
- id: wallpaperComp
+ Variants {
+ id: wallpapers
Wallpaper {}
}
+
+ component Wallpaper: QtObject {
+ required property string modelData
+ readonly property string path: modelData
+ readonly property string name: path.slice(path.lastIndexOf("/") + 1, path.lastIndexOf("."))
+ }
}