diff --git a/Source/AppDelegate.h b/Source/AppDelegate.h index 5e3de301..8825051e 100644 --- a/Source/AppDelegate.h +++ b/Source/AppDelegate.h @@ -33,6 +33,7 @@ // #import +#import "frmAboutWindow.h" @class PreferencesWindowController; @@ -44,11 +45,13 @@ NSMutableData *_receivingData; NSURL *_updateNextStepURL; PreferencesWindowController *_preferencesWindowController; + frmAboutWindow *_aboutWindowController; } - (void)checkForUpdate; - (void)checkForUpdateForced:(BOOL)forced; - (void)showPreferences; +- (void)showAbout; @property (weak, nonatomic) IBOutlet NSWindow *window; @end diff --git a/Source/AppDelegate.m b/Source/AppDelegate.m index 245441c4..0f1a0d5e 100644 --- a/Source/AppDelegate.m +++ b/Source/AppDelegate.m @@ -55,6 +55,7 @@ static const NSTimeInterval kTimeoutInterval = 60.0; - (void)dealloc { _preferencesWindowController = nil; + _aboutWindowController = nil; _updateCheckConnection = nil; } @@ -274,9 +275,17 @@ static const NSTimeInterval kTimeoutInterval = 60.0; return YES; } +- (void)showAbout { + if (!_aboutWindowController) { + _aboutWindowController = [[frmAboutWindow alloc] initWithWindowNibName:@"frmAboutWindow"]; + } + [[_aboutWindowController window] center]; + [[_aboutWindowController window] orderFrontRegardless]; +} + - (IBAction) about:(id)sender { - // Show the window: - [[frmAboutWindow defaultController] showWithSender:self]; + [(AppDelegate *)[NSApp delegate] showAbout]; + [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; } @end diff --git a/Source/Base.lproj/frmAboutWindow.xib b/Source/Base.lproj/frmAboutWindow.xib index bef94b49..4940e6a5 100644 --- a/Source/Base.lproj/frmAboutWindow.xib +++ b/Source/Base.lproj/frmAboutWindow.xib @@ -16,10 +16,12 @@ - - + + - + + + @@ -49,16 +51,13 @@ - - - - - + + @@ -67,7 +66,7 @@ - + @@ -103,7 +102,8 @@ McBopomofo Engine by Mengjuei Hsieh, Lukhnos Liu, Zonble Yang, et al. -vChewing macOS Development Reinforced by Hiraku Wang.
vChewing Phrase Database Maintained by Shiki Suen. +vChewing macOS Development Reinforced by Hiraku Wang. +vChewing Phrase Database Maintained by Shiki Suen. @@ -131,6 +131,9 @@ vChewing macOS Development Reinforced by Hiraku Wang.
vChewing Phrase Database DQ + + + diff --git a/Source/InputMethodController.h b/Source/InputMethodController.h index 7cb01be8..c595c7af 100644 --- a/Source/InputMethodController.h +++ b/Source/InputMethodController.h @@ -38,6 +38,7 @@ #import "Gramambular.h" #import "FastLM.h" #import "UserOverrideModel.h" +#import "frmAboutWindow.h" @interface vChewingInputMethodController : IMKInputController { diff --git a/Source/InputMethodController.mm b/Source/InputMethodController.mm index 1a985214..b7e0ca49 100644 --- a/Source/InputMethodController.mm +++ b/Source/InputMethodController.mm @@ -39,7 +39,6 @@ #import "OVStringHelper.h" #import "OVUTF8Helper.h" #import "AppDelegate.h" -#import "frmAboutWindow.h" #import "VTHorizontalCandidateController.h" #import "VTVerticalCandidateController.h" #import "vChewing-Swift.h" @@ -1327,7 +1326,9 @@ static double FindHighestScore(const vector& nodes, double epsilon) - (void)showAbout:(id)sender { - [[frmAboutWindow defaultController] showWithSender:sender]; + // show the About window, and also make the IME app itself the focus + [(AppDelegate *)[NSApp delegate] showAbout]; + [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; } - (void)toggleChineseConverter:(id)sender diff --git a/Source/frmAboutWindow.m b/Source/frmAboutWindow.m index e90a969b..e2bdf392 100644 --- a/Source/frmAboutWindow.m +++ b/Source/frmAboutWindow.m @@ -60,27 +60,26 @@ - (void) windowDidLoad { [super windowDidLoad]; - + [self.window standardWindowButton:NSWindowCloseButton].hidden = true; + [self.window standardWindowButton:NSWindowMiniaturizeButton].hidden = true; + [self.window standardWindowButton:NSWindowZoomButton].hidden = true; [self updateInfo]; - - // If you add more custom subviews to display additional information about - // your app, configure them here } - (void) updateInfo { - NSDictionary* infoDictionary = [[NSBundle mainBundle] infoDictionary]; + + NSString *installingVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:(id)kCFBundleVersionKey]; + NSString *versionString = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; + NSDictionary* localizedInfoDictionary = [[NSBundle mainBundle] localizedInfoDictionary]; self.appNameLabel.stringValue = [localizedInfoDictionary objectForKey:@"CFBundleName"]; - self.appVersionLabel.stringValue = [infoDictionary objectForKey:@"CFBundleShortVersionString"]; + self.appVersionLabel.stringValue = [NSString stringWithFormat:@"%@ Build %@", versionString, installingVersion]; self.appCopyrightLabel.stringValue = [localizedInfoDictionary objectForKey:@"NSHumanReadableCopyright"]; self.appEULAContent.string = [localizedInfoDictionary objectForKey:@"CFEULAContent"]; } - (void) showWithSender:(id)sender { - // FIXME: updating the strings every time is a temporary workaround - [self updateInfo]; - [self.window orderFront:sender]; } @end