Compare commits
2 commits
90ec41fd05
...
7e359fb730
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e359fb730 | ||
|
|
5d483e6284 |
1 changed files with 24 additions and 9 deletions
|
|
@ -13,6 +13,21 @@ M.BarSection {
|
||||||
|
|
||||||
readonly property MprisPlayer player: Mpris.players.values[0] ?? null
|
readonly property MprisPlayer player: Mpris.players.values[0] ?? null
|
||||||
readonly property bool playing: player?.playbackState === MprisPlaybackState.Playing
|
readonly property bool playing: player?.playbackState === MprisPlaybackState.Playing
|
||||||
|
property string _cachedArt: ""
|
||||||
|
property string _artTrack: ""
|
||||||
|
|
||||||
|
// Cache art URL at root level so it's captured even when panel is hidden
|
||||||
|
readonly property string _artUrl: player?.trackArtUrl ?? ""
|
||||||
|
readonly property string _currentTrack: player?.trackTitle ?? ""
|
||||||
|
on_ArtUrlChanged: if (_artUrl) _cachedArt = _artUrl
|
||||||
|
on_CurrentTrackChanged: if (_currentTrack !== _artTrack) { _artTrack = _currentTrack; _cachedArt = _artUrl || "" }
|
||||||
|
|
||||||
|
// Preload art while panel is hidden — ensures QML image cache has the pixels
|
||||||
|
Image {
|
||||||
|
visible: false
|
||||||
|
source: root._cachedArt
|
||||||
|
asynchronous: true
|
||||||
|
}
|
||||||
|
|
||||||
required property var bar
|
required property var bar
|
||||||
|
|
||||||
|
|
@ -140,7 +155,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,16 +167,16 @@ 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
|
||||||
|
source: root._cachedArt
|
||||||
|
|
||||||
property string _lastGoodSource: ""
|
property bool _hasArt: false
|
||||||
property string _lastTrack: ""
|
onStatusChanged: if (status === Image.Ready) _hasArt = true
|
||||||
readonly property string _artUrl: root.player?.trackArtUrl ?? ""
|
Connections {
|
||||||
readonly property string _track: root.player?.trackTitle ?? ""
|
target: root
|
||||||
on_ArtUrlChanged: if (_artUrl) _lastGoodSource = _artUrl
|
function on_CachedArtChanged() { if (!root._cachedArt) _artImg._hasArt = false }
|
||||||
on_TrackChanged: if (_track !== _lastTrack) { _lastTrack = _track; _lastGoodSource = _artUrl || "" }
|
}
|
||||||
source: _lastGoodSource
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue