mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2025-12-14 14:08:22 +08:00
Merge 1.0.x branch (#8)
* rewrite * update submodule * make width height configurable * update dependency * update * update file * update dep * fix basic config layout * update plugin management * more stuff * add blacklist * fix todo * fix windows gethandle * update windows update guide * update windows build guide * include go mod tidy in script * update todo * fix source session * fix text output * add plugin play duration control * fix id diange not working * update todo * update version number
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
package gui
|
||||
|
||||
import (
|
||||
"AynaLivePlayer/common/i18n"
|
||||
"AynaLivePlayer/core/events"
|
||||
"AynaLivePlayer/core/model"
|
||||
"AynaLivePlayer/global"
|
||||
"AynaLivePlayer/gui/component"
|
||||
"AynaLivePlayer/internal"
|
||||
"AynaLivePlayer/pkg/event"
|
||||
"AynaLivePlayer/pkg/i18n"
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/dialog"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
@@ -28,22 +29,31 @@ func createSearchBar() fyne.CanvasObject {
|
||||
SearchBar.Button = component.NewAsyncButton(i18n.T("gui.search.search"), func() {
|
||||
keyword := SearchBar.Input.Text
|
||||
pr := SearchBar.UseSource.Selected
|
||||
l().Debugf("Search keyword: %s, provider: %s", keyword, pr)
|
||||
items, err := API.Provider().SearchWithProvider(keyword, pr)
|
||||
if err != nil {
|
||||
dialog.ShowError(err, MainWindow)
|
||||
}
|
||||
model.ApplyUser(items, internal.SystemUser)
|
||||
SearchResult.Items = items
|
||||
logger.Debugf("Search keyword: %s, provider: %s", keyword, pr)
|
||||
SearchResult.mux.Lock()
|
||||
SearchResult.Items = make([]model.Media, 0)
|
||||
SearchResult.List.Refresh()
|
||||
SearchResult.mux.Unlock()
|
||||
global.EventManager.CallA(events.SearchCmd, events.SearchCmdEvent{
|
||||
Keyword: keyword,
|
||||
Provider: pr,
|
||||
})
|
||||
})
|
||||
|
||||
global.EventManager.RegisterA(events.MediaProviderUpdate,
|
||||
"gui.search.provider.update", func(event *event.Event) {
|
||||
providers := event.Data.(events.MediaProviderUpdateEvent)
|
||||
s := make([]string, len(providers.Providers))
|
||||
copy(s, providers.Providers)
|
||||
SearchBar.UseSource.Options = s
|
||||
if len(s) > 0 {
|
||||
SearchBar.UseSource.SetSelected(s[0])
|
||||
}
|
||||
})
|
||||
|
||||
SearchBar.UseSource = widget.NewSelect([]string{}, func(s string) {
|
||||
})
|
||||
s := make([]string, len(API.Provider().GetPriority()))
|
||||
copy(s, API.Provider().GetPriority())
|
||||
|
||||
SearchBar.UseSource = widget.NewSelect(s, func(s string) {})
|
||||
if len(s) > 0 {
|
||||
SearchBar.UseSource.SetSelected(s[0])
|
||||
}
|
||||
searchInput := container.NewBorder(
|
||||
nil, nil, widget.NewLabel(i18n.T("gui.search.search")), SearchBar.Button,
|
||||
container.NewBorder(nil, nil, SearchBar.UseSource, nil, SearchBar.Input))
|
||||
|
||||
Reference in New Issue
Block a user