aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/ui.go
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
commit055f53c553de1ba10a4e83063c8af3eeb2fa6007 (patch)
tree47c22f864d3ffffdda2b2da7e12acc65305b77e5 /ui/ui.go
parentui: use Synchronize method for cross-goroutine calls to walk (diff)
downloadwireguard-windows-055f53c553de1ba10a4e83063c8af3eeb2fa6007.tar.xz
wireguard-windows-055f53c553de1ba10a4e83063c8af3eeb2fa6007.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> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r--ui/ui.go64
1 files changed, 57 insertions, 7 deletions
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()
}