migrate gui/splash.go
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
b7445ffea4
commit
d1dafb54dd
7
main.go
7
main.go
|
@ -24,6 +24,7 @@ import "github.com/Showmax/go-fqdn"
|
||||||
var GITCOMMIT string // this is passed in as an ldflag
|
var GITCOMMIT string // this is passed in as an ldflag
|
||||||
var GOVERSION 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
|
var BUILDTIME string // this is passed in as an ldflag
|
||||||
|
const VERSION = "0.2"
|
||||||
|
|
||||||
// use mergo to merge structs
|
// use mergo to merge structs
|
||||||
// import "github.com/imdario/mergo"
|
// import "github.com/imdario/mergo"
|
||||||
|
@ -120,10 +121,6 @@ func main() {
|
||||||
ipAAAA := lookupAAAA(hostname)
|
ipAAAA := lookupAAAA(hostname)
|
||||||
gui.Data.IPv6 = ipAAAA
|
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.MouseClick = mainMouseClick
|
||||||
gui.Data.HomeDir = user.HomeDir
|
gui.Data.HomeDir = user.HomeDir
|
||||||
|
|
||||||
|
@ -144,7 +141,7 @@ func main() {
|
||||||
|
|
||||||
// make this the main loop in an attempt to figure out the crashes
|
// make this the main loop in an attempt to figure out the crashes
|
||||||
// do not change this until the GUI is stable
|
// 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))
|
// This is the handler for all mosue clicks (buttons, areas, etc))
|
||||||
|
|
31
splash.go
31
splash.go
|
@ -1,5 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
import "log"
|
||||||
|
import "runtime"
|
||||||
|
|
||||||
import "git.wit.com/wit/gui"
|
import "git.wit.com/wit/gui"
|
||||||
|
|
||||||
import "github.com/andlabs/ui"
|
import "github.com/andlabs/ui"
|
||||||
|
@ -35,3 +38,31 @@ func getNEWTEXT() *ui.AttributedString {
|
||||||
|
|
||||||
return aText
|
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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue