notifs: fix image caching
This commit is contained in:
parent
4da25b5e95
commit
2d000c1052
1 changed files with 13 additions and 9 deletions
|
|
@ -195,15 +195,8 @@ Singleton {
|
||||||
mask: Region {}
|
mask: Region {}
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
anchors.fill: parent
|
function tryCache(): void {
|
||||||
source: Qt.resolvedUrl(notif.image)
|
if (status !== Image.Ready || width != Config.notifs.sizes.image || height != Config.notifs.sizes.image)
|
||||||
fillMode: Image.PreserveAspectCrop
|
|
||||||
cache: false
|
|
||||||
asynchronous: true
|
|
||||||
opacity: 0
|
|
||||||
|
|
||||||
onStatusChanged: {
|
|
||||||
if (status !== Image.Ready)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const cacheKey = notif.appName + notif.summary + notif.id;
|
const cacheKey = notif.appName + notif.summary + notif.id;
|
||||||
|
|
@ -225,6 +218,17 @@ Singleton {
|
||||||
notif.dummyImageLoader.active = false;
|
notif.dummyImageLoader.active = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
source: Qt.resolvedUrl(notif.image)
|
||||||
|
fillMode: Image.PreserveAspectCrop
|
||||||
|
cache: false
|
||||||
|
asynchronous: true
|
||||||
|
opacity: 0
|
||||||
|
|
||||||
|
onStatusChanged: tryCache()
|
||||||
|
onWidthChanged: tryCache()
|
||||||
|
onHeightChanged: tryCache()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue