add Shuffle context menu item to tracklist; unselect tracks on Favorites page by clicking outside
This commit is contained in:
@@ -132,6 +132,12 @@ func (a *FavoritesPage) Route() controller.Route {
|
|||||||
return controller.FavoritesRoute()
|
return controller.FavoritesRoute()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *FavoritesPage) Tapped(*fyne.PointEvent) {
|
||||||
|
if a.tracklistCtr != nil {
|
||||||
|
a.tracklistCtr.Objects[0].(*widgets.Tracklist).UnselectAll()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (a *FavoritesPage) Reload() {
|
func (a *FavoritesPage) Reload() {
|
||||||
// reload favorite albums view
|
// reload favorite albums view
|
||||||
if a.searchText != "" {
|
if a.searchText != "" {
|
||||||
|
|||||||
@@ -101,8 +101,8 @@ func (m *Controller) ConnectTracklistActions(tracklist *widgets.Tracklist) {
|
|||||||
m.App.PlaybackManager.LoadTracks(tracklist.Tracks, false, false)
|
m.App.PlaybackManager.LoadTracks(tracklist.Tracks, false, false)
|
||||||
m.App.PlaybackManager.PlayTrackAt(idx)
|
m.App.PlaybackManager.PlayTrackAt(idx)
|
||||||
}
|
}
|
||||||
tracklist.OnPlaySelection = func(tracks []*subsonic.Child) {
|
tracklist.OnPlaySelection = func(tracks []*subsonic.Child, shuffle bool) {
|
||||||
m.App.PlaybackManager.LoadTracks(tracks, false, false)
|
m.App.PlaybackManager.LoadTracks(tracks, false, shuffle)
|
||||||
m.App.PlaybackManager.PlayFromBeginning()
|
m.App.PlaybackManager.PlayFromBeginning()
|
||||||
}
|
}
|
||||||
tracklist.OnSetFavorite = m.SetTrackFavorites
|
tracklist.OnSetFavorite = m.SetTrackFavorites
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ type Tracklist struct {
|
|||||||
|
|
||||||
// user action callbacks
|
// user action callbacks
|
||||||
OnPlayTrackAt func(int)
|
OnPlayTrackAt func(int)
|
||||||
OnPlaySelection func(tracks []*subsonic.Child)
|
OnPlaySelection func(tracks []*subsonic.Child, shuffle bool)
|
||||||
OnAddToQueue func(trackIDs []*subsonic.Child)
|
OnAddToQueue func(trackIDs []*subsonic.Child)
|
||||||
OnAddToPlaylist func(trackIDs []string)
|
OnAddToPlaylist func(trackIDs []string)
|
||||||
OnSetFavorite func(trackIDs []string, fav bool)
|
OnSetFavorite func(trackIDs []string, fav bool)
|
||||||
@@ -283,7 +283,13 @@ func (t *Tracklist) onShowContextMenu(e *fyne.PointEvent, trackIdx int) {
|
|||||||
t.ctxMenu.Items = append(t.ctxMenu.Items,
|
t.ctxMenu.Items = append(t.ctxMenu.Items,
|
||||||
fyne.NewMenuItem("Play", func() {
|
fyne.NewMenuItem("Play", func() {
|
||||||
if t.OnPlaySelection != nil {
|
if t.OnPlaySelection != nil {
|
||||||
t.OnPlaySelection(t.selectedTracks())
|
t.OnPlaySelection(t.selectedTracks(), false)
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
t.ctxMenu.Items = append(t.ctxMenu.Items,
|
||||||
|
fyne.NewMenuItem("Shuffle", func() {
|
||||||
|
if t.OnPlaySelection != nil {
|
||||||
|
t.OnPlaySelection(t.selectedTracks(), true)
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
t.ctxMenu.Items = append(t.ctxMenu.Items,
|
t.ctxMenu.Items = append(t.ctxMenu.Items,
|
||||||
|
|||||||
Reference in New Issue
Block a user