1
0
mirror of https://github.com/taigrr/crocgui synced 2025-01-18 04:03:16 -08:00
crocgui/main.go
2021-03-25 09:59:30 -05:00

46 lines
1.7 KiB
Go

package main
import (
_ "embed"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/layout"
)
//go:embed metadata/en-US/images/featureGraphic.png
var textlogobytes []byte
func main() {
a := app.NewWithID("com.github.howeyc.crocgui")
w := a.NewWindow("croc")
// Defaults
a.Preferences().SetString("relay-address", a.Preferences().StringWithFallback("relay-address", "croc.schollz.com:9009"))
a.Preferences().SetString("relay-password", a.Preferences().StringWithFallback("relay-password", "pass123"))
a.Preferences().SetString("relay-ports", a.Preferences().StringWithFallback("relay-ports", "9009,9010,9011,9012,9013"))
a.Preferences().SetBool("disable-local", a.Preferences().BoolWithFallback("disable-local", false))
a.Preferences().SetBool("force-local", a.Preferences().BoolWithFallback("force-local", false))
a.Preferences().SetBool("disable-multiplexing", a.Preferences().BoolWithFallback("disable-multiplexing", false))
a.Preferences().SetBool("disable-compression", a.Preferences().BoolWithFallback("disable-compression", false))
a.Preferences().SetString("theme", a.Preferences().StringWithFallback("theme", "light"))
setTheme(a.Preferences().String("theme"))
textlogores := fyne.NewStaticResource("text-logo", textlogobytes)
textlogo := canvas.NewImageFromResource(textlogores)
textlogo.SetMinSize(fyne.NewSize(205, 100))
top := container.NewHBox(layout.NewSpacer(), textlogo, layout.NewSpacer())
w.SetContent(container.NewBorder(top, nil, nil, nil,
container.NewAppTabs(
sendTabItem(a, w),
recvTabItem(a, w),
settingsTabItem(a),
aboutTabItem(),
)))
w.Resize(fyne.NewSize(800, 600))
w.ShowAndRun()
}