aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui
diff options
context:
space:
mode:
authorAlexander Neumann <alexander.neumann@picos-software.com>2019-04-10 16:37:14 +0200
committerAlexander Neumann <alexander.neumann@picos-software.com>2019-04-23 11:04:59 +0200
commit75e89104ffeec4d6c91879791e7e1e0d170580a3 (patch)
tree47c22f864d3ffffdda2b2da7e12acc65305b77e5 /ui
parentui: use Synchronize method for cross-goroutine calls to walk (diff)
downloadwireguard-windows-75e89104ffeec4d6c91879791e7e1e0d170580a3.tar.xz
wireguard-windows-75e89104ffeec4d6c91879791e7e1e0d170580a3.zip
ui: implement about dialog, version info still TODO
requires https://github.com/lxn/walk/commit/4e27c2831aefc0a8aece021877aa6c8c6e95e290 Signed-off-by: Alexander Neumann <alexander.neumann@picos-software.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/tray.go2
-rw-r--r--ui/ui.go64
2 files changed, 58 insertions, 8 deletions
diff --git a/ui/tray.go b/ui/tray.go
index e5260ae1..c9091211 100644
--- a/ui/tray.go
+++ b/ui/tray.go
@@ -70,7 +70,7 @@ func (tray *Tray) setup() error {
{label: "&Manage tunnels...", handler: tray.mtw.Show, enabled: true},
{label: "&Import tunnel(s) from file...", handler: tray.mtw.onImport, enabled: true},
{separator: true},
- {label: "&About WireGuard", handler: onAbout, enabled: true},
+ {label: "&About WireGuard", handler: func() { onAbout(tray.mtw) }, enabled: true},
{label: "&Quit", handler: onQuit, enabled: true},
} {
var action *walk.Action
diff --git a/ui/ui.go b/ui/ui.go
index 7cc96ee2..8ba8725d 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -92,13 +92,63 @@ func onQuit() {
walk.App().Exit(0)
}
-const aboutText = `
-WireGuard
-TODO.
+func onAbout(owner walk.Form) {
+ vbl := walk.NewVBoxLayout()
+ vbl.SetMargins(walk.Margins{80, 20, 80, 20})
+ vbl.SetSpacing(10)
-Copyright (C) 2019 WireGuard LLC. All Rights Reserved.
-`
+ dlg, _ := walk.NewDialogWithFixedSize(owner)
+ dlg.SetTitle("About WireGuard")
+ dlg.SetLayout(vbl)
-func onAbout() {
- walk.MsgBox(nil, "About WireGuard", aboutText, walk.MsgBoxOK)
+ font, _ := walk.NewFont("Segoe UI", 9, 0)
+ dlg.SetFont(font)
+
+ icon, err := walk.NewIconFromResourceIdWithSize(1, walk.Size{128, 128})
+ if err != nil {
+ panic(err)
+ }
+ dlg.AddDisposable(icon)
+
+ iv, _ := walk.NewImageView(dlg)
+ iv.SetImage(icon)
+
+ wgFont, _ := walk.NewFont("Segoe UI", 16, walk.FontBold)
+
+ wgLbl, _ := walk.NewLabel(dlg)
+ wgLbl.SetFont(wgFont)
+ wgLbl.SetTextAlignment(walk.AlignCenter)
+ wgLbl.SetText("WireGuard")
+
+ detailsLbl, _ := walk.NewTextLabel(dlg)
+ detailsLbl.SetTextAlignment(walk.AlignHCenterVNear)
+
+ detailsLbl.SetText(fmt.Sprintf(`App version: %s
+Go backend version: %s
+
+Copyright © 2019 WireGuard LLC.
+All Rights Reserved.`,
+ "TODO", "TODO"))
+
+ hbl := walk.NewHBoxLayout()
+ hbl.SetMargins(walk.Margins{VNear: 10})
+
+ buttonCP, _ := walk.NewComposite(dlg)
+ buttonCP.SetLayout(hbl)
+
+ walk.NewHSpacer(buttonCP)
+
+ closePB, _ := walk.NewPushButton(buttonCP)
+ closePB.SetAlignment(walk.AlignHCenterVNear)
+ closePB.SetText("Close")
+ closePB.Clicked().Attach(func() {
+ dlg.Accept()
+ })
+
+ walk.NewHSpacer(buttonCP)
+
+ dlg.SetDefaultButton(closePB)
+ dlg.SetCancelButton(closePB)
+
+ dlg.Run()
}