make sure to update displayed rating/favorite when changing from list

This commit is contained in:
Drew Weymouth
2024-03-03 13:48:45 -08:00
parent 67c5edbbde
commit eaef666b0c
2 changed files with 22 additions and 2 deletions
+12 -2
View File
@@ -83,8 +83,6 @@ func NewNowPlayingPage(
a.queueList = widgets.NewPlayQueueList(a.im)
a.queueList.OnReorderTracks = a.doSetNewTrackOrder
a.queueList.OnDownload = contr.ShowDownloadDialog
a.queueList.OnSetRating = contr.SetTrackRatings
a.queueList.OnSetFavorite = contr.SetTrackFavorites
a.queueList.OnAddToPlaylist = contr.DoAddTracksToPlaylistWorkflow
a.queueList.OnPlayTrackAt = func(tracknum int) {
_ = a.pm.PlayTrackAt(tracknum)
@@ -96,6 +94,18 @@ func NewNowPlayingPage(
a.queueList.UnselectAll()
a.pm.RemoveTracksFromQueue(trackIDs)
}
a.queueList.OnSetRating = func(trackIDs []string, rating int) {
contr.SetTrackRatings(trackIDs, rating)
if sharedutil.SliceContains(trackIDs, a.nowPlayingID) {
a.card.SetDisplayedRating(rating)
}
}
a.queueList.OnSetFavorite = func(trackIDs []string, fav bool) {
contr.SetTrackFavorites(trackIDs, fav)
if sharedutil.SliceContains(trackIDs, a.nowPlayingID) {
a.card.SetDisplayedFavorite(fav)
}
}
a.statusLabel = widget.NewLabel("Stopped")