status-desktop/ui/generate-rcc.go
Stefan a710558c6b chore(CPP): foundation for user onboarding
Contains minimal account creation and login

Considerations:

- migrated status-go wrapper and login code from the fix/cpp-structure (241eec)
- Minimal refactoring and changes at the moment. Expect further refactoring
follow up to reach the desired state.
- Fix missing keychain initialization
- Fix accounts DB initialization call done by startup -> Controller.openedAccounts -> status-go.OpenAccounts calls
- Small refactoring and todos for other steps
- fix SignalsManager
- fix async access to dereferenced status-go memory from SignalsManager
- fix SignalsManager not starting when registering
- finish dev end to end test for create account and login
- small improvements and added TODOs for future work
- add onboarding test helpers and start messaging test
- Refactoring towards Login UI integration

Closes: #5909
Closes: #6028
2022-07-07 23:23:09 +02:00

73 lines
1.5 KiB
Go

package main
import (
"flag"
"fmt"
"log"
"os"
"path/filepath"
"strings"
)
var qrcExtensions = map[string]bool{
".qml": true,
".js": true,
".svg": true,
".png": true,
".ico": true,
".icns": true,
".mp3": true,
".wav": true,
".otf": true,
".ttf": true,
".webm": true,
".qm": true,
".txt": true,
".gif": true,
".json": true,
}
func main() {
sourceDirName := flag.String("source", "", "source dir containing ui files")
qrcFileName := flag.String("output", "resources.qrc", "output filename")
flag.Parse()
if flag.NFlag() == 0 {
flag.Usage()
return
}
qrcFile, err := os.Create(*qrcFileName)
if err != nil {
log.Fatalf("Failed creating qrc file: %s", err)
}
defer qrcFile.Close()
qrcFile.WriteString("<!DOCTYPE RCC>\n")
qrcFile.WriteString("<RCC version=\"1.0\">\n")
qrcFile.WriteString(" <qresource>\n")
counter := 0
err = filepath.Walk(*sourceDirName,
func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if !info.IsDir() {
ext := filepath.Ext(path)
base := filepath.Base(path)
if qrcExtensions[ext] || base == "qmldir" {
counter++
fixedPath := strings.ReplaceAll(path, "\\", "/")
fixedPath = "./" + strings.TrimPrefix(fixedPath, *sourceDirName)
qrcFile.WriteString(" <file>" + fixedPath + "</file>\n")
}
}
return nil
})
qrcFile.WriteString(" </qresource>\n")
qrcFile.WriteString("</RCC>")
fmt.Printf("%d resources added\n", counter)
}