main.go 966 Bytes
Newer Older
1
2
package main

Loïck Bonniot's avatar
Loïck Bonniot committed
3
4
import (
	"dfss"
5
	"dfss/gui/authform"
6
	"dfss/gui/config"
Loïck Bonniot's avatar
Loïck Bonniot committed
7
8
9
10
11
12
	"dfss/gui/userform"
	"github.com/visualfc/goqt/ui"
)

const WIDTH = 650
const HEIGHT = 350
13
14

func main() {
15
16
17
18
	// Load configuration
	conf := config.Load()

	// Start first window
19
	ui.Run(func() {
Loïck Bonniot's avatar
Loïck Bonniot committed
20
		layout := ui.NewVBoxLayout()
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

		var newuser *userform.Widget
		var newauth *authform.Widget

		newauth = authform.NewWidget(&conf, func() {
			layout.RemoveWidget(newauth.W)
			newauth.W.Hide()
		})

		newuser = userform.NewWidget(&conf, func(pwd string) {
			layout.RemoveWidget(newuser.W)
			newuser.W.Hide()
			layout.AddWidget(newauth.W)
		})

		if conf.Authenticated {
			// TODO
		} else if conf.Registered {
			layout.AddWidget(newauth.W)
		} else {
			layout.AddWidget(newuser.W)
		}
43

Loïck Bonniot's avatar
Loïck Bonniot committed
44
45
46
47
48
		w := ui.NewWidget()
		w.SetLayout(layout)
		w.SetWindowTitle("DFSS Client v" + dfss.Version)
		w.SetFixedSizeWithWidthHeight(WIDTH, HEIGHT)
		w.Show()
49
50
51

		ev := ui.NewCloseEvent()
		w.CloseEvent(ev)
52
53
	})
}