Add global hotkey support (#724)

Design:

Use the plain string for both config and hotkey parsing
and make use of KeyConverter, ModifierKeysConverter
to make it more rubust.

Find corresponding label (to display operation result) and callback (to do the real work) based on textbox name. In this case, they should be named as `<Feature-Name><Control-Name>`.

ShowLogsTextBox,
ShowLogsLabel,
ShowLogsCallback.

If this requirement doesn't meet, throw an exception at runtime.

Logic:

How to input keys:
1. put focus in the corresponding textbox
2. press the key combination you want to use
3. when you think it is ready, release all keys
4. the textbox shows your input

How to change keys:
1. put focus in the corresponding textbox
2. press BackSpace to clear content
3. re-input new one

How to deactivate:
1. clear content in the textbox
2. press OK button

Meaning of label color:
- Green: this combination is not occupied by other programs and register successfully
- Yellow: this combination is occupied by other programs and you have to change to another one
- Transparent without color: initial status

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
This commit is contained in:
Syrone Wong
2016-09-16 23:42:16 -05:00
committed by GitHub
parent 6e6be823ad
commit 99bdec334c
17 changed files with 1294 additions and 7 deletions
+14
View File
@@ -27,6 +27,7 @@ Verbose Logging=详细记录日志
Updates...=更新...
Check for Updates...=检查更新
Check for Updates at Startup=启动时检查更新
Edit Hotkeys...=编辑快捷键...
About...=关于...
Quit=退出
Edit Servers=编辑服务器
@@ -84,6 +85,17 @@ Edit Online PAC URL=编辑在线 PAC 网址
Edit Online PAC URL...=编辑在线 PAC 网址...
Please input PAC Url=请输入 PAC 网址
# HotkeySettings Form
Switch system proxy=切换系统代理状态
Switch to PAC mode=切换到PAC模式
Switch to Global mode=切换到全局模式
Switch share over LAN=切换局域网共享
Show Logs=显示日志
Switch to prev server=切换上个服务器
Switch to next server=切换下个服务器
Reg All=注册全部热键
# Messages
Shadowsocks Error: {0}=Shadowsocks 错误: {0}
@@ -116,3 +128,5 @@ Unexpected error, shadowsocks will exit. Please report to=非预期错误,Shad
Unsupported operating system, use Windows Vista at least.=不支持的操作系统版本,最低需求为Windows Vista。
Proxy request failed=代理请求失败
Proxy handshake failed=代理握手失败
Register hotkey failed=注册热键失败
Cannot parse hotkey: {0}=解析热键失败: {0}
+14
View File
@@ -27,6 +27,7 @@ Verbose Logging=詳細記錄日誌
Updates...=更新...
Check for Updates...=檢查更新
Check for Updates at Startup=啟動時檢查更新
Edit Hotkeys...=編輯熱鍵...
About...=關於...
Quit=退出
Edit Servers=編輯伺服器
@@ -84,6 +85,17 @@ Edit Online PAC URL=編輯在線 PAC 網址
Edit Online PAC URL...=編輯在線 PAC 網址...
Please input PAC Url=請輸入 PAC 網址
# HotkeySettings Form
Switch system proxy=切换系統代理狀態
Switch to PAC mode=切换為PAC模式
Switch to Global mode=切换為全局模式
Switch share over LAN=切换局域網共享
Show Logs=顯示日誌
Switch to prev server=切换上個伺服器
Switch to next server=切换下個伺服器
Reg All=註冊全部熱鍵
# Messages
Shadowsocks Error: {0}=Shadowsocks 錯誤: {0}
@@ -116,3 +128,5 @@ Unexpected error, shadowsocks will exit. Please report to=非預期錯誤,Shad
Unsupported operating system, use Windows Vista at least.=不支持的作業系統版本,最低需求為Windows Vista。
Proxy request failed=代理請求失敗
Proxy handshake failed=代理握手失敗
Register hotkey failed=註冊熱鍵失敗
Cannot parse hotkey: {0}=解析熱鍵失敗: {0}