New About Window // dev phase 3-7.
- Fix an issue that the IME crashes when the first time the About window loads. - Make sure the confirm button works even if the NSWindowButtons are not visible. Previously they were disabled, hindering the confirm button from being functional. - Make sure the About Window always gets pushed to the front every time the user clicks the "about..." menu item. - Attempt to let the About window dealloc correctly.
This commit is contained in:
parent
039b9d9a01
commit
4418440e36
|
@ -33,6 +33,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#import "frmAboutWindow.h"
|
||||||
|
|
||||||
@class PreferencesWindowController;
|
@class PreferencesWindowController;
|
||||||
|
|
||||||
|
@ -44,11 +45,13 @@
|
||||||
NSMutableData *_receivingData;
|
NSMutableData *_receivingData;
|
||||||
NSURL *_updateNextStepURL;
|
NSURL *_updateNextStepURL;
|
||||||
PreferencesWindowController *_preferencesWindowController;
|
PreferencesWindowController *_preferencesWindowController;
|
||||||
|
frmAboutWindow *_aboutWindowController;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)checkForUpdate;
|
- (void)checkForUpdate;
|
||||||
- (void)checkForUpdateForced:(BOOL)forced;
|
- (void)checkForUpdateForced:(BOOL)forced;
|
||||||
- (void)showPreferences;
|
- (void)showPreferences;
|
||||||
|
- (void)showAbout;
|
||||||
|
|
||||||
@property (weak, nonatomic) IBOutlet NSWindow *window;
|
@property (weak, nonatomic) IBOutlet NSWindow *window;
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -55,6 +55,7 @@ static const NSTimeInterval kTimeoutInterval = 60.0;
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
_preferencesWindowController = nil;
|
_preferencesWindowController = nil;
|
||||||
|
_aboutWindowController = nil;
|
||||||
_updateCheckConnection = nil;
|
_updateCheckConnection = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,9 +275,17 @@ static const NSTimeInterval kTimeoutInterval = 60.0;
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)showAbout {
|
||||||
|
if (!_aboutWindowController) {
|
||||||
|
_aboutWindowController = [[frmAboutWindow alloc] initWithWindowNibName:@"frmAboutWindow"];
|
||||||
|
}
|
||||||
|
[[_aboutWindowController window] center];
|
||||||
|
[[_aboutWindowController window] orderFrontRegardless];
|
||||||
|
}
|
||||||
|
|
||||||
- (IBAction) about:(id)sender {
|
- (IBAction) about:(id)sender {
|
||||||
// Show the window:
|
[(AppDelegate *)[NSApp delegate] showAbout];
|
||||||
[[frmAboutWindow defaultController] showWithSender:self];
|
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -16,10 +16,12 @@
|
||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||||
<window title="About vChewing for macOS" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" tabbingMode="disallowed" titlebarAppearsTransparent="YES" id="ttlAboutWindow">
|
<window title="About vChewing for macOS" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" animationBehavior="default" tabbingMode="disallowed" titlebarAppearsTransparent="YES" id="ttlAboutWindow">
|
||||||
<windowStyleMask key="styleMask" titled="YES" texturedBackground="YES"/>
|
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
|
||||||
<rect key="contentRect" x="196" y="240" width="533" height="430"/>
|
<rect key="contentRect" x="196" y="240" width="533" height="430"/>
|
||||||
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
|
<rect key="screenRect" x="0.0" y="0.0" width="1600" height="875"/>
|
||||||
|
<value key="minSize" type="size" width="533" height="430"/>
|
||||||
|
<value key="maxSize" type="size" width="533" height="430"/>
|
||||||
<view key="contentView" id="se5-gp-TjO">
|
<view key="contentView" id="se5-gp-TjO">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="533" height="430"/>
|
<rect key="frame" x="0.0" y="0.0" width="533" height="430"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
|
@ -49,16 +51,13 @@
|
||||||
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||||
</textView>
|
</textView>
|
||||||
</subviews>
|
</subviews>
|
||||||
<connections>
|
|
||||||
<binding destination="CaN-wP-mkf" name="hidden" keyPath="values" id="Vgn-ZH-3hq"/>
|
|
||||||
</connections>
|
|
||||||
</clipView>
|
</clipView>
|
||||||
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="sfo-oN-iBH">
|
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="sfo-oN-iBH">
|
||||||
<rect key="frame" x="-100" y="-100" width="240" height="16"/>
|
<rect key="frame" x="-100" y="-100" width="240" height="16"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
</scroller>
|
</scroller>
|
||||||
<scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="X6W-MB-JfO">
|
<scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" controlSize="mini" horizontal="NO" id="X6W-MB-JfO">
|
||||||
<rect key="frame" x="410" y="1" width="16" height="176"/>
|
<rect key="frame" x="412" y="1" width="14" height="176"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
</scroller>
|
</scroller>
|
||||||
</scrollView>
|
</scrollView>
|
||||||
|
@ -67,7 +66,7 @@
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="119" id="eiH-Q0-Ud8"/>
|
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="119" id="eiH-Q0-Ud8"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<textFieldCell key="cell" lineBreakMode="clipping" title="vChewing for macOS" id="lblAppTitle">
|
<textFieldCell key="cell" lineBreakMode="clipping" title="vChewing for macOS" id="lblAppTitle" userLabel="appNameLabel">
|
||||||
<font key="font" metaFont="cellTitle"/>
|
<font key="font" metaFont="cellTitle"/>
|
||||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
|
@ -103,7 +102,8 @@
|
||||||
<textFieldCell key="cell" selectable="YES" id="lblCredits">
|
<textFieldCell key="cell" selectable="YES" id="lblCredits">
|
||||||
<font key="font" metaFont="cellTitle"/>
|
<font key="font" metaFont="cellTitle"/>
|
||||||
<string key="title">McBopomofo Engine by Mengjuei Hsieh, Lukhnos Liu, Zonble Yang, et al.
|
<string key="title">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.</string>
|
vChewing macOS Development Reinforced by Hiraku Wang.
|
||||||
|
vChewing Phrase Database Maintained by Shiki Suen.</string>
|
||||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
|
@ -131,6 +131,9 @@ vChewing macOS Development Reinforced by Hiraku Wang.
vChewing Phrase Database
|
||||||
DQ
|
DQ
|
||||||
</string>
|
</string>
|
||||||
</buttonCell>
|
</buttonCell>
|
||||||
|
<connections>
|
||||||
|
<action selector="performClose:" target="-1" id="0yK-v8-KQd"/>
|
||||||
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="d81-Fe-uNT">
|
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="d81-Fe-uNT">
|
||||||
<rect key="frame" x="13" y="21" width="379" height="83"/>
|
<rect key="frame" x="13" y="21" width="379" height="83"/>
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#import "Gramambular.h"
|
#import "Gramambular.h"
|
||||||
#import "FastLM.h"
|
#import "FastLM.h"
|
||||||
#import "UserOverrideModel.h"
|
#import "UserOverrideModel.h"
|
||||||
|
#import "frmAboutWindow.h"
|
||||||
|
|
||||||
@interface vChewingInputMethodController : IMKInputController
|
@interface vChewingInputMethodController : IMKInputController
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#import "OVStringHelper.h"
|
#import "OVStringHelper.h"
|
||||||
#import "OVUTF8Helper.h"
|
#import "OVUTF8Helper.h"
|
||||||
#import "AppDelegate.h"
|
#import "AppDelegate.h"
|
||||||
#import "frmAboutWindow.h"
|
|
||||||
#import "VTHorizontalCandidateController.h"
|
#import "VTHorizontalCandidateController.h"
|
||||||
#import "VTVerticalCandidateController.h"
|
#import "VTVerticalCandidateController.h"
|
||||||
#import "vChewing-Swift.h"
|
#import "vChewing-Swift.h"
|
||||||
|
@ -1327,7 +1326,9 @@ static double FindHighestScore(const vector<NodeAnchor>& nodes, double epsilon)
|
||||||
|
|
||||||
- (void)showAbout:(id)sender
|
- (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
|
- (void)toggleChineseConverter:(id)sender
|
||||||
|
|
|
@ -60,27 +60,26 @@
|
||||||
- (void) windowDidLoad {
|
- (void) windowDidLoad {
|
||||||
|
|
||||||
[super windowDidLoad];
|
[super windowDidLoad];
|
||||||
|
[self.window standardWindowButton:NSWindowCloseButton].hidden = true;
|
||||||
|
[self.window standardWindowButton:NSWindowMiniaturizeButton].hidden = true;
|
||||||
|
[self.window standardWindowButton:NSWindowZoomButton].hidden = true;
|
||||||
[self updateInfo];
|
[self updateInfo];
|
||||||
|
|
||||||
// If you add more custom subviews to display additional information about
|
|
||||||
// your app, configure them here
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) updateInfo {
|
- (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];
|
NSDictionary* localizedInfoDictionary = [[NSBundle mainBundle] localizedInfoDictionary];
|
||||||
|
|
||||||
self.appNameLabel.stringValue = [localizedInfoDictionary objectForKey:@"CFBundleName"];
|
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.appCopyrightLabel.stringValue = [localizedInfoDictionary objectForKey:@"NSHumanReadableCopyright"];
|
||||||
self.appEULAContent.string = [localizedInfoDictionary objectForKey:@"CFEULAContent"];
|
self.appEULAContent.string = [localizedInfoDictionary objectForKey:@"CFEULAContent"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) showWithSender:(id)sender {
|
- (void) showWithSender:(id)sender {
|
||||||
// FIXME: updating the strings every time is a temporary workaround
|
|
||||||
[self updateInfo];
|
|
||||||
[self.window orderFront:sender];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue