Compare commits

...

1 commit
1 ... master

Author SHA1 Message Date
6745dba616 feature: prefs, search, LF-ification 2025-12-13 00:58:52 -08:00

View file

@ -55,10 +55,9 @@ func (t *Threenis) Mumble(server string, username string, password string, chann
}
func Ui() {
myApp := app.New()
myWindow := myApp.NewWindow("Threenis")
myWindow.Resize(fyne.NewSize(800, 400))
myWindow.SetFixedSize(true)
threenisApp := app.NewWithID("threenis")
window := threenisApp.NewWindow("Threenis")
window.Resize(fyne.NewSize(800, 400))
processes := GetProcessStrings()
threenis := Threenis{}
@ -96,14 +95,19 @@ func Ui() {
serverLabel := widget.NewLabel("Server")
server := widget.NewEntry()
server.SetText(threenisApp.Preferences().StringWithFallback("server", ""))
usernameLabel := widget.NewLabel("Username")
username := widget.NewEntry()
username.SetText(threenisApp.Preferences().StringWithFallback("username", ""))
passwordLabel := widget.NewLabel("Password")
password := widget.NewEntry()
password.SetText(threenisApp.Preferences().StringWithFallback("password", ""))
channelLabel := widget.NewLabel("Channel")
channel := widget.NewEntry()
channel.SetText(threenisApp.Preferences().StringWithFallback("channel", ""))
refresh := widget.NewButton("Refresh", func() {
processes = GetProcessStrings()
@ -111,13 +115,31 @@ func Ui() {
})
connect := widget.NewButton("Connect", func() {
threenisApp.Preferences().SetString("server", server.Text)
threenisApp.Preferences().SetString("username", username.Text)
threenisApp.Preferences().SetString("password", password.Text)
threenisApp.Preferences().SetString("channel", channel.Text)
go threenis.Mumble(server.Text, username.Text, password.Text, channel.Text)
})
search := widget.NewEntry()
search.OnChanged = func(s string) {
procs := GetProcessStrings()
processes = make([]string, 0)
for _, proc := range procs {
if strings.Contains(strings.ToLower(proc), strings.ToLower(s)) {
processes = append(processes, proc)
}
}
list.Refresh()
}
content := container.NewBorder(nil, search, nil, nil, list)
form := container.New(layout.NewFormLayout(), serverLabel, server, usernameLabel, username, passwordLabel, password, channelLabel, channel, refresh, connect)
grid := container.New(layout.NewGridLayout(2), list, form)
grid := container.New(layout.NewGridLayout(2), content, form)
myWindow.SetContent(grid)
myWindow.ShowAndRun()
window.SetContent(grid)
window.ShowAndRun()
}