diff --git a/main.go b/main.go index 79a7be8..3db0990 100644 --- a/main.go +++ b/main.go @@ -24,6 +24,7 @@ import "github.com/Showmax/go-fqdn" var GITCOMMIT string // this is passed in as an ldflag var GOVERSION string // this is passed in as an ldflag var BUILDTIME string // this is passed in as an ldflag +const VERSION = "0.2" // use mergo to merge structs // import "github.com/imdario/mergo" @@ -120,10 +121,6 @@ func main() { ipAAAA := lookupAAAA(hostname) gui.Data.IPv6 = ipAAAA - gui.Data.Version = "v0.2" - gui.Data.GitCommit = GITCOMMIT - gui.Data.GoVersion = GOVERSION - gui.Data.Buildtime = BUILDTIME gui.Data.MouseClick = mainMouseClick gui.Data.HomeDir = user.HomeDir @@ -144,7 +141,7 @@ func main() { // make this the main loop in an attempt to figure out the crashes // do not change this until the GUI is stable - gui.StartNewWindow(config, false, "SPLASH", getNEWTEXT) + gui.StartNewWindow(config, false, "SPLASH", showSplashBox) } // This is the handler for all mosue clicks (buttons, areas, etc)) diff --git a/splash.go b/splash.go index ff8efa2..08055db 100644 --- a/splash.go +++ b/splash.go @@ -1,5 +1,8 @@ package main +import "log" +import "runtime" + import "git.wit.com/wit/gui" import "github.com/andlabs/ui" @@ -35,3 +38,31 @@ func getNEWTEXT() *ui.AttributedString { return aText } + +func showSplashBox(gw *gui.GuiWindow) *gui.GuiBox{ + log.Println("ShowSplashBox() START") + text := getNEWTEXT() + box := gui.ShowTextBox(gw, text) + + if runtime.GOOS == "linux" { + gui.NewLabel(box,"OS: Linux") + } else if runtime.GOOS == "windows" { + gui.NewLabel(box,"OS: Windows") + } else { + gui.NewLabel(box,"OS: " + runtime.GOOS) + } + + gui.NewLabel(box, "Version: " + VERSION) + + if (config.Debug) { + gui.NewLabel(box, "git rev-list: " + GITCOMMIT) + gui.NewLabel(box, "go build version: " + GOVERSION) + gui.NewLabel(box, "build date: " + BUILDTIME) + } + + okButton := gui.CreateButton(box, nil, nil, "OK", "AREA", nil) + gui.AddButtonToBox(box, okButton) + + log.Println("ShowSplashBox() END box =", box) + return box +}