Доработка интерфейса (vibe-kanban 3c7ecd26)
на данный момент в проекте есть ошибки (я неправильно сделал merge и теперь проект с ошибками) - нужно их исправить, а также пофиксить баг в окне настроек - поле ввода ссылки очень сжатое в длину - нужно пофиксить. Обязательно проверь компиляцию
This commit is contained in:
BIN
hamy-vpn-client.exe
Normal file
BIN
hamy-vpn-client.exe
Normal file
Binary file not shown.
29
main.go
29
main.go
@@ -222,11 +222,16 @@ func main() {
|
|||||||
configWindow.Resize(fyne.NewSize(400, 300))
|
configWindow.Resize(fyne.NewSize(400, 300))
|
||||||
configWindow.SetFixedSize(true)
|
configWindow.SetFixedSize(true)
|
||||||
|
|
||||||
|
// Declare variables before use
|
||||||
|
var listContainer *widget.List
|
||||||
|
var scrollContainer *container.Scroll
|
||||||
|
var refreshList func()
|
||||||
|
|
||||||
// Entry for importing new configuration
|
// Entry for importing new configuration
|
||||||
importEntry := widget.NewEntry()
|
importEntry := widget.NewEntry()
|
||||||
importEntry.PlaceHolder = "vless://..."
|
importEntry.PlaceHolder = "vless://..."
|
||||||
|
|
||||||
// Import button
|
// Import button - define after all necessary variables
|
||||||
importButton := widget.NewButtonWithIcon("", theme.ContentAddIcon(), func() {
|
importButton := widget.NewButtonWithIcon("", theme.ContentAddIcon(), func() {
|
||||||
url := importEntry.Text
|
url := importEntry.Text
|
||||||
if url != "" && isValidVLESS(url) {
|
if url != "" && isValidVLESS(url) {
|
||||||
@@ -244,15 +249,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// Container for import field and button
|
refreshList = func() {
|
||||||
importContainer := container.NewBorder(nil, nil, importEntry, importButton)
|
|
||||||
|
|
||||||
// Create a list of config titles for selection
|
|
||||||
var listContainer *widget.List
|
|
||||||
|
|
||||||
refreshList := func() {
|
|
||||||
// Need to recreate the list since we can't refresh it directly
|
// Need to recreate the list since we can't refresh it directly
|
||||||
listContainer = widget.NewList(
|
newListContainer := widget.NewList(
|
||||||
func() int {
|
func() int {
|
||||||
return len(configs)
|
return len(configs)
|
||||||
},
|
},
|
||||||
@@ -314,16 +313,24 @@ func main() {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
listContainer.OnSelected = func(id widget.ListItemID) {
|
newListContainer.OnSelected = func(id widget.ListItemID) {
|
||||||
activeConfig = id
|
activeConfig = id
|
||||||
dialog.ShowInformation("Config Selected", fmt.Sprintf("Active config: %s", configs[id].Title), configWindow)
|
dialog.ShowInformation("Config Selected", fmt.Sprintf("Active config: %s", configs[id].Title), configWindow)
|
||||||
configWindow.Close()
|
configWindow.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Replace the list container content
|
||||||
|
scrollContainer.Content = newListContainer
|
||||||
|
scrollContainer.Refresh()
|
||||||
|
listContainer = newListContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshList()
|
refreshList()
|
||||||
|
|
||||||
scrollContainer := container.NewScroll(listContainer)
|
scrollContainer = container.NewScroll(listContainer)
|
||||||
|
|
||||||
|
// Container for import field and button - use HBox to allow proper expansion
|
||||||
|
importContainer := container.NewHBox(importEntry, importButton)
|
||||||
|
|
||||||
// Main content for the config window
|
// Main content for the config window
|
||||||
configContent := container.NewVBox(
|
configContent := container.NewVBox(
|
||||||
|
|||||||
Reference in New Issue
Block a user