2019-05-29 17:46:37 -05:00
package main
2019-06-01 03:19:51 -05:00
import "log"
import "runtime"
2019-05-29 17:46:37 -05:00
import "git.wit.com/wit/gui"
2019-06-06 22:56:14 -05:00
import "git.wit.com/wit/shell"
2019-05-29 17:46:37 -05:00
import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"
2019-06-03 16:40:40 -05:00
// import pb "git.wit.com/wit/witProtobuf"
2019-06-01 19:53:30 -05:00
2019-06-13 16:16:29 -05:00
func showSplashBox ( box * gui . GuiBox ) * gui . GuiBox {
2019-06-01 04:12:46 -05:00
log . Println ( "ShowSplashBox() START" )
2019-06-13 16:16:29 -05:00
2019-06-03 14:56:20 -05:00
// TODO: turn 'Welcome' into a i18n for translations
2019-06-13 17:31:29 -05:00
text := getNEWTEXT ( )
2019-06-13 16:16:29 -05:00
gui . ShowTextBox ( box , text , splashClick , "Welcome" )
2019-06-13 17:31:29 -05:00
// box.Window.UiWindow.SetTitle("Splash")
2019-06-13 16:16:29 -05:00
gui . HorizontalBreak ( box )
gui . NewLabel ( box , "jcarr test2" )
2019-06-01 04:12:46 -05:00
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 )
}
2019-06-06 22:56:14 -05:00
if ( config . Dirty ) {
gui . NewLabel ( box , "Version: " + config . Version + " (dirty)" )
} else {
gui . NewLabel ( box , "Version: " + config . Version )
}
2019-06-01 04:12:46 -05:00
2019-06-03 14:56:20 -05:00
if ( config . Debug ) {
2019-06-05 04:52:35 -05:00
gui . NewLabel ( box , "git rev-list: " + config . Gitref )
gui . NewLabel ( box , "go build version: " + config . Goversion )
2019-06-06 22:56:14 -05:00
gui . NewLabel ( box , "build date: " + shell . Chomp ( config . Builddate ) )
2019-06-01 04:12:46 -05:00
}
2019-06-03 14:56:20 -05:00
button := makeButton ( box , nil , nil , "OK" , "AREA" , splashClick )
if ( config . Debug ) {
debugClick ( button )
}
2019-06-01 04:12:46 -05:00
log . Println ( "ShowSplashBox() END box =" , box )
return box
2019-05-29 17:46:37 -05:00
}
func getNEWTEXT ( ) * ui . AttributedString {
var aText * ui . AttributedString
aText = ui . NewAttributedString ( "" )
gui . AreaAppendText ( aText , "Welcome to the Cloud Control Panel\n" , ui . TextSize ( 16 ) , ui . TextColor { 0.0 , 0.0 , 0.8 , .8 } )
gui . AreaAppendText ( aText , "(alpha)\n\n" , ui . TextSize ( 10 ) )
gui . AreaAppendText ( aText , "This control panel was designed to be an interface to your 'private' cloud. " , ui . TextWeightBold )
gui . AreaAppendText ( aText , "The concept of a private cloud means that you can use a providers system, or, seemlessly, use your own hardware in your own datacenter. " , ui . TextWeightBold )
aText . AppendUnattributed ( "\n" )
aText . AppendUnattributed ( "\n" )
gui . AreaAppendText ( aText , "This control panel requires:\n" )
aText . AppendUnattributed ( "\n" )
gui . AreaAppendText ( aText , "IPv6\n" )
gui . AreaAppendText ( aText , "Your hostname in DNS\n" )
aText . AppendUnattributed ( "\n\n\n\n\n" )
gui . AreaAppendText ( aText , "<click or press any key>\n" , ui . TextSize ( 10 ) )
return aText
}
2019-06-01 03:19:51 -05:00
2019-06-02 08:21:12 -05:00
func splashClick ( b * gui . GuiButton ) {
2019-06-02 21:56:14 -05:00
log . Println ( "splashClick() START" )
2019-06-02 08:21:12 -05:00
gw := b . Box . Window
// if there is already an account, skip straight to the main screen
for key , _ := range config . Accounts {
log . Println ( "gui.State = splash BUT THERE IS AN ACCOUNT Account = " , config . Accounts [ key ] )
makeCloudInfoBox ( gw )
return
}
2019-06-03 16:40:40 -05:00
2019-06-13 14:08:16 -05:00
// gw.UiTab.Delete(0) // does this make things more or less stable or neither?
2019-06-03 16:40:40 -05:00
createAccount ( gw )
log . Println ( "splashClick() END" )
2019-06-01 04:12:46 -05:00
}