mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 07:22:50 -05:00
better fuzzy search, sweeping clean and qmlfmt of Widgets
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Common
|
||||
|
||||
@@ -9,8 +8,7 @@ Image {
|
||||
property string imagePath: ""
|
||||
property string imageHash: ""
|
||||
property int maxCacheSize: 512
|
||||
readonly property string cachePath: imageHash ? `${Paths.stringify(
|
||||
Paths.imagecache)}/${imageHash}@${maxCacheSize}x${maxCacheSize}.png` : ""
|
||||
readonly property string cachePath: imageHash ? `${Paths.stringify(Paths.imagecache)}/${imageHash}@${maxCacheSize}x${maxCacheSize}.png` : ""
|
||||
|
||||
asynchronous: true
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
@@ -18,32 +16,34 @@ Image {
|
||||
sourceSize.height: maxCacheSize
|
||||
smooth: true
|
||||
onImagePathChanged: {
|
||||
if (imagePath) {
|
||||
hashProcess.command = ["sha256sum", Paths.strip(imagePath)]
|
||||
hashProcess.running = true
|
||||
} else {
|
||||
if (!imagePath) {
|
||||
source = ""
|
||||
imageHash = ""
|
||||
return
|
||||
}
|
||||
hashProcess.command = ["sha256sum", Paths.strip(imagePath)]
|
||||
hashProcess.running = true
|
||||
}
|
||||
onCachePathChanged: {
|
||||
if (imageHash && cachePath) {
|
||||
Paths.mkdir(Paths.imagecache)
|
||||
source = cachePath
|
||||
if (!imageHash || !cachePath) {
|
||||
return
|
||||
}
|
||||
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)
|
||||
})
|
||||
return
|
||||
}
|
||||
if (source != imagePath || status !== Image.Ready || !imageHash || !cachePath) {
|
||||
return
|
||||
}
|
||||
|
||||
Paths.mkdir(Paths.imagecache)
|
||||
const grabPath = cachePath
|
||||
if (visible && width > 0 && height > 0 && Window.window && Window.window.visible) {
|
||||
grabToImage(res => res.saveToFile(grabPath))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,9 +51,7 @@ Image {
|
||||
id: hashProcess
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
root.imageHash = text.split(" ")[0]
|
||||
}
|
||||
onStreamFinished: root.imageHash = text.split(" ")[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user