#136: add menu button to album page with options to add album to queue or playlist
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
- [#55](https://github.com/dweymouth/supersonic/issues/55) Show disc number and disc count for multi-disc albums
|
- [#55](https://github.com/dweymouth/supersonic/issues/55) Show disc number and disc count for multi-disc albums
|
||||||
- [#115](https://github.com/dweymouth/supersonic/issues/115) Add search bar to artist, genres, and playlists pages
|
- [#115](https://github.com/dweymouth/supersonic/issues/115) Add search bar to artist, genres, and playlists pages
|
||||||
- [#104](https://github.com/dweymouth/supersonic/issues/104) Add alternate (e.g. external) hostname to server connection config
|
- [#104](https://github.com/dweymouth/supersonic/issues/104) Add alternate (e.g. external) hostname to server connection config
|
||||||
|
- [#136](https://github.com/dweymouth/supersonic/issues/136) Add "..." button to album page with menu to add album to queue or playlist
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
- **todo-commithash** Don't show update available prompt if the found version is the same as the running app version
|
- **todo-commithash** Don't show update available prompt if the found version is the same as the running app version
|
||||||
|
|||||||
@@ -51,6 +51,14 @@ func TrackIDOrEmptyStr(track *subsonic.Child) string {
|
|||||||
return track.ID
|
return track.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TracksToIDs(tracks []*subsonic.Child) []string {
|
||||||
|
ret := make([]string, len(tracks))
|
||||||
|
for i, tr := range tracks {
|
||||||
|
ret[i] = tr.ID
|
||||||
|
}
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
type TrackReorderOp int
|
type TrackReorderOp int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -175,6 +175,23 @@ func NewAlbumPageHeader(page *AlbumPage) *AlbumPageHeader {
|
|||||||
page.pm.LoadTracks(page.tracklist.Tracks, false, true)
|
page.pm.LoadTracks(page.tracklist.Tracks, false, true)
|
||||||
page.pm.PlayFromBeginning()
|
page.pm.PlayFromBeginning()
|
||||||
})
|
})
|
||||||
|
var pop *widget.PopUpMenu
|
||||||
|
menuBtn := widget.NewButtonWithIcon("", theme.MoreHorizontalIcon(), nil)
|
||||||
|
menuBtn.OnTapped = func() {
|
||||||
|
if pop == nil {
|
||||||
|
menu := fyne.NewMenu("",
|
||||||
|
fyne.NewMenuItem("Add to queue", func() {
|
||||||
|
a.page.pm.LoadAlbum(a.albumID, true /*append*/, false /*shuffle*/)
|
||||||
|
}),
|
||||||
|
fyne.NewMenuItem("Add to playlist...", func() {
|
||||||
|
a.page.contr.DoAddTracksToPlaylistWorkflow(
|
||||||
|
sharedutil.TracksToIDs(a.page.tracklist.Tracks))
|
||||||
|
}))
|
||||||
|
pop = widget.NewPopUpMenu(menu, fyne.CurrentApp().Driver().CanvasForObject(a))
|
||||||
|
}
|
||||||
|
pos := fyne.CurrentApp().Driver().AbsolutePositionForObject(menuBtn)
|
||||||
|
pop.ShowAtPosition(fyne.NewPos(pos.X, pos.Y+menuBtn.Size().Height))
|
||||||
|
}
|
||||||
a.toggleFavButton = widgets.NewFavoriteButton(func() { go a.toggleFavorited() })
|
a.toggleFavButton = widgets.NewFavoriteButton(func() { go a.toggleFavorited() })
|
||||||
|
|
||||||
// Todo: there's got to be a way to make this less convoluted. Custom layout?
|
// Todo: there's got to be a way to make this less convoluted. Custom layout?
|
||||||
@@ -184,7 +201,7 @@ func NewAlbumPageHeader(page *AlbumPage) *AlbumPageHeader {
|
|||||||
container.NewVBox(
|
container.NewVBox(
|
||||||
container.New(&layouts.VboxCustomPadding{ExtraPad: -12}, a.artistLabel, a.genreLabel, a.miscLabel),
|
container.New(&layouts.VboxCustomPadding{ExtraPad: -12}, a.artistLabel, a.genreLabel, a.miscLabel),
|
||||||
container.NewVBox(
|
container.NewVBox(
|
||||||
container.NewHBox(util.NewHSpace(2), playButton, shuffleBtn),
|
container.NewHBox(util.NewHSpace(2), playButton, shuffleBtn, menuBtn),
|
||||||
container.NewHBox(util.NewHSpace(2), a.toggleFavButton),
|
container.NewHBox(util.NewHSpace(2), a.toggleFavButton),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user