dweymouth / supersonic

A lightweight and full-featured cross-platform desktop client for self-hosted music servers
GNU General Public License v3.0
668 stars 26 forks source link

chore: Improve 'Add to playlists' dialog #382

Closed natilou closed 1 month ago

natilou commented 1 month ago

Fixes #344

Screenshot from 2024-05-18 16-00-56

Screenshot from 2024-05-18 16-07-00

dweymouth commented 1 month ago

Could we show all the playlists initially instead of an empty list? Note that this behavior would be different from the Quick Search dialog so it would probably need to be handled specially in the Add to playlist dialog implementation

natilou commented 1 month ago

Yes, I can add a list with all the playlists and then filter by the search text

natilou commented 1 month ago

I overrode the Show() method from SearchDialog to populate the results list with all the user's playlists, but I have to call that method in the controller:

m.ClosePopUpOnEscape(pop)
m.haveModal = true
min := sp.MinSize()
height := fyne.Max(min.Height, fyne.Min(min.Height*1.5, m.MainWindow.Canvas().Size().Height*0.7))
sp.SearchDialog.Show() // I added this line to call Show()
pop.Resize(fyne.NewSize(min.Width, height))
pop.Show()
m.MainWindow.Canvas().Focus(sp.GetSearchEntry())

I'm not sure if this implementation is correct or if there is a better way to do it.

dweymouth commented 1 month ago

I'm going to merge this into a feature branch to test and tweak a bit before going to main, hope you don't mind :)