mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2025-12-07 10:52:49 +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{},
|
MediaProviderUpdate: MediaProviderUpdateEvent{},
|
||||||
SearchCmd: SearchCmdEvent{},
|
SearchCmd: SearchCmdEvent{},
|
||||||
SearchResultUpdate: SearchResultUpdateEvent{},
|
SearchResultUpdate: SearchResultUpdateEvent{},
|
||||||
|
GUISetPlayerWindowOpenCmd: GUISetPlayerWindowOpenCmdEvent{},
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
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