Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Improve 'Add to playlists' dialog #382

Merged

Conversation

natilou
Copy link
Contributor

@natilou natilou commented May 5, 2024

Fixes #344

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

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

@dweymouth
Copy link
Owner

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
Copy link
Contributor Author

natilou commented May 9, 2024

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

@natilou natilou marked this pull request as draft May 18, 2024 15:04
@natilou
Copy link
Contributor Author

natilou commented May 18, 2024

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.

@@ -179,4 +179,5 @@ type SearchResult struct {

// Unset for ContentTypes Artist, Playlist, and Genre
ArtistName string
Query string
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about adding Query to the SearchResult model, since that isn't really part of the search result per se. Instead, maybe the searchdialog can expose the query through another function call (SearchDialog.QueryText()?)

ArtistName: playlist.Name,
})
}
skipDuplicatesCheck := widget.NewCheck("Skip duplicates", func(checked bool) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can probably use NewCheckWithData here so that the state of the checkbox is automatically kept in sync with the sp.SkipDuplicates bool

@dweymouth dweymouth changed the base branch from main to improve-playlist-dialog May 23, 2024 15:41
@dweymouth
Copy link
Owner

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 :)

@dweymouth dweymouth marked this pull request as ready for review May 23, 2024 15:41
@dweymouth dweymouth merged commit 84d4208 into dweymouth:improve-playlist-dialog May 23, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve "Add to Playlist" dialog
2 participants