From 56f5c52ce2cdd03a97ab24a880af790c5b37fa25 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Sat, 22 Jan 2022 16:52:04 +0800 Subject: [PATCH] Add a function to allow users to reboot the IME. - By terminating the IME, the IME gets restarted immediately. --- Source/InputMethodController.mm | 9 +++++++++ Source/en.lproj/Localizable.strings | 1 + Source/ja.lproj/Localizable.strings | 1 + Source/zh-Hans.lproj/Localizable.strings | 1 + Source/zh-Hant.lproj/Localizable.strings | 1 + 5 files changed, 13 insertions(+) diff --git a/Source/InputMethodController.mm b/Source/InputMethodController.mm index ca17a4dc..3f2d96b5 100644 --- a/Source/InputMethodController.mm +++ b/Source/InputMethodController.mm @@ -167,6 +167,9 @@ static double FindHighestScore(const vector& nodes, double epsilon) [menu addItemWithTitle:NSLocalizedString(@"vChewing Preferences", @"") action:@selector(showPreferences:) keyEquivalent:@""]; [menu addItemWithTitle:NSLocalizedString(@"Check for Updates…", @"") action:@selector(checkForUpdate:) keyEquivalent:@""]; [menu addItemWithTitle:NSLocalizedString(@"About vChewing…", @"") action:@selector(showAbout:) keyEquivalent:@""]; + if (optionKeyPressed) { + [menu addItemWithTitle:NSLocalizedString(@"Reboot vChewing…", @"") action:@selector(selfTerminate:) keyEquivalent:@""]; + } return menu; } @@ -1525,6 +1528,12 @@ NS_INLINE size_t max(size_t a, size_t b) { return a > b ? a : b; } } } +- (void)selfTerminate:(id)sender +{ + NSLog(@"vChewing App self-terminated on request."); + [NSApplication.sharedApplication terminate:nil]; +} + - (void)checkForUpdate:(id)sender { [(AppDelegate *)[[NSApplication sharedApplication] delegate] checkForUpdateForced:YES]; diff --git a/Source/en.lproj/Localizable.strings b/Source/en.lproj/Localizable.strings index ce7224ab..1a03d012 100644 --- a/Source/en.lproj/Localizable.strings +++ b/Source/en.lproj/Localizable.strings @@ -35,3 +35,4 @@ "Maximum 15 candidate keys allowed." = "Maximum 15 candidate keys allowed."; "⚠︎ Phrase replacement mode enabled, interfering user phrase entry." = "⚠︎ Phrase replacement mode enabled, interfering user phrase entry."; "NT351 BPMF EMU" = "NT351 Per-Char Select Mode"; +"Reboot vChewing…" = "Reboot vChewing…"; diff --git a/Source/ja.lproj/Localizable.strings b/Source/ja.lproj/Localizable.strings index ae4f5088..b38918e6 100644 --- a/Source/ja.lproj/Localizable.strings +++ b/Source/ja.lproj/Localizable.strings @@ -35,3 +35,4 @@ "Maximum 15 candidate keys allowed." = "言選り用キー陣列には最多15つキー登録できます。"; "⚠︎ Phrase replacement mode enabled, interfering user phrase entry." = "⚠︎ 言葉置換機能稼働中、新添付言葉にも影響。"; "NT351 BPMF EMU" = "全候補入力モード"; +"Reboot vChewing…" = "入力アプリ再起動…"; diff --git a/Source/zh-Hans.lproj/Localizable.strings b/Source/zh-Hans.lproj/Localizable.strings index aaa0bbf7..c28a350c 100644 --- a/Source/zh-Hans.lproj/Localizable.strings +++ b/Source/zh-Hans.lproj/Localizable.strings @@ -35,3 +35,4 @@ "Maximum 15 candidate keys allowed." = "选字键最多只能指定十五个。"; "⚠︎ Phrase replacement mode enabled, interfering user phrase entry." = "⚠︎ 语汇置换功能已启用,会波及语汇自订。"; "NT351 BPMF EMU" = "模拟逐字选字输入"; +"Reboot vChewing…" = "重新启动输入法…"; diff --git a/Source/zh-Hant.lproj/Localizable.strings b/Source/zh-Hant.lproj/Localizable.strings index a551893c..c76332c1 100644 --- a/Source/zh-Hant.lproj/Localizable.strings +++ b/Source/zh-Hant.lproj/Localizable.strings @@ -35,3 +35,4 @@ "Maximum 15 candidate keys allowed." = "選字鍵最多只能指定十五個。"; "⚠︎ Phrase replacement mode enabled, interfering user phrase entry." = "⚠︎ 語彙置換功能已啟用,會波及語彙自訂。"; "NT351 BPMF EMU" = "模擬逐字選字輸入"; +"Reboot vChewing…" = "重新啟動輸入法…";