fix mpris album art: keep visible after temp file deletion

This commit is contained in:
Damocles 2026-04-12 18:39:15 +02:00
parent 90ec41fd05
commit 5d483e6284

View file

@ -140,7 +140,7 @@ M.BarSection {
// Album art // Album art
Item { Item {
width: parent.width width: parent.width
height: _artImg.status === Image.Ready ? 140 : 60 height: _artImg._hasArt ? 140 : 60
clip: true clip: true
Rectangle { Rectangle {
@ -152,15 +152,17 @@ M.BarSection {
id: _artImg id: _artImg
anchors.fill: parent anchors.fill: parent
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
visible: status === Image.Ready visible: _hasArt
asynchronous: true asynchronous: true
property bool _hasArt: false
property string _lastGoodSource: "" property string _lastGoodSource: ""
property string _lastTrack: "" property string _lastTrack: ""
readonly property string _artUrl: root.player?.trackArtUrl ?? "" readonly property string _artUrl: root.player?.trackArtUrl ?? ""
readonly property string _track: root.player?.trackTitle ?? "" readonly property string _track: root.player?.trackTitle ?? ""
on_ArtUrlChanged: if (_artUrl) _lastGoodSource = _artUrl on_ArtUrlChanged: if (_artUrl) _lastGoodSource = _artUrl
on_TrackChanged: if (_track !== _lastTrack) { _lastTrack = _track; _lastGoodSource = _artUrl || "" } on_TrackChanged: if (_track !== _lastTrack) { _lastTrack = _track; _lastGoodSource = _artUrl || ""; _hasArt = false }
onStatusChanged: if (status === Image.Ready) _hasArt = true
source: _lastGoodSource source: _lastGoodSource
} }