mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
Switched to qmlformat.
This commit is contained in:
@@ -3,8 +3,8 @@ pragma ComponentBehavior
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import qs.Commons
|
||||
import "../Helpers/sha256.js" as Checksum
|
||||
import qs.Commons
|
||||
|
||||
Image {
|
||||
id: root
|
||||
@@ -22,31 +22,31 @@ Image {
|
||||
smooth: true
|
||||
onImagePathChanged: {
|
||||
if (imagePath) {
|
||||
imageHash = Checksum.sha256(imagePath)
|
||||
imageHash = Checksum.sha256(imagePath);
|
||||
// Logger.i("NImageCached", imagePath, imageHash)
|
||||
} else {
|
||||
source = ""
|
||||
imageHash = ""
|
||||
source = "";
|
||||
imageHash = "";
|
||||
}
|
||||
}
|
||||
onCachePathChanged: {
|
||||
if (imageHash && cachePath) {
|
||||
// Try to load the cached version, failure will be detected below in onStatusChanged
|
||||
// Failure is expected and warnings are ok in the console. Don't try to improve without consulting.
|
||||
source = cachePath
|
||||
source = cachePath;
|
||||
}
|
||||
}
|
||||
onStatusChanged: {
|
||||
if (source == cachePath && status === Image.Error) {
|
||||
// Cached image was not available, show the original
|
||||
source = imagePath
|
||||
source = imagePath;
|
||||
} else if (source == imagePath && status === Image.Ready && imageHash && cachePath) {
|
||||
// Original image is shown and fully loaded, time to cache it
|
||||
const grabPath = cachePath
|
||||
const grabPath = cachePath;
|
||||
if (visible && width > 0 && height > 0 && Window.window && Window.window.visible)
|
||||
grabToImage(res => {
|
||||
return res.saveToFile(grabPath)
|
||||
})
|
||||
return res.saveToFile(grabPath);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user