main.go 905 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

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

		newauth = authform.NewWidget(&conf, func() {
26
27
			layout.RemoveWidget(newauth)
			newauth.Hide()
28
29
30
		})

		newuser = userform.NewWidget(&conf, func(pwd string) {
31
32
33
			layout.RemoveWidget(newuser)
			newuser.Hide()
			layout.AddWidget(newauth)
34
35
36
37
38
		})

		if conf.Authenticated {
			// TODO
		} else if conf.Registered {
39
			layout.AddWidget(newauth)
40
		} else {
41
			layout.AddWidget(newuser)
42
		}
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
	})
}