make sure to update displayed rating/favorite when changing from list
This commit is contained in:
@@ -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")
|
||||
|
||||
|
||||
@@ -99,6 +99,16 @@ func (n *LargeNowPlayingCard) onSetRating(rating int) {
|
||||
}
|
||||
}
|
||||
|
||||
func (n *LargeNowPlayingCard) SetDisplayedRating(rating int) {
|
||||
n.rating.Rating = rating
|
||||
n.rating.Refresh()
|
||||
}
|
||||
|
||||
func (n *LargeNowPlayingCard) SetDisplayedFavorite(favorite bool) {
|
||||
n.favorite.Favorite = favorite
|
||||
n.favorite.Refresh()
|
||||
}
|
||||
|
||||
func (n *LargeNowPlayingCard) Update(track *mediaprovider.Track) {
|
||||
if track != nil {
|
||||
n.trackName.Segments[0].(*widget.TextSegment).Text = track.Name
|
||||
|
||||
Reference in New Issue
Block a user