diff --git a/Source/Base.lproj/frmAboutWindow.xib b/Source/Base.lproj/frmAboutWindow.xib index 12d4811f..ab42cf91 100644 --- a/Source/Base.lproj/frmAboutWindow.xib +++ b/Source/Base.lproj/frmAboutWindow.xib @@ -110,22 +110,6 @@ vChewing Phrase Database Maintained by Shiki Suen. - @@ -156,6 +140,22 @@ DQ + @@ -172,11 +172,12 @@ DQ - + + @@ -189,7 +190,6 @@ DQ - diff --git a/Source/InputMethodController.h b/Source/InputMethodController.h index c72236dd..31403854 100644 --- a/Source/InputMethodController.h +++ b/Source/InputMethodController.h @@ -12,7 +12,6 @@ #import "Gramambular.h" #import "vChewingLM.h" #import "UserOverrideModel.h" -#import "frmAboutWindow.h" @interface vChewingInputMethodController : IMKInputController { diff --git a/Source/frmAboutWindow.h b/Source/frmAboutWindow.h deleted file mode 100644 index a8e22fc8..00000000 --- a/Source/frmAboutWindow.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * frmAboutWindow.h - * - * Copyright 2021-2022 vChewing Project (3-Clause BSD License). - * Derived from 2011-2022 OpenVanilla Project (MIT License). - * Some rights reserved. See "LICENSE.TXT" for details. - */ - -#import - -@interface frmAboutWindow : NSWindowController - -+ (instancetype) defaultController; -- (void) showWithSender:(id)sender; - -@property (nonatomic) IBOutlet NSTextField *appNameLabel; -@property (nonatomic) IBOutlet NSTextField *appVersionLabel; -@property (nonatomic) IBOutlet NSTextField *appCopyrightLabel; -@property (nonatomic) IBOutlet NSTextView *appEULAContent; - -@end diff --git a/Source/frmAboutWindow.m b/Source/frmAboutWindow.m deleted file mode 100644 index 69f46732..00000000 --- a/Source/frmAboutWindow.m +++ /dev/null @@ -1,67 +0,0 @@ -/* - * frmAboutWindow.m - * - * Copyright 2021-2022 vChewing Project (3-Clause BSD License). - * Derived from 2011-2022 OpenVanilla Project (MIT License). - * Some rights reserved. See "LICENSE.TXT" for details. - */ - -#import "frmAboutWindow.h" - - -@implementation frmAboutWindow -@synthesize appNameLabel; -@synthesize appVersionLabel; -@synthesize appCopyrightLabel; -@synthesize appEULAContent; - -+ (instancetype) defaultController { - - static id staticInstance = nil; - static dispatch_once_t onceToken; - - dispatch_once(&onceToken, ^{ - staticInstance = [[self alloc] init]; - }); - - return staticInstance; -} - - -#pragma mark - Initialization - - -- (instancetype) init { - return [super initWithWindowNibName:@"frmAboutWindow" owner:self]; -} - - -#pragma mark - NSWindowController - - -- (void) windowDidLoad { - - [super windowDidLoad]; - [self.window standardWindowButton:NSWindowCloseButton].hidden = true; - [self.window standardWindowButton:NSWindowMiniaturizeButton].hidden = true; - [self.window standardWindowButton:NSWindowZoomButton].hidden = true; - [self updateInfo]; -} - -- (void) updateInfo { - - 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 = [NSString stringWithFormat:@"%@ Build %@", versionString, installingVersion]; - self.appCopyrightLabel.stringValue = [localizedInfoDictionary objectForKey:@"NSHumanReadableCopyright"]; - self.appEULAContent.string = [localizedInfoDictionary objectForKey:@"CFEULAContent"]; -} - -- (void) showWithSender:(id)sender { -} - -@end diff --git a/Source/frmAboutWindow.swift b/Source/frmAboutWindow.swift new file mode 100644 index 00000000..102c0178 --- /dev/null +++ b/Source/frmAboutWindow.swift @@ -0,0 +1,35 @@ +/* + * frmAboutWindow.swift + * + * Copyright 2021-2022 vChewing Project (3-Clause BSD License). + * Derived from 2011-2022 OpenVanilla Project (MIT License). + * Some rights reserved. See "LICENSE.TXT" for details. + */ + +import Cocoa + +@objc(frmAboutWindow) class frmAboutWindow: NSWindowController { + @IBOutlet weak var appVersionLabel: NSTextField! + @IBOutlet weak var appCopyrightLabel: NSTextField! + @IBOutlet var appEULAContent: NSTextView! + + override func windowDidLoad() { + super.windowDidLoad() + + window?.standardWindowButton(.closeButton)?.isHidden = true + window?.standardWindowButton(.miniaturizeButton)?.isHidden = true + window?.standardWindowButton(.zoomButton)?.isHidden = true + guard let installingVersion = Bundle.main.infoDictionary?[kCFBundleVersionKey as String] as? String, + let versionString = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String else { + return + } + if let copyrightLabel = Bundle.main.localizedInfoDictionary?["NSHumanReadableCopyright"] as? String { + appCopyrightLabel.stringValue = copyrightLabel + } + if let eulaContent = Bundle.main.localizedInfoDictionary?["CFEULAContent"] as? String { + appEULAContent.string = eulaContent + } + appVersionLabel.stringValue = String(format: "%@ Build %@", versionString, installingVersion) + } + +} diff --git a/Source/vChewing-Bridging-Header.h b/Source/vChewing-Bridging-Header.h index 1e362a3b..7fc9cd38 100644 --- a/Source/vChewing-Bridging-Header.h +++ b/Source/vChewing-Bridging-Header.h @@ -10,7 +10,6 @@ // Use this file to import your target's public headers that you would like to expose to Swift. // -#import "frmAboutWindow.h" #import // @import Foundation; @interface LanguageModelManager : NSObject + (void)loadDataModels; diff --git a/vChewing.xcodeproj/project.pbxproj b/vChewing.xcodeproj/project.pbxproj index 40c77490..6317409b 100644 --- a/vChewing.xcodeproj/project.pbxproj +++ b/vChewing.xcodeproj/project.pbxproj @@ -13,6 +13,7 @@ 5B21711B279B998C00F91A2B /* Chronosphere.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B217119279B998800F91A2B /* Chronosphere.m */; }; 5B21711E279B9AD900F91A2B /* ArchiveUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B21711C279B9AD700F91A2B /* ArchiveUtil.swift */; }; 5B217126279BA37500F91A2B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B217124279BA37300F91A2B /* AppDelegate.swift */; }; + 5B217128279BB22700F91A2B /* frmAboutWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B217127279BB22700F91A2B /* frmAboutWindow.swift */; }; 5B42B64027876FDC00BB9B9F /* UserOverrideModel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5B42B63E27876FDC00BB9B9F /* UserOverrideModel.cpp */; }; 5B58E87F278413E7003EA2AD /* BSDLicense.txt in Resources */ = {isa = PBXBuildFile; fileRef = 5B58E87D278413E7003EA2AD /* BSDLicense.txt */; }; 5B5F4F8E27928F9300922DC2 /* vChewingLM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5B5F4F8D27928F9300922DC2 /* vChewingLM.cpp */; }; @@ -39,7 +40,6 @@ 5BDF2D062791DFF200838ADB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BDF2D052791DA6700838ADB /* AppDelegate.swift */; }; 5BE798A42792E58A00337FF9 /* TooltipController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BE798A32792E58A00337FF9 /* TooltipController.swift */; }; 5BE798A72793280C00337FF9 /* NotifierController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BE798A62793280C00337FF9 /* NotifierController.swift */; }; - 5BF4A6FE27844738007DC6E7 /* frmAboutWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BF4A6FC27844738007DC6E7 /* frmAboutWindow.m */; }; 5BF4A70027844DC5007DC6E7 /* frmAboutWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5BF4A70227844DC5007DC6E7 /* frmAboutWindow.xib */; }; 6A0421A815FEF3F50061ED63 /* FastLM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6A0421A615FEF3F50061ED63 /* FastLM.cpp */; }; 6A0D4EA715FC0D2D00ABF4B3 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A0D4EA615FC0D2D00ABF4B3 /* Cocoa.framework */; }; @@ -95,6 +95,7 @@ 5B217119279B998800F91A2B /* Chronosphere.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Chronosphere.m; sourceTree = ""; }; 5B21711C279B9AD700F91A2B /* ArchiveUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArchiveUtil.swift; sourceTree = ""; }; 5B217124279BA37300F91A2B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 5B217127279BB22700F91A2B /* frmAboutWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = frmAboutWindow.swift; sourceTree = ""; }; 5B42B63E27876FDC00BB9B9F /* UserOverrideModel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserOverrideModel.cpp; sourceTree = ""; }; 5B42B63F27876FDC00BB9B9F /* UserOverrideModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserOverrideModel.h; sourceTree = ""; }; 5B42B64127877D6500BB9B9F /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "Source/zh-Hans.lproj/preferences.strings"; sourceTree = ""; }; @@ -143,8 +144,6 @@ 5BDF2D052791DA6700838ADB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 5BE798A32792E58A00337FF9 /* TooltipController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TooltipController.swift; sourceTree = ""; }; 5BE798A62793280C00337FF9 /* NotifierController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotifierController.swift; sourceTree = ""; }; - 5BF4A6FB27844738007DC6E7 /* frmAboutWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = frmAboutWindow.h; sourceTree = ""; }; - 5BF4A6FC27844738007DC6E7 /* frmAboutWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = frmAboutWindow.m; sourceTree = ""; }; 5BF4A70327844DD0007DC6E7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/frmAboutWindow.xib; sourceTree = ""; }; 5BF4A70527844DD2007DC6E7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/frmAboutWindow.strings; sourceTree = ""; }; 5BF4A70727844DD3007DC6E7 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/frmAboutWindow.strings"; sourceTree = ""; }; @@ -362,8 +361,6 @@ 6A0D4F1215FC0EB100ABF4B3 /* Engine */, 6ACA41E715FC1D9000935EF6 /* Installer */, 6A0D4F4715FC0EB900ABF4B3 /* Resources */, - 5BF4A6FB27844738007DC6E7 /* frmAboutWindow.h */, - 5BF4A6FC27844738007DC6E7 /* frmAboutWindow.m */, 6A0D4EC615FC0D6400ABF4B3 /* InputMethodController.h */, 6A0D4EC715FC0D6400ABF4B3 /* InputMethodController.mm */, 5B5F4F91279294A300922DC2 /* LanguageModelManager.h */, @@ -371,6 +368,7 @@ 6A0D4EC815FC0D6400ABF4B3 /* main.swift */, 6A0D4EF615FC0DA600ABF4B3 /* vChewing-Prefix.pch */, 5BDF2D052791DA6700838ADB /* AppDelegate.swift */, + 5B217127279BB22700F91A2B /* frmAboutWindow.swift */, 5BDF2CFD2791BE4400838ADB /* InputSourceHelper.swift */, 5BDF2D022791C71200838ADB /* NonModalAlertWindowController.swift */, D427A9C025ED28CC005D43E0 /* OpenCCBridge.swift */, @@ -704,7 +702,6 @@ 5B5F4F93279294A300922DC2 /* LanguageModelManager.mm in Sources */, 6A0D4ED215FC0D6400ABF4B3 /* InputMethodController.mm in Sources */, 6A0D4ED315FC0D6400ABF4B3 /* main.swift in Sources */, - 5BF4A6FE27844738007DC6E7 /* frmAboutWindow.m in Sources */, 5B5F4F972792A4EA00922DC2 /* UserPhrasesLM.cpp in Sources */, 5BC2D2882793B434002C0BEC /* KeyValueBlobReader.cpp in Sources */, 5B5F4F8E27928F9300922DC2 /* vChewingLM.cpp in Sources */, @@ -719,6 +716,7 @@ 6A0421A815FEF3F50061ED63 /* FastLM.cpp in Sources */, 5BDF2D012791C03B00838ADB /* PreferencesWindowController.swift in Sources */, 5BC2D28D2793B98F002C0BEC /* PreferencesModule.swift in Sources */, + 5B217128279BB22700F91A2B /* frmAboutWindow.swift in Sources */, 5BD13F482794F0A6000E429F /* PhraseReplacementMap.cpp in Sources */, 5BC3EE1C278FC48C00F5E44C /* VTCandidateController.swift in Sources */, 5BDF2D032791C71200838ADB /* NonModalAlertWindowController.swift in Sources */,