remove Query from mediaprovider.SearchResult
This commit is contained in:
@@ -179,5 +179,4 @@ type SearchResult struct {
|
|||||||
|
|
||||||
// Unset for ContentTypes Artist, Playlist, and Genre
|
// Unset for ContentTypes Artist, Playlist, and Genre
|
||||||
ArtistName string
|
ArtistName string
|
||||||
Query string
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -333,10 +333,10 @@ func (m *Controller) DoAddTracksToPlaylistWorkflow(trackIDs []string) {
|
|||||||
pop.Hide()
|
pop.Hide()
|
||||||
m.doModalClosed()
|
m.doModalClosed()
|
||||||
})
|
})
|
||||||
sp.SetOnNavigateTo(func(contentType mediaprovider.ContentType, id string, query string) {
|
sp.SetOnNavigateTo(func(contentType mediaprovider.ContentType, id string) {
|
||||||
pop.Hide()
|
pop.Hide()
|
||||||
if id == "" {
|
if id == "" /* creating new playlist */ {
|
||||||
go m.App.ServerManager.Server.CreatePlaylist(query, trackIDs)
|
go m.App.ServerManager.Server.CreatePlaylist(sp.SearchDialog.SearchQuery(), trackIDs)
|
||||||
} else {
|
} else {
|
||||||
m.App.Config.Application.DefaultPlaylistID = id
|
m.App.Config.Application.DefaultPlaylistID = id
|
||||||
if sp.SkipDuplicates {
|
if sp.SkipDuplicates {
|
||||||
@@ -628,7 +628,7 @@ func (c *Controller) ShowQuickSearch() {
|
|||||||
pop.Hide()
|
pop.Hide()
|
||||||
c.doModalClosed()
|
c.doModalClosed()
|
||||||
})
|
})
|
||||||
qs.SetOnNavigateTo(func(contentType mediaprovider.ContentType, id string, query string) {
|
qs.SetOnNavigateTo(func(contentType mediaprovider.ContentType, id string) {
|
||||||
pop.Hide()
|
pop.Hide()
|
||||||
c.doModalClosed()
|
c.doModalClosed()
|
||||||
switch contentType {
|
switch contentType {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ func (q *QuickSearch) SetOnDismiss(onDismiss func()) {
|
|||||||
q.SearchDialog.OnDismiss = onDismiss
|
q.SearchDialog.OnDismiss = onDismiss
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *QuickSearch) SetOnNavigateTo(onNavigateTo func(mediaprovider.ContentType, string, string)) {
|
func (q *QuickSearch) SetOnNavigateTo(onNavigateTo func(mediaprovider.ContentType, string)) {
|
||||||
q.SearchDialog.OnNavigateTo = onNavigateTo
|
q.SearchDialog.OnNavigateTo = onNavigateTo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ type SearchDialog struct {
|
|||||||
widget.BaseWidget
|
widget.BaseWidget
|
||||||
|
|
||||||
OnDismiss func()
|
OnDismiss func()
|
||||||
OnNavigateTo func(mediaprovider.ContentType, string, string)
|
OnNavigateTo func(mediaprovider.ContentType, string)
|
||||||
OnSearched func(string) []*mediaprovider.SearchResult
|
OnSearched func(string) []*mediaprovider.SearchResult
|
||||||
OnInit func() ([]*mediaprovider.SearchResult, *widget.Check)
|
OnInit func() ([]*mediaprovider.SearchResult, *widget.Check)
|
||||||
|
|
||||||
@@ -82,10 +82,16 @@ func NewSearchDialog(im util.ImageFetcher, placeholderTitle string, onSearched f
|
|||||||
return sd
|
return sd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetSearchEntry returns the search Entry widget for focusing
|
||||||
func (sd *SearchDialog) GetSearchEntry() fyne.Focusable {
|
func (sd *SearchDialog) GetSearchEntry() fyne.Focusable {
|
||||||
return sd.searchEntry
|
return sd.searchEntry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SearchQuery returns the current search query entered by the user
|
||||||
|
func (sd *SearchDialog) SearchQuery() string {
|
||||||
|
return sd.searchEntry.Text
|
||||||
|
}
|
||||||
|
|
||||||
func (sd *SearchDialog) Show() {
|
func (sd *SearchDialog) Show() {
|
||||||
sd.onInit()
|
sd.onInit()
|
||||||
sd.BaseWidget.Show()
|
sd.BaseWidget.Show()
|
||||||
@@ -108,9 +114,8 @@ func (sd *SearchDialog) onSelected(idx int) {
|
|||||||
}
|
}
|
||||||
id := sd.searchResults[idx].ID
|
id := sd.searchResults[idx].ID
|
||||||
typ := sd.searchResults[idx].Type
|
typ := sd.searchResults[idx].Type
|
||||||
query := sd.searchResults[idx].Query
|
|
||||||
sd.resultsMutex.RUnlock()
|
sd.resultsMutex.RUnlock()
|
||||||
sd.OnNavigateTo(typ, id, query)
|
sd.OnNavigateTo(typ, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sd *SearchDialog) moveSelectionDown() {
|
func (sd *SearchDialog) moveSelectionDown() {
|
||||||
|
|||||||
@@ -79,9 +79,8 @@ func (sp *SelectPlaylist) onSearched(query string) []*mediaprovider.SearchResult
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
results = append(results, &mediaprovider.SearchResult{
|
results = append(results, &mediaprovider.SearchResult{
|
||||||
Name: fmt.Sprintf("Create new playlist: %s", query),
|
Name: fmt.Sprintf("Create new playlist: %s", query),
|
||||||
Type: mediaprovider.ContentTypePlaylist,
|
Type: mediaprovider.ContentTypePlaylist,
|
||||||
Query: query,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +101,7 @@ func (sp *SelectPlaylist) SetOnDismiss(onDismiss func()) {
|
|||||||
sp.SearchDialog.OnDismiss = onDismiss
|
sp.SearchDialog.OnDismiss = onDismiss
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sp *SelectPlaylist) SetOnNavigateTo(onNavigateTo func(mediaprovider.ContentType, string, string)) {
|
func (sp *SelectPlaylist) SetOnNavigateTo(onNavigateTo func(mediaprovider.ContentType, string)) {
|
||||||
sp.SearchDialog.OnNavigateTo = onNavigateTo
|
sp.SearchDialog.OnNavigateTo = onNavigateTo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user