summaryrefslogtreecommitdiff
path: root/splash.go
blob: f6ad7e2ba3cdf2a455247597f53d38e667e708f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package gui

// import "github.com/davecgh/go-spew/spew"
// import "time"
// import "fmt"

import "os"
import "log"
import "runtime"

import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"

func ShowSplashBox(wm *GuiWindow, newText *ui.AttributedString) *GuiBox {
	log.Println("ShowSplashBox() START")
	log.Println("ShowSplashBox() START wm =", wm)
	if (wm == nil) {
		log.Println("ShowSplashBox() WE ARE FUCKED BECAUSE WE DON'T KNOW WHAT WINDOW TO DO THIS IN")
		os.Exit(0)
		return nil
	}
	var gb *GuiBox
	gb = new(GuiBox)

	gb.EntryMap = make(map[string]*GuiEntry)
	gb.EntryMap["test"] = nil

	newbox := ui.NewVerticalBox()
	newbox.SetPadded(true)
	// gw.Box1 = hbox
	gb.UiBox = newbox

	// initialize the GuiArea{}
	wm.Area		= new(GuiArea)
	wm.Area.Window	= wm
	wm.Area.UiAttrstr = newText
	makeSplashArea(wm, wm.Area)
	gb.Area		= wm.Area

	newbox.Append(wm.Area.UiArea, true)

	if runtime.GOOS == "linux" {
		newbox.Append(ui.NewLabel("OS: Linux"), false)
	} else if runtime.GOOS == "windows" {
		newbox.Append(ui.NewLabel("OS: Windows"), false)
	} else {
		newbox.Append(ui.NewLabel("OS: " + runtime.GOOS), false)
	}

	version := "Version: " + Data.Version
	newbox.Append(ui.NewLabel(version), false)

	if (Data.Debug) {
		if (Data.GitCommit != "") {
			tmp := "git rev-list: " + Data.GitCommit
			newbox.Append(ui.NewLabel(tmp), false)
		}
		if (Data.GoVersion != "") {
			tmp := "go build version: " + Data.GoVersion
			newbox.Append(ui.NewLabel(tmp), false)
		}
		if (Data.Buildtime != "") {
			tmp := "build date: " + Data.Buildtime
			newbox.Append(ui.NewLabel(tmp), false)
		}
	}

	log.Println("ShowSplashBox() START wm =", wm)

	okButton := CreateButton(wm, nil, nil, "OK", "AREA", nil)
	newbox.Append(okButton.B, false)

	okButton = CreateButton(wm, nil, nil, "NEWTEXT", "NEWTEXT", nil)
	newbox.Append(okButton.B, false)

	// os.Exit(0)
	return gb
}