add select all shortcut to album and playlist pages
This commit is contained in:
@@ -108,6 +108,10 @@ func (a *AlbumPage) Tapped(*fyne.PointEvent) {
|
||||
a.tracklist.UnselectAll()
|
||||
}
|
||||
|
||||
func (a *AlbumPage) SelectAll() {
|
||||
a.tracklist.SelectAll()
|
||||
}
|
||||
|
||||
func (a *AlbumPage) onPlayTrackAt(tracknum int) {
|
||||
a.pm.PlayAlbum(a.albumID, tracknum)
|
||||
}
|
||||
|
||||
@@ -31,6 +31,10 @@ type Searchable interface {
|
||||
SearchWidget() fyne.Focusable
|
||||
}
|
||||
|
||||
type CanSelectAll interface {
|
||||
SelectAll()
|
||||
}
|
||||
|
||||
type CanShowNowPlaying interface {
|
||||
OnSongChange(song *subsonic.Child)
|
||||
}
|
||||
@@ -89,6 +93,12 @@ func (b *BrowsingPane) GetSearchBarIfAny() fyne.Focusable {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *BrowsingPane) SelectAll() {
|
||||
if s, ok := b.curPage.(CanSelectAll); ok {
|
||||
s.SelectAll()
|
||||
}
|
||||
}
|
||||
|
||||
func (b *BrowsingPane) doSetPage(p Page) bool {
|
||||
if b.curPage != nil && b.curPage.Route() == p.Route() {
|
||||
return false
|
||||
|
||||
@@ -99,6 +99,10 @@ func (a *PlaylistPage) Tapped(*fyne.PointEvent) {
|
||||
a.tracklist.UnselectAll()
|
||||
}
|
||||
|
||||
func (a *PlaylistPage) SelectAll() {
|
||||
a.tracklist.SelectAll()
|
||||
}
|
||||
|
||||
func (a *PlaylistPage) onPlayTrackAt(tracknum int) {
|
||||
a.pm.PlayPlaylist(a.playlistID, tracknum)
|
||||
}
|
||||
|
||||
@@ -117,6 +117,9 @@ func (m *MainWindow) addShortcuts() {
|
||||
m.Window.Canvas().Focus(s)
|
||||
}
|
||||
})
|
||||
m.Canvas().AddShortcut(&fyne.ShortcutSelectAll{}, func(_ fyne.Shortcut) {
|
||||
m.BrowsingPane.SelectAll()
|
||||
})
|
||||
|
||||
m.Canvas().SetOnTypedKey(func(e *fyne.KeyEvent) {
|
||||
if e.Name == fyne.KeySpace {
|
||||
|
||||
@@ -170,6 +170,11 @@ func (t *Tracklist) SetNowPlaying(trackID string) {
|
||||
t.list.Refresh()
|
||||
}
|
||||
|
||||
func (t *Tracklist) SelectAll() {
|
||||
t.selectionMgr.SelectAll()
|
||||
t.Refresh()
|
||||
}
|
||||
|
||||
func (t *Tracklist) UnselectAll() {
|
||||
t.selectionMgr.UnselectAll()
|
||||
t.Refresh()
|
||||
|
||||
Reference in New Issue
Block a user