diff options
author | stuconnolly <stuart02@gmail.com> | 2009-11-19 22:02:45 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-11-19 22:02:45 +0000 |
commit | 8110678ed8c66a5daf2223d1ca53956d97edee23 (patch) | |
tree | 01a4a6228eefb1ee073014b9af3300991d4e95f8 /Source/SPAboutController.m | |
parent | daa5efe61df282fe602210b5b955a7d21206bf1e (diff) | |
download | sequelpro-8110678ed8c66a5daf2223d1ca53956d97edee23.tar.gz sequelpro-8110678ed8c66a5daf2223d1ca53956d97edee23.tar.bz2 sequelpro-8110678ed8c66a5daf2223d1ca53956d97edee23.zip |
The result of being bored. Add a nicer looking about panel based on Adium's.
Diffstat (limited to 'Source/SPAboutController.m')
-rw-r--r-- | Source/SPAboutController.m | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/Source/SPAboutController.m b/Source/SPAboutController.m new file mode 100644 index 00000000..4e5c94f9 --- /dev/null +++ b/Source/SPAboutController.m @@ -0,0 +1,85 @@ +// +// $Id$ +// +// SPAboutController.m +// sequel-pro +// +// Created by Stuart Connolly (stuconnolly.com) on November 18, 2009 +// Copyright (c) 2009 Stuart Connolly. All rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// More info at <http://code.google.com/p/sequel-pro/> + +#import "SPAboutController.h" + +@implementation SPAboutController + +/** + * Initialisation + */ +- (id)init +{ + return [super initWithWindowNibName:@"AboutPanel"]; +} + +/** + * Initialize interface controls. + */ +- (void)awakeFromNib +{ + BOOL isNightly = NO; + NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; + + // If the version string has a prefix of 'Nightly' then this is obviously a nighly build. + if ([version hasPrefix:@"Nightly"]) isNightly = YES; + + // Set the application name, but only include the major version if this is not a nightly build. + [appNameVersionTextField setStringValue:(isNightly) ? @"Sequel Pro" : [NSString stringWithFormat:@"Sequel Pro %@", version]]; + + // Set the bundle/build version + [appBuildVersionTextField setStringValue:[NSString stringWithFormat:@"%@ %@", (isNightly) ? NSLocalizedString(@"Nightly Build", @"nightly build label") : NSLocalizedString(@"Build", @"build label") , [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]]]; + + // Get the credits file contents + NSAttributedString *credits = [[[NSAttributedString alloc] initWithPath:[[NSBundle mainBundle] pathForResource:@"Credits" ofType:@"rtf"] documentAttributes:nil] autorelease]; + + // Get the license file contents + NSAttributedString *license = [[[NSAttributedString alloc] initWithPath:[[NSBundle mainBundle] pathForResource:@"License" ofType:@"rtf"] documentAttributes:nil] autorelease]; + + // Set the credits + [[appCreditsTextView textStorage] appendAttributedString:credits]; + + // Set the license + [[appLicenseTextView textStorage] appendAttributedString:license]; +} + +/** + * Display the license sheet. + */ +- (IBAction)openApplicationLicenseSheet:(id)sender +{ + [NSApp beginSheet:appLicensePanel modalForWindow:[self window] modalDelegate:self didEndSelector:nil contextInfo:nil]; +} + +/** + * Close the license sheet. + */ +- (IBAction)closeApplicationLicenseSheet:(id)sender; +{ + [NSApp endSheet:appLicensePanel returnCode:0]; + [appLicensePanel orderOut:self]; +} + +@end |