mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2025-12-06 10:22:50 +08:00
add gui video player window close event
This commit is contained in:
7
core/events/gui.go
Normal file
7
core/events/gui.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package events
|
||||
|
||||
const GUISetPlayerWindowOpenCmd = "cmd.gui.player_window.op"
|
||||
|
||||
type GUISetPlayerWindowOpenCmdEvent struct {
|
||||
SetOpen bool
|
||||
}
|
||||
@@ -47,6 +47,7 @@ var EventsMapping = map[event.EventId]any{
|
||||
MediaProviderUpdate: MediaProviderUpdateEvent{},
|
||||
SearchCmd: SearchCmdEvent{},
|
||||
SearchResultUpdate: SearchResultUpdateEvent{},
|
||||
GUISetPlayerWindowOpenCmd: GUISetPlayerWindowOpenCmdEvent{},
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
18
gui/handler.go
Normal file
18
gui/handler.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package gui
|
||||
|
||||
import (
|
||||
"AynaLivePlayer/core/events"
|
||||
"AynaLivePlayer/global"
|
||||
"AynaLivePlayer/pkg/event"
|
||||
)
|
||||
|
||||
func registerHandlers() {
|
||||
global.EventManager.RegisterA(events.GUISetPlayerWindowOpenCmd, "gui.player.videoplayer.handleopen", func(event *event.Event) {
|
||||
data := event.Data.(events.GUISetPlayerWindowOpenCmdEvent)
|
||||
if data.SetOpen {
|
||||
playerWindow.Close()
|
||||
} else {
|
||||
showPlayerWindow()
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user