New About Window // dev phase 2.

Fix an issue that the About window failed from retrieving and presenting specified data fields from info.plist file.
This commit is contained in:
Hiraku 2022-01-10 16:23:14 +08:00 committed by ShikiSuen
parent 0ef8db6406
commit 039b9d9a01
5 changed files with 25 additions and 10 deletions

View File

@ -276,7 +276,7 @@ static const NSTimeInterval kTimeoutInterval = 60.0;
- (IBAction) about:(id)sender {
// Show the window:
[[frmAboutWindow defaultController].window orderFront:self];
[[frmAboutWindow defaultController] showWithSender:self];
}
@end

View File

@ -8,6 +8,9 @@
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="frmAboutWindow">
<connections>
<outlet property="appCopyrightLabel" destination="8Ju-DR-2C8" id="Odh-c7-nyT"/>
<outlet property="appEULAContent" destination="g8d-ZO-VdQ" id="mLE-Az-YkE"/>
<outlet property="appVersionLabel" destination="9Pk-k3-0cO" id="y37-SM-qyG"/>
<outlet property="window" destination="ttlAboutWindow" id="gIp-Ho-8D9"/>
</connections>
</customObject>

View File

@ -1327,7 +1327,7 @@ static double FindHighestScore(const vector<NodeAnchor>& nodes, double epsilon)
- (void)showAbout:(id)sender
{
[[frmAboutWindow defaultController].window orderFront:sender];
[[frmAboutWindow defaultController] showWithSender:sender];
}
- (void)toggleChineseConverter:(id)sender

View File

@ -3,7 +3,7 @@
// Tile Map Editor
//
// Created & Original Rights by Nicolás Miari on 2016/02/11.
// Patched by Shiki Suen for the vChewing Project.
// Patched by Hiraku Wang and Shiki Suen for the vChewing Project.
// Released under MIT License.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -29,6 +29,7 @@
@interface frmAboutWindow : NSWindowController
+ (instancetype) defaultController;
- (void) showWithSender:(id)sender;
@property (nonatomic) IBOutlet NSTextField *appNameLabel;
@property (nonatomic) IBOutlet NSTextField *appVersionLabel;

View File

@ -3,7 +3,7 @@
// Tile Map Editor
//
// Created & Original Rights by Nicolás Miari on 2016/02/11.
// Patched by Shiki Suen for the vChewing Project.
// Patched by Hiraku Wang and Shiki Suen for the vChewing Project.
// Released under MIT License.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
@ -61,15 +61,26 @@
[super windowDidLoad];
NSDictionary* infoDictionary = [[NSBundle mainBundle] infoDictionary];
self.appNameLabel.stringValue = [infoDictionary objectForKey:@"CFBundleName"];
self.appVersionLabel.stringValue = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
self.appCopyrightLabel.stringValue = [infoDictionary objectForKey:@"NSHumanReadableCopyright"];
self.appEULAContent.string = [infoDictionary objectForKey:@"CFEULAContent"];
[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];
NSDictionary* localizedInfoDictionary = [[NSBundle mainBundle] localizedInfoDictionary];
self.appNameLabel.stringValue = [localizedInfoDictionary objectForKey:@"CFBundleName"];
self.appVersionLabel.stringValue = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
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