aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-11-19 22:02:45 +0000
committerstuconnolly <stuart02@gmail.com>2009-11-19 22:02:45 +0000
commit8110678ed8c66a5daf2223d1ca53956d97edee23 (patch)
tree01a4a6228eefb1ee073014b9af3300991d4e95f8 /Source
parentdaa5efe61df282fe602210b5b955a7d21206bf1e (diff)
downloadsequelpro-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')
-rw-r--r--Source/SPAboutController.h40
-rw-r--r--Source/SPAboutController.m85
-rw-r--r--Source/SPAppController.h4
-rw-r--r--Source/SPAppController.m13
4 files changed, 140 insertions, 2 deletions
diff --git a/Source/SPAboutController.h b/Source/SPAboutController.h
new file mode 100644
index 00000000..9abff263
--- /dev/null
+++ b/Source/SPAboutController.h
@@ -0,0 +1,40 @@
+//
+// $Id$
+//
+// SPAboutController.h
+// 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 <Cocoa/Cocoa.h>
+
+@interface SPAboutController : NSWindowController
+{
+ IBOutlet NSTextField *appNameVersionTextField;
+ IBOutlet NSTextField *appBuildVersionTextField;
+ IBOutlet NSTextView *appCreditsTextView;
+ IBOutlet NSTextView *appLicenseTextView;
+ IBOutlet NSPanel *appLicensePanel;
+}
+
+- (IBAction)openApplicationLicenseSheet:(id)sender;
+- (IBAction)closeApplicationLicenseSheet:(id)sender;
+
+@end
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
diff --git a/Source/SPAppController.h b/Source/SPAppController.h
index b01a069f..68ba179a 100644
--- a/Source/SPAppController.h
+++ b/Source/SPAppController.h
@@ -25,18 +25,20 @@
#import <Cocoa/Cocoa.h>
-@class SPPreferenceController;
+@class SPPreferenceController, SPAboutController;
@interface SPAppController : NSObject
{
BOOL isNewFavorite;
+ SPAboutController *aboutController;
SPPreferenceController *prefsController;
id encodingPopUp;
}
// IBAction methods
+- (IBAction)openAboutPanel:(id)sender;
- (IBAction)openPreferences:(id)sender;
- (IBAction)openConnectionSheet:(id)sender;
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index 49f8c201..86c5fe38 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -27,6 +27,7 @@
#import "SPAppController.h"
#import "TableDocument.h"
#import "SPPreferenceController.h"
+#import "SPAboutController.h"
#import "TableDump.h"
#import "SPEncodingPopupAccessory.h"
#import "SPConstants.h"
@@ -295,7 +296,17 @@
#pragma mark IBAction methods
/**
- * Opens the preferences window
+ * Opens the about panel.
+ */
+- (IBAction)openAboutPanel:(id)sender
+{
+ if (!aboutController) aboutController = [[SPAboutController alloc] init];
+
+ [aboutController showWindow:self];
+}
+
+/**
+ * Opens the preferences window.
*/
- (IBAction)openPreferences:(id)sender
{