1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-28 23:42:51 -05:00

replace qmlformat with a better tool

still not perfect, but well - what can ya do
This commit is contained in:
bbedward
2025-08-08 15:55:37 -04:00
parent 8dc6e2805d
commit 4d408c65f2
137 changed files with 30315 additions and 29625 deletions

View File

@@ -1,4 +1,4 @@
pragma ComponentBehavior: Bound
pragma ComponentBehavior
import QtQuick
import Quickshell
@@ -6,56 +6,56 @@ import Quickshell.Io
import qs.Common
Image {
id: root
id: root
property string imagePath: ""
property string imageHash: ""
property int maxCacheSize: 512
readonly property string cachePath: imageHash ? `${Paths.stringify(Paths.imagecache)}/${imageHash}@${maxCacheSize}x${maxCacheSize}.png` : ""
property string imagePath: ""
property string imageHash: ""
property int maxCacheSize: 512
readonly property string cachePath: imageHash ? `${Paths.stringify(
Paths.imagecache)}/${imageHash}@${maxCacheSize}x${maxCacheSize}.png` : ""
asynchronous: true
fillMode: Image.PreserveAspectCrop
sourceSize.width: maxCacheSize
sourceSize.height: maxCacheSize
smooth: true
onImagePathChanged: {
if (imagePath) {
hashProcess.command = ["sha256sum", Paths.strip(imagePath)];
hashProcess.running = true;
} else {
source = "";
imageHash = "";
}
asynchronous: true
fillMode: Image.PreserveAspectCrop
sourceSize.width: maxCacheSize
sourceSize.height: maxCacheSize
smooth: true
onImagePathChanged: {
if (imagePath) {
hashProcess.command = ["sha256sum", Paths.strip(imagePath)]
hashProcess.running = true
} else {
source = ""
imageHash = ""
}
onCachePathChanged: {
if (imageHash && cachePath) {
Paths.mkdir(Paths.imagecache);
source = cachePath;
}
}
onCachePathChanged: {
if (imageHash && cachePath) {
Paths.mkdir(Paths.imagecache)
source = cachePath
}
onStatusChanged: {
if (source == cachePath && status === Image.Error) {
source = imagePath;
} else if (source == imagePath && status === Image.Ready && imageHash && cachePath) {
Paths.mkdir(Paths.imagecache);
const grabPath = cachePath;
if (visible && width > 0 && height > 0 && Window.window && Window.window.visible)
grabToImage((res) => {
return res.saveToFile(grabPath);
});
}
}
onStatusChanged: {
if (source == cachePath && status === Image.Error) {
source = imagePath
} else if (source == imagePath && status === Image.Ready && imageHash
&& cachePath) {
Paths.mkdir(Paths.imagecache)
const grabPath = cachePath
if (visible && width > 0 && height > 0 && Window.window
&& Window.window.visible)
grabToImage(res => {
return res.saveToFile(grabPath)
})
}
}
Process {
id: hashProcess
stdout: StdioCollector {
onStreamFinished: {
root.imageHash = text.split(" ")[0];
}
}
Process {
id: hashProcess
stdout: StdioCollector {
onStreamFinished: {
root.imageHash = text.split(" ")[0]
}
}
}
}