Merge branch 'clientServFlag' of dan/ui into master

This commit is contained in:
erinn 2019-07-10 13:41:08 -07:00 committed by Gogs
commit 3ba48d3bfd
1 changed files with 12 additions and 11 deletions

23
main.go
View File

@ -39,7 +39,8 @@ func main() {
log.Infoln("ui main()\n")
flagDebug := flag.Bool("debug", false, "turn on extra logging. WARNING: THIS MAY EXPOSE PRIVATE INFORMATION IN CONSOLE OUTPUT!")
flagLocal := flag.Bool("local", false, "load user interface from the local folder \"qml\" instead of the built-in UI")
flagService := flag.Bool("service", false, "indicate this process should run as an android service")
flagService := flag.Bool("service", false, "run this process as an android service")
flagClientUI := flag.Bool("clientui", false, "start the UI as a client of a service app instead of a full app")
flag.Parse()
if *flagDebug {
@ -49,10 +50,10 @@ func main() {
}
// TESTING
log.SetLevel(log.LevelDebug)
log.ExcludeFromPattern("connection/connection")
log.ExcludeFromPattern("outbound/3dhauthchannel")
log.ExcludeFromPattern("event/eventmanager")
//log.SetLevel(log.LevelDebug)
//log.ExcludeFromPattern("connection/connection")
//log.ExcludeFromPattern("outbound/3dhauthchannel")
//log.ExcludeFromPattern("event/eventmanager")
if os.Getenv("CWTCH_FOLDER") != "" {
the.CwtchDir = os.Getenv("CWTCH_FOLDER")
@ -77,7 +78,7 @@ func main() {
mainService()
} else {
mainUi(*flagLocal)
mainUi(*flagLocal, *flagClientUI)
}
if the.ACN != nil {
@ -88,7 +89,7 @@ func main() {
func mainService() {
log.Infoln("I am the service")
log.Infoln("Starting a cwtch app...")
go loadNetworkingAndFiles(nil, true)
go loadNetworkingAndFiles(nil, true, false)
//app := androidextras.NewQAndroidService(len(os.Args), os.Args)
app := gui.NewQGuiApplication(len(os.Args), os.Args)
@ -97,7 +98,7 @@ func mainService() {
}
func mainUi(flagLocal bool) {
func mainUi(flagLocal bool, flagClientUI bool) {
log.Infoln("I am the application")
app := gui.NewQGuiApplication(len(os.Args), os.Args)
@ -172,7 +173,7 @@ func mainUi(flagLocal bool) {
engine.Load(qmlSource)
go loadNetworkingAndFiles(gcd, false)
go loadNetworkingAndFiles(gcd, false, flagClientUI)
log.Infoln("Cwtch App starting app.Exec")
app.Exec()
@ -207,8 +208,8 @@ func loadACN() {
}
}
func loadNetworkingAndFiles(gcd *gothings.GrandCentralDispatcher, service bool) {
if runtime.GOOS == "android" {
func loadNetworkingAndFiles(gcd *gothings.GrandCentralDispatcher, service bool, clientUI bool) {
if service || clientUI || runtime.GOOS == "android" {
clientIn := path.Join(the.CwtchDir, "clientIn")
serviceIn := path.Join(the.CwtchDir, "serviceIn")
if service {