aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-01 18:30:07 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-02 08:41:08 +0200
commit0bc8cd5e206ca0c5450c4d0b5e4a6e011aee2a84 (patch)
treebdc67110c0e9aca3ccde87b1c263e9c34df01594
parentui: rework margins (diff)
downloadwireguard-windows-0bc8cd5e206ca0c5450c4d0b5e4a6e011aee2a84.tar.xz
wireguard-windows-0bc8cd5e206ca0c5450c4d0b5e4a6e011aee2a84.zip
ui: use icons instead of unicode font
-rw-r--r--.gitignore1
-rw-r--r--Makefile5
-rw-r--r--build.bat7
-rw-r--r--installer/wireguard.wxs4
-rw-r--r--resources.rc5
-rw-r--r--ui/icon/128.pngbin8419 -> 0 bytes
-rw-r--r--ui/icon/16.pngbin869 -> 0 bytes
-rw-r--r--ui/icon/256.pngbin17786 -> 0 bytes
-rw-r--r--ui/icon/32.pngbin1951 -> 0 bytes
-rw-r--r--ui/icon/48.pngbin2986 -> 0 bytes
-rw-r--r--ui/icon/64.pngbin3922 -> 0 bytes
-rw-r--r--ui/icon/add.svg2
-rw-r--r--ui/icon/delete.svg2
-rw-r--r--ui/icon/export.svg2
-rw-r--r--ui/icon/icon.icobin117355 -> 0 bytes
-rw-r--r--ui/icon/wireguard.svg2
-rw-r--r--ui/iconprovider.go16
-rw-r--r--ui/managewindow.go2
-rw-r--r--ui/tray.go2
-rw-r--r--ui/tunnelspage.go90
-rw-r--r--ui/ui.go12
21 files changed, 87 insertions, 65 deletions
diff --git a/.gitignore b/.gitignore
index dcb7cf60..0f02248c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,4 @@
*.bak
*.syso
.idea
+*.ico
diff --git a/Makefile b/Makefile
index c9a26d0a..76c4c6d3 100644
--- a/Makefile
+++ b/Makefile
@@ -8,13 +8,16 @@ export GOROOT := $(PWD)/.deps/goroot
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
SOURCE_FILES := $(call rwildcard,,*.go *.c *.h) .deps/prepared
-RESOURCE_FILES := resources.rc version.h manifest.xml ui/icon/icon.ico
+RESOURCE_FILES := resources.rc version.h manifest.xml $(patsubst %.svg,%.ico,$(wildcard ui/icon/*.svg))
DEPLOYMENT_HOST ?= winvm
DEPLOYMENT_PATH ?= Desktop
all: amd64/wireguard.exe x86/wireguard.exe
+%.ico: %.svg
+ convert -background none $< -define icon:auto-resize="256,128,96,64,48,32,16" $@
+
.deps/prepared: export GOROOT := $(OLD_GOROOT)
.deps/prepared: $(wildcard golang-*.patch)
rm -rf .deps && mkdir -p .deps
diff --git a/build.bat b/build.bat
index 250b90eb..2d13b1d9 100644
--- a/build.bat
+++ b/build.bat
@@ -5,11 +5,12 @@ rem Copyright (C) 2019 WireGuard LLC. All Rights Reserved.
set STARTDIR=%cd%
set OLDPATH=%PATH%
-if exist .deps\prepared goto :build
+if exist .deps\prepared goto :render
:installdeps
rmdir /s /q .deps 2> NUL
mkdir .deps || goto :error
cd .deps || goto :error
+ call :download imagemagick.zip https://imagemagick.org/download/binaries/ImageMagick-7.0.8-42-portable-Q16-x64.zip 584e069f56456ce7dde40220948ff9568ac810688c892c5dfb7f6db902aa05aa "convert.exe colors.xml delegates.xml" || goto :error
call :download go.zip https://dl.google.com/go/go1.12.3.windows-amd64.zip 1806e089e85b84f192d782a7f70f90a32e0eccfd181405857e612f806ec04059 || goto :error
rem Mirror of https://musl.cc/i686-w64-mingw32-native.zip
call :download mingw-x86.zip https://download.wireguard.com/windows-toolchain/distfiles/i686-w64-mingw32-native-20190425.zip 5810b4a9af34c12690ec355ad2a237d2a4c16f5e8cb68988dc0f2e48457534d0 || goto :error
@@ -22,6 +23,10 @@ if exist .deps\prepared goto :build
copy /y NUL prepared > NUL || goto :error
cd .. || goto :error
+:render
+ echo [+] Rendering icons
+ for %%a in ("ui\icon\*.svg") do "%STARTDIR%\.deps\convert.exe" -background none "%%~fa" -define icon:auto-resize="256,128,96,64,48,32,16" "%%~dpna.ico" || goto :error
+
:build
set PATH=%STARTDIR%\.deps\go\bin\;%PATH%
set CFLAGS=-O3 -Wall -std=gnu11
diff --git a/installer/wireguard.wxs b/installer/wireguard.wxs
index 747d56fa..643a226d 100644
--- a/installer/wireguard.wxs
+++ b/installer/wireguard.wxs
@@ -26,10 +26,10 @@
<MediaTemplate EmbedCab="yes" CompressionLevel="high"/>
- <Icon Id="icon.ico" SourceFile="..\ui\icon\icon.ico"/>
+ <Icon Id="wireguard.ico" SourceFile="..\ui\icon\wireguard.ico"/>
<Binary Id="serviceevaluation.js" SourceFile="serviceevaluation.js"/>
- <Property Id="ARPPRODUCTICON" Value="icon.ico"/>
+ <Property Id="ARPPRODUCTICON" Value="wireguard.ico"/>
<Property Id="ARPURLINFOABOUT" Value="https://www.wireguard.com/"/>
<Property Id="ARPNOMODIFY" Value="yes" />
<Property Id="DISABLEADVTSHORTCUTS" Value="yes"/>
diff --git a/resources.rc b/resources.rc
index 1677ae13..89e90bc6 100644
--- a/resources.rc
+++ b/resources.rc
@@ -8,7 +8,10 @@
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST manifest.xml
-1 ICON ui/icon/icon.ico
+$wireguard.ico ICON ui/icon/wireguard.ico
+add.ico ICON ui/icon/add.ico
+delete.ico ICON ui/icon/delete.ico
+export.ico ICON ui/icon/export.ico
VS_VERSION_INFO VERSIONINFO
FILEVERSION WIREGUARD_WINDOWS_VERSION_ARRAY
diff --git a/ui/icon/128.png b/ui/icon/128.png
deleted file mode 100644
index a3ba1ca0..00000000
--- a/ui/icon/128.png
+++ /dev/null
Binary files differ
diff --git a/ui/icon/16.png b/ui/icon/16.png
deleted file mode 100644
index 51c71e0e..00000000
--- a/ui/icon/16.png
+++ /dev/null
Binary files differ
diff --git a/ui/icon/256.png b/ui/icon/256.png
deleted file mode 100644
index 7b5f63e5..00000000
--- a/ui/icon/256.png
+++ /dev/null
Binary files differ
diff --git a/ui/icon/32.png b/ui/icon/32.png
deleted file mode 100644
index ee4acd97..00000000
--- a/ui/icon/32.png
+++ /dev/null
Binary files differ
diff --git a/ui/icon/48.png b/ui/icon/48.png
deleted file mode 100644
index 24ab1cb2..00000000
--- a/ui/icon/48.png
+++ /dev/null
Binary files differ
diff --git a/ui/icon/64.png b/ui/icon/64.png
deleted file mode 100644
index e0295697..00000000
--- a/ui/icon/64.png
+++ /dev/null
Binary files differ
diff --git a/ui/icon/add.svg b/ui/icon/add.svg
new file mode 100644
index 00000000..2e1dd028
--- /dev/null
+++ b/ui/icon/add.svg
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="1e3" height="1e3" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="m893 447v107q0 22-16 38t-38 15h-232v233q0 22-16 37t-38 16h-107q-22 0-38-16t-15-37v-233h-232q-23 0-38-15t-16-38v-107q0-23 16-38t38-16h232v-232q0-22 15-38t38-16h107q23 0 38 16t16 38v232h232q23 0 38 16t16 38z" glyph-name="plus" horiz-adv-x="785.7" unicode=""/></svg>
diff --git a/ui/icon/delete.svg b/ui/icon/delete.svg
new file mode 100644
index 00000000..6c204271
--- /dev/null
+++ b/ui/icon/delete.svg
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="1e3" height="1e3" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="m893 446.97v107q0 22-16 38t-38 15h-678q-23 0-38-15t-16-38v-107q0-23 16-38t38-16h678q23 0 38 16t16 38z" glyph-name="minus" horiz-adv-x="785.7" unicode=""/></svg>
diff --git a/ui/icon/export.svg b/ui/icon/export.svg
new file mode 100644
index 00000000..caef7a2c
--- /dev/null
+++ b/ui/icon/export.svg
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="1e3" height="1e3" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="m821.5 623.5v144q0 67-47 114t-114 47h-464q-67 0-114-47t-47-114v-464q0-66 47-113t114-48h142q7 0 13 6t5 12q0 15-15 18-43 15-74 34-5 2-9 2h-62q-37 0-63 26t-27 63v464q0 37 27 63t63 27h464q37 0 63-27t26-63v-119q0-11 10-16 16-7 31-21 8-9 19-4 12 5 12 16zm132-277-214 214q-10 11-25 11-7 0-14-3-22-9-22-33v-107h-89q-181 0-245 73-66 77-41 264 2 13-11 19-5 1-7 1-9 0-14-7-6-8-12-17t-22-39-28-55-21-64-10-68q0-27 2-51t8-50 15-49 27-45 38-42 52-34 70-27 89-17 110-6h89v-107q0-24 22-33 7-3 14-3 14 0 25 11l214 214q11 10 11 25t-11 25z" glyph-name="export" horiz-adv-x="928.6" unicode=""/></svg>
diff --git a/ui/icon/icon.ico b/ui/icon/icon.ico
deleted file mode 100644
index 9fd9f330..00000000
--- a/ui/icon/icon.ico
+++ /dev/null
Binary files differ
diff --git a/ui/icon/wireguard.svg b/ui/icon/wireguard.svg
new file mode 100644
index 00000000..b8ac5273
--- /dev/null
+++ b/ui/icon/wireguard.svg
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="400" height="400" version="1.1" viewBox="0 0 400 400" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><defs><clipPath id="a"><path d="m0 300h300v-300h-300z"/></clipPath></defs><g transform="matrix(1.3333 0 0 -1.3333 0 400)"><g clip-path="url(#a)"><g transform="translate(177.57 268.56)"><path d="m0 0c0.969-0.066 2.097 0.81 3.987 1.635-1.862 0.802-2.973 1.655-3.939 1.593-0.996-0.063-2.592-1.031-2.567-1.578 0.027-0.603 1.532-1.583 2.519-1.65" fill="#871719"/></g><g transform="translate(179.32 268.11)"><path d="m0 0c0.969-0.066 2.097 0.81 3.987 1.635-1.862 0.802-2.973 1.655-3.939 1.593-0.996-0.063-2.592-1.031-2.567-1.578 0.027-0.603 1.532-1.583 2.519-1.65" fill="#871719"/></g><g transform="translate(299.74 154.44)"><path d="m0 0s6.94 145.56-153.04 145.56c-141.48 0-145.9-139.63-145.9-139.63s-20.811-160.37 149.16-160.37c163.02 0 149.78 154.44 149.78 154.44" fill="#871719"/></g><g transform="translate(133.86 128.17)"><path d="m0 0c-2.627-1.39-4.65-2.414-6.63-3.517-8.1-4.512-15.026-10.419-20.544-17.868-1.784-2.409-3.01-2.603-5.727-0.941-35.338 21.61-37.609 75.843 0.983 99.453 30.017 18.364 68.365 7.14 82.735-20.477 2.723-5.234 3.069-13.291 1.345-18.782-5.955-18.955-20.015-29.586-39.313-34.102 5.689 4.87 10.218 10.393 11.659 18.025 1.452 7.687-0.084 14.638-4.542 20.956-6.773 9.596-19.868 13.544-30.811 9.389-11.881-4.511-18.39-15.354-17.216-28.683 1.09-12.381 10.484-20.405 28.061-23.453" fill="#fff"/></g><g transform="translate(58.513 66.293)"><path d="M 0,0 C 2.838,19.152 25.265,36.788 44.23,34.776 38.356,26.832 35.643,17.846 34.988,8.883 28.686,7.722 22.747,6.941 16.981,5.478 11.304,4.037 5.803,1.903 0,0" fill="#fff"/></g><g transform="translate(183.79 273.09)"><path d="m0 0c1.061 0.812 2.155 1.494 3.472 0.408 0.75-0.617 1.478-1.257 2.386-2.032-1.127-0.595-2.042-1.096-2.975-1.567-1.306-0.658-2.282-0.218-3.072 0.822-0.642 0.844-0.757 1.645 0.189 2.369m15.447-157.8c-1.598 1.382-2.611 1.381-4.485 0.182-6.359-4.068-12.867-7.922-19.481-11.562-3.792-2.086-7.898-3.599-12.653-5.724 1.633-0.421 2.418-0.619 3.201-0.827 17.776-4.73 27.272-20.335 23.065-37.813-3.741-15.544-19.52-25.482-34.812-22.86-12.748 2.186-23.877 12.772-25.735 25.456-2.026 13.824 4.859 27.119 17.108 32.689 6.794 3.089 13.771 5.778 20.549 8.9 7.706 3.551 16.038 6.355 22.766 11.296 16.7 12.262 27.012 29.145 31.033 49.523 2.408 12.207 2.245 24.36-3.339 35.95-4.286 8.895-11.319 15.357-18.875 21.253-7.775 6.068-16.007 11.554-23.747 17.664-2.095 1.653-3.509 4.505-4.478 7.09-0.411 1.095 0.925 4.066 1.819 4.227 4.746 0.852 9.596 1.29 14.425 1.473 5.574 0.21 11.164 0.032 16.746-0.042 1.21-0.015 2.853 0.141 3.549-0.542 2.891-2.843 5.159-1.014 7.166 0.856 1.689 1.573 2.893 3.668 4.236 5.433-0.815 0.12-2.487 0.541-4.168 0.581-5.613 0.133-11.233 0.047-16.843 0.253-1 0.037-1.963 1.066-2.942 1.637 1.031 0.409 2.058 1.165 3.093 1.175 9.682 0.091 19.366 0.054 29.057 0.054 0.011 5.038-6.722 11.936-12.704 13.806-0.045-0.682-0.087-1.317-0.131-1.994-5.944-0.141-11.778-0.03-17.078 2.788-1.396 0.743-2.309 2.394-3.446 3.627-1.431 1.551-2.605 3.547-4.349 4.559-3.576 2.076-7.48 3.58-11.211 5.397-13.259 6.458-27.262 6.231-42.302 4.854 8.991-2.092 17.11-3.982 25.23-5.872-0.093-0.494-0.185-0.987-0.278-1.481-10.86-1.455-21.134 2.528-31.756 4.003 3.849-2.254 7.749-4.35 11.778-6.158 4.095-1.837 8.316-3.39 12.538-5.091-5.364-4.583-10.746-5.588-17.488-4.048-3.686 0.842-7.585 1.29-11.348 1.106-3.887-0.19-7.802-1.147-11.332-3.506 3.78-1.916 7.263-3.506 10.549-5.432 1.355-0.795 2.909-2.144 3.287-3.536 0.904-3.333 1.166-6.841 1.687-10.281-6.188-0.701-17.071-6.994-19.27-11.09 9.512-1.831 19.868 0.383 28.942-5.746-2.989-2.262-9.949-5.075-12.502-7.007 3.156-0.827 10.469-0.423 13.33-0.229 2.409 0.164 3.521 0.223 4.508-0.59l28.001-21.921c2.944-2.374 14.835-13.629 17.939-20.704 2.643-6.023 2.966-11.148 2.965-12.398-2e-3 -3.355-0.413-8.609-2.721-14.469-0.969-2.461-3.812-7.912-9.677-14.267-9.09-9.847-20.783-15.17-33.57-17.807-29.732-6.13-54.436-37.881-47.462-72.884 8.142-40.866 53.247-62.991 90.107-43.552 23.824 12.564 36.456 37.078 33.072 63.762-2.045 16.12-9.338 29.269-21.563 39.839" fill="#fff"/></g></g></g></svg>
diff --git a/ui/iconprovider.go b/ui/iconprovider.go
index f9d3597e..64d5775d 100644
--- a/ui/iconprovider.go
+++ b/ui/iconprovider.go
@@ -17,7 +17,7 @@ type rectAndState struct {
}
type IconProvider struct {
- baseIcon *walk.Icon
+ wireguardIcon *walk.Icon
imagesByRectAndState map[rectAndState]*walk.Bitmap
iconsByState map[service.TunnelState]*walk.Icon
stoppedBrush *walk.SolidColorBrush
@@ -121,10 +121,10 @@ func NewIconProvider(dpi int) (*IconProvider, error) {
var disposables walk.Disposables
defer disposables.Treat()
- if tsip.baseIcon, err = walk.NewIconFromResourceId(1); err != nil {
+ if tsip.wireguardIcon, err = walk.NewIconFromResource("$wireguard.ico"); err != nil {
return nil, err
}
- disposables.Add(tsip.baseIcon)
+ disposables.Add(tsip.wireguardIcon)
if tsip.stoppedBrush, err = walk.NewSolidColorBrush(hexColor(colorStopped)); err != nil {
return nil, err
@@ -202,9 +202,9 @@ func (tsip *IconProvider) Dispose() {
tsip.startedPen.Dispose()
tsip.startedPen = nil
}
- if tsip.baseIcon != nil {
- tsip.baseIcon.Dispose()
- tsip.baseIcon = nil
+ if tsip.wireguardIcon != nil {
+ tsip.wireguardIcon.Dispose()
+ tsip.wireguardIcon = nil
}
if tsip.updateAvailableImage != nil {
tsip.updateAvailableImage.Dispose()
@@ -299,7 +299,7 @@ func (tsip *IconProvider) IconWithOverlayForState(state service.TunnelState) (*w
return icon, nil
}
- size := tsip.baseIcon.Size()
+ size := tsip.wireguardIcon.Size()
bmp, err := walk.NewBitmapWithTransparentPixels(size)
if err != nil {
@@ -313,7 +313,7 @@ func (tsip *IconProvider) IconWithOverlayForState(state service.TunnelState) (*w
}
defer canvas.Dispose()
- if err := canvas.DrawImage(tsip.baseIcon, walk.Point{}); err != nil {
+ if err := canvas.DrawImage(tsip.wireguardIcon, walk.Point{}); err != nil {
return nil, err
}
diff --git a/ui/managewindow.go b/ui/managewindow.go
index 01e7f734..91dc39fb 100644
--- a/ui/managewindow.go
+++ b/ui/managewindow.go
@@ -41,7 +41,7 @@ func NewManageTunnelsWindow() (*ManageTunnelsWindow, error) {
return nil, err
}
- mtw.SetIcon(iconProvider.baseIcon)
+ mtw.SetIcon(iconProvider.wireguardIcon)
mtw.SetTitle("WireGuard")
font, err := walk.NewFont("Segoe UI", 9, 0)
if err != nil {
diff --git a/ui/tray.go b/ui/tray.go
index 492f820c..4f22fc4d 100644
--- a/ui/tray.go
+++ b/ui/tray.go
@@ -48,7 +48,7 @@ func NewTray(mtw *ManageTunnelsWindow) (*Tray, error) {
func (tray *Tray) setup() error {
tray.SetToolTip("WireGuard: Deactivated")
tray.SetVisible(true)
- tray.SetIcon(iconProvider.baseIcon)
+ tray.SetIcon(iconProvider.wireguardIcon)
tray.MouseDown().Attach(func(x, y int, button walk.MouseButton) {
if button == walk.LeftButton {
diff --git a/ui/tunnelspage.go b/ui/tunnelspage.go
index a305496e..1eca896a 100644
--- a/ui/tunnelspage.go
+++ b/ui/tunnelspage.go
@@ -55,47 +55,55 @@ func NewTunnelsPage() (*TunnelsPage, error) {
tp.tunnelsView.ItemActivated().Attach(tp.onTunnelsViewItemActivated)
tp.tunnelsView.CurrentIndexChanged().Attach(tp.updateConfView)
- // ToolBar actions
- {
- // HACK: Because of https://github.com/lxn/walk/issues/481
- // we need to put the ToolBar into its own Composite.
- toolBarContainer, _ := walk.NewComposite(tunnelsContainer)
- hlayout := walk.NewHBoxLayout()
- hlayout.SetMargins(walk.Margins{})
- toolBarContainer.SetLayout(hlayout)
-
- tunnelsToolBar, _ := walk.NewToolBarWithOrientationAndButtonStyle(toolBarContainer, walk.Horizontal, walk.ToolBarButtonTextOnly)
-
- importAction := walk.NewAction()
- importAction.SetText("Import tunnels from file...")
- importAction.Triggered().Attach(tp.onImport)
-
- addAction := walk.NewAction()
- addAction.SetText("Add empty tunnel")
- addAction.Triggered().Attach(tp.onAddTunnel)
-
- exportTunnelsAction := walk.NewAction()
- exportTunnelsAction.SetText("Export tunnels to zip...")
- exportTunnelsAction.Triggered().Attach(tp.onExportTunnels)
-
- addMenu, _ := walk.NewMenu()
- tp.AddDisposable(addMenu)
- addMenu.Actions().Add(addAction)
- addMenu.Actions().Add(importAction)
- addMenuAction, _ := tunnelsToolBar.Actions().AddMenu(addMenu)
- addMenuAction.SetText("➕")
-
- deleteAction := walk.NewAction()
- tunnelsToolBar.Actions().Add(deleteAction)
- deleteAction.SetText("➖")
- deleteAction.Triggered().Attach(tp.onDelete)
-
- settingsMenu, _ := walk.NewMenu()
- tp.AddDisposable(settingsMenu)
- settingsMenu.Actions().Add(exportTunnelsAction)
- settingsMenuAction, _ := tunnelsToolBar.Actions().AddMenu(settingsMenu)
- settingsMenuAction.SetText("⚙")
- }
+ // HACK: Because of https://github.com/lxn/walk/issues/481
+ // we need to put the ToolBar into its own Composite.
+ toolBarContainer, _ := walk.NewComposite(tunnelsContainer)
+ hlayout := walk.NewHBoxLayout()
+ hlayout.SetMargins(walk.Margins{})
+ toolBarContainer.SetLayout(hlayout)
+
+ tunnelsToolBar, _ := walk.NewToolBarWithOrientationAndButtonStyle(toolBarContainer, walk.Horizontal, walk.ToolBarButtonImageOnly)
+ imageSize := walk.Size{tp.DPI() / 6, tp.DPI() / 6} // Dividing by six is the same as dividing by 96 and multiplying by 16. TODO: Use dynamic DPI
+ imageList, _ := walk.NewImageList(imageSize, walk.RGB(255, 255, 255))
+ tunnelsToolBar.SetImageList(imageList)
+
+ addMenu, _ := walk.NewMenu()
+ tp.AddDisposable(addMenu)
+ importAction := walk.NewAction()
+ importAction.SetText("Import tunnel(s) from file...")
+ importAction.Triggered().Attach(tp.onImport)
+ addAction := walk.NewAction()
+ addAction.SetText("Add empty tunnel")
+ addAction.Triggered().Attach(tp.onAddTunnel)
+ addMenu.Actions().Add(addAction)
+ addMenu.Actions().Add(importAction)
+ addMenuAction := walk.NewMenuAction(addMenu)
+ addMenuActionIcon, _ := walk.NewIconFromResourceWithSize("add.ico", imageSize)
+ addMenuActionImage, _ := walk.NewBitmapFromIcon(addMenuActionIcon, imageSize)
+ addMenuAction.SetImage(addMenuActionImage)
+ addMenuAction.SetToolTip(importAction.Text())
+ addMenuAction.Triggered().Attach(tp.onImport)
+ tunnelsToolBar.Actions().Add(addMenuAction)
+
+ tunnelsToolBar.Actions().Add(walk.NewSeparatorAction())
+
+ deleteAction := walk.NewAction()
+ deleteActionIcon, _ := walk.NewIconFromResourceWithSize("delete.ico", imageSize)
+ deleteActionImage, _ := walk.NewBitmapFromIcon(deleteActionIcon, imageSize)
+ deleteAction.SetImage(deleteActionImage)
+ deleteAction.SetToolTip("Remove selected tunnel(s)")
+ deleteAction.Triggered().Attach(tp.onDelete)
+ tunnelsToolBar.Actions().Add(deleteAction)
+
+ tunnelsToolBar.Actions().Add(walk.NewSeparatorAction())
+
+ exportAction := walk.NewAction()
+ exportActionIcon, _ := walk.NewIconFromResourceWithSize("export.ico", imageSize)
+ exportActionImage, _ := walk.NewBitmapFromIcon(exportActionIcon, imageSize)
+ exportAction.SetImage(exportActionImage)
+ exportAction.SetToolTip("Export all tunnels to zip...")
+ exportAction.Triggered().Attach(tp.onExportTunnels)
+ tunnelsToolBar.Actions().Add(exportAction)
currentTunnelContainer, _ := walk.NewComposite(tp)
vlayout = walk.NewVBoxLayout()
diff --git a/ui/ui.go b/ui/ui.go
index 2625423a..4aeb4f42 100644
--- a/ui/ui.go
+++ b/ui/ui.go
@@ -124,20 +124,14 @@ func onAbout(owner walk.Form) {
dlg, _ := walk.NewDialogWithFixedSize(owner)
dlg.SetTitle("About WireGuard")
dlg.SetLayout(vbl)
- dlg.SetIcon(iconProvider.baseIcon)
+ dlg.SetIcon(iconProvider.wireguardIcon)
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)
-
+ logo, _ := walk.NewIconFromResourceWithSize("$wireguard.ico", walk.Size{owner.DPI() * 4 / 3, owner.DPI() * 4 / 3})
+ iv.SetImage(logo)
wgFont, _ := walk.NewFont("Segoe UI", 16, walk.FontBold)
wgLbl, _ := walk.NewLabel(dlg)