Fixed a crash when Core Image was available.
[ITKit.git] / ITAboutWindowController.m
1 #import "ITAboutWindowController.h"
2
3 static ITAboutWindowController *_sharedController;
4
5 @implementation ITAboutWindowController
6
7 + (ITAboutWindowController *)sharedController
8 {
9         if (!_sharedController) {
10                 _sharedController = [[ITAboutWindowController alloc] init];
11         }
12         return _sharedController;
13 }
14
15 - (id)init
16 {
17         if ( (self = [super init]) ) {
18                 [NSBundle loadNibNamed:@"ITAboutWindow" owner:self];
19         }
20         return self;
21 }
22
23 - (void)setupAboutWindow
24 {
25         [_appIcon setImage:[[[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIconFile"]]] autorelease]];
26         
27         [_appName setStringValue:[NSString stringWithFormat:@"%@ %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"], [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]]];
28         [_companySite setStringValue:@"http://www.ithinksw.com/"];
29         
30         [_copyright setStringValue:[[NSBundle mainBundle] localizedStringForKey:@"NSHumanReadableCopyright" value:@"" table:@"InfoPlist"]];
31 }
32
33 - (void)showAboutWindow
34 {
35         [self setupAboutWindow];
36         
37         [_window center];
38         [NSApp activateIgnoringOtherApps:YES];
39     [_window orderFrontRegardless];
40     [_window makeKeyWindow];
41 }
42
43 - (BOOL)isVisible
44 {
45         return [_window isVisible];
46 }
47
48 @end