Commit 6b15de31 authored by Loïck Bonniot's avatar Loïck Bonniot

[gui] Refactor to simplify custom Widgets

parent ab8cd887
Pipeline #407 passed with stage
......@@ -7,7 +7,7 @@ import (
)
type Widget struct {
W *ui.QWidget
*ui.QWidget
}
func NewWidget(conf *config.Config, onAuth func()) *Widget {
......@@ -39,7 +39,5 @@ func NewWidget(conf *config.Config, onAuth func()) *Widget {
}
})
return &Widget{
W: form,
}
return &Widget{QWidget: form}
}
set GOARCH=386
set CGO_ENABLED=1
..\..\github.com\visualfc\goqt\bin\goqt_rcc.exe -go main -o application.qrc.go application.qrc
go build -v -ldflags "-H windowsgui" -o ..\bin\gui.exe
\ No newline at end of file
......@@ -23,22 +23,22 @@ func main() {
var newauth *authform.Widget
newauth = authform.NewWidget(&conf, func() {
layout.RemoveWidget(newauth.W)
newauth.W.Hide()
layout.RemoveWidget(newauth)
newauth.Hide()
})
newuser = userform.NewWidget(&conf, func(pwd string) {
layout.RemoveWidget(newuser.W)
newuser.W.Hide()
layout.AddWidget(newauth.W)
layout.RemoveWidget(newuser)
newuser.Hide()
layout.AddWidget(newauth)
})
if conf.Authenticated {
// TODO
} else if conf.Registered {
layout.AddWidget(newauth.W)
layout.AddWidget(newauth)
} else {
layout.AddWidget(newuser.W)
layout.AddWidget(newuser)
}
w := ui.NewWidget()
......@@ -46,8 +46,5 @@ func main() {
w.SetWindowTitle("DFSS Client v" + dfss.Version)
w.SetFixedSizeWithWidthHeight(WIDTH, HEIGHT)
w.Show()
ev := ui.NewCloseEvent()
w.CloseEvent(ev)
})
}
......@@ -9,7 +9,7 @@ import (
)
type Widget struct {
W *ui.QWidget
*ui.QWidget
}
func NewWidget(conf *config.Config, onRegistered func(pw string)) *Widget {
......@@ -65,7 +65,7 @@ func NewWidget(conf *config.Config, onRegistered func(pw string)) *Widget {
feedbackLabel.SetText("Registration aborted.")
})
return &Widget{W: form}
return &Widget{QWidget: form}
}
func copyCA(from string, to string) error {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment