forked from pion/obs-wormhole
-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.go
52 lines (42 loc) · 1.05 KB
/
home.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"fyne.io/fyne"
"fyne.io/fyne/widget"
)
type HomePage struct {
fyne.Widget
}
func NewHomePage(navigator Navigator) (Page, error) {
errLabel := widget.NewLabel("")
wormholeType := widget.NewSelect([]string{"WebRTC Source", "P2P Streaming"}, nil)
webrtcRole := widget.NewSelect([]string{"Offer", "Answer"}, nil)
form := widget.NewForm(
widget.NewFormItem("Wormhole Type", wormholeType),
widget.NewFormItem("WebRTC Role", webrtcRole),
)
loading := widget.NewProgressBarInfinite()
loading.Hide()
content := widget.NewScrollContainer(
widget.NewVBox(
form,
errLabel,
loading,
))
form.OnSubmit = func() {
if wormholeType.Selected == "" || webrtcRole.Selected == "" {
errLabel.SetText("Type and Role must be set")
} else {
loading.Show()
err := navigator.Push(RouteSignaling, SignalingPageContext{
IsOffer: webrtcRole.Selected == "Offer",
})
loading.Hide()
if err != nil {
errLabel.SetText(err.Error())
}
}
}
return &HomePage{content}, nil
}
func (page *HomePage) BeforeDestroy() {
}