feat: optimize software installation on windows and add information splash screen on startup
This commit is contained in:
parent
111756ffe5
commit
d851c1b628
4 changed files with 50 additions and 12 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
.settings/
|
||||||
|
MacOSX11.3.sdk
|
||||||
|
MacOSX11.3.sdk.tar.xz
|
||||||
|
packages
|
||||||
BIN
cmd/jws/Icon.png
BIN
cmd/jws/Icon.png
Binary file not shown.
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 259 KiB |
|
|
@ -1,4 +1,3 @@
|
||||||
// cmd/jws/main.go
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
@ -16,8 +15,10 @@ import (
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
"fyne.io/fyne/v2/app"
|
"fyne.io/fyne/v2/app"
|
||||||
|
"fyne.io/fyne/v2/container"
|
||||||
"fyne.io/fyne/v2/dialog"
|
"fyne.io/fyne/v2/dialog"
|
||||||
"fyne.io/fyne/v2/theme"
|
"fyne.io/fyne/v2/theme"
|
||||||
|
"fyne.io/fyne/v2/widget"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed all:projects
|
//go:embed all:projects
|
||||||
|
|
@ -47,19 +48,56 @@ func main() {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Logger.Info("Applikation started")
|
logger.Logger.Info("Application started")
|
||||||
a := app.New()
|
a := app.New()
|
||||||
|
|
||||||
|
showSplashScreen(a, func() {
|
||||||
|
createMainWindow(a, config)
|
||||||
|
})
|
||||||
|
|
||||||
|
a.Run()
|
||||||
|
}
|
||||||
|
|
||||||
|
func showSplashScreen(a fyne.App, onComplete func()) {
|
||||||
|
splash := a.NewWindow("Important Information")
|
||||||
|
splash.SetFixedSize(true)
|
||||||
|
splash.CenterOnScreen()
|
||||||
|
splash.SetPadded(true)
|
||||||
|
|
||||||
|
title := widget.NewLabel("JakartaEE & Spring Boot Starter")
|
||||||
|
title.TextStyle = fyne.TextStyle{Bold: true}
|
||||||
|
title.Alignment = fyne.TextAlignCenter
|
||||||
|
|
||||||
|
infoText := widget.NewLabel("Please note:\n\n" +
|
||||||
|
"• On Windows, a functional Winget installation is required.\n" +
|
||||||
|
"• Administrator rights may be needed at some points.\n\n" +
|
||||||
|
"Click 'Continue' when you're ready to proceed.")
|
||||||
|
infoText.Wrapping = fyne.TextWrapWord
|
||||||
|
|
||||||
|
continueButton := widget.NewButton("Continue", func() {
|
||||||
|
splash.Close()
|
||||||
|
onComplete()
|
||||||
|
})
|
||||||
|
|
||||||
|
content := container.NewVBox(
|
||||||
|
title,
|
||||||
|
infoText,
|
||||||
|
continueButton,
|
||||||
|
)
|
||||||
|
|
||||||
|
splash.SetContent(content)
|
||||||
|
splash.Show()
|
||||||
|
}
|
||||||
|
|
||||||
|
func createMainWindow(a fyne.App, config *config.Config) {
|
||||||
mainWindow = a.NewWindow("JakartaEE & Spring Boot Starter")
|
mainWindow = a.NewWindow("JakartaEE & Spring Boot Starter")
|
||||||
mainWindow.Resize(fyne.NewSize(600, 600))
|
mainWindow.Resize(fyne.NewSize(600, 600))
|
||||||
// mainWindow.SetFixedSize(true)
|
|
||||||
|
|
||||||
// Initialize dependencies
|
|
||||||
dependencies = []dependency.Dependency{
|
dependencies = []dependency.Dependency{
|
||||||
{Name: "Visual Studio Code", Installed: false, Icon: theme.DocumentIcon()},
|
{Name: "Visual Studio Code", Installed: false, Icon: theme.DocumentIcon()},
|
||||||
{Name: "Docker", Installed: false, Icon: theme.MediaPlayIcon()},
|
{Name: "Docker", Installed: false, Icon: theme.MediaPlayIcon()},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Standard projects
|
|
||||||
standartProjects := []project.Project{
|
standartProjects := []project.Project{
|
||||||
{
|
{
|
||||||
Name: "JakartaEE Todo-App mit Servlet",
|
Name: "JakartaEE Todo-App mit Servlet",
|
||||||
|
|
@ -83,7 +121,6 @@ func main() {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load additional projects from projects.json
|
|
||||||
pluginProjects, err := loadProjects(filepath.Join(config.ProjectsPath, "projects.json"))
|
pluginProjects, err := loadProjects(filepath.Join(config.ProjectsPath, "projects.json"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dialog.ShowError(fmt.Errorf("error loading projects: %v", err), mainWindow)
|
dialog.ShowError(fmt.Errorf("error loading projects: %v", err), mainWindow)
|
||||||
|
|
@ -92,11 +129,9 @@ func main() {
|
||||||
|
|
||||||
projects = append(standartProjects, pluginProjects...)
|
projects = append(standartProjects, pluginProjects...)
|
||||||
|
|
||||||
// Initialize packages
|
|
||||||
gui.Init(mainWindow, dependencies, projects, projectsFS)
|
gui.Init(mainWindow, dependencies, projects, projectsFS)
|
||||||
project.Init(projects, config)
|
project.Init(projects, config)
|
||||||
|
|
||||||
// Check dependencies
|
|
||||||
dependency.CheckDependencies(dependencies)
|
dependency.CheckDependencies(dependencies)
|
||||||
allInstalled := true
|
allInstalled := true
|
||||||
for _, dep := range dependencies {
|
for _, dep := range dependencies {
|
||||||
|
|
@ -106,14 +141,13 @@ func main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show appropriate screen
|
|
||||||
if allInstalled {
|
if allInstalled {
|
||||||
gui.ShowProjectScreen()
|
gui.ShowProjectScreen()
|
||||||
} else {
|
} else {
|
||||||
gui.ShowDependencyScreen()
|
gui.ShowDependencyScreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
mainWindow.ShowAndRun()
|
mainWindow.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadProjects(filePath string) ([]project.Project, error) {
|
func loadProjects(filePath string) ([]project.Project, error) {
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ func installWindowsDependencies(index int, cmd *exec.Cmd, mainWindow *fyne.Windo
|
||||||
switch index {
|
switch index {
|
||||||
case 0: // VSCode
|
case 0: // VSCode
|
||||||
cmd = tools.CommandInShell("winget", "install", "-e", "--id",
|
cmd = tools.CommandInShell("winget", "install", "-e", "--id",
|
||||||
"Microsoft.VisualStudioCode")
|
"Microsoft.VisualStudioCode", "--accept-package-agreements", "--accept-source-agreements", "--silent")
|
||||||
case 1: // Docker Desktop
|
case 1: // Docker Desktop
|
||||||
wslCheckCmd := tools.CommandInShell("wsl", "--status")
|
wslCheckCmd := tools.CommandInShell("wsl", "--status")
|
||||||
err := wslCheckCmd.Run()
|
err := wslCheckCmd.Run()
|
||||||
|
|
@ -154,7 +154,7 @@ func installWindowsDependencies(index int, cmd *exec.Cmd, mainWindow *fyne.Windo
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
cmd = tools.CommandInShell("winget", "install", "-e", "--id",
|
cmd = tools.CommandInShell("winget", "install", "-e", "--id",
|
||||||
"Docker.DockerDesktop")
|
"Docker.DockerDesktop", "--accept-package-agreements", "--accept-source-agreements", "--silent")
|
||||||
}
|
}
|
||||||
return cmd, nil
|
return cmd, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue