Fixed whitespace in OpenPanel.
Updated localization scripts to account for new nib.CQTexperiment
parent
c28e8d058d
commit
d88d245f46
|
@ -19,6 +19,7 @@ if ! [ -d Prferences/General/$language.lproj ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
nibtool -d Localizations/$language/MainUI.strings English.lproj/MainMenu.nib -W $language.lproj/MainMenu.nib
|
nibtool -d Localizations/$language/MainUI.strings English.lproj/MainMenu.nib -W $language.lproj/MainMenu.nib
|
||||||
|
nibtool -d Localizations/$language/OpenURLPanel.strings English.lproj/OpenURLPanel.nib -W $language.lproj/OpenURLPanel.nib
|
||||||
nibtool -d Localizations/$language/PreferencesUI.strings Preferences/General/English.lproj/Preferences.nib -W Preferences/General/$language.lproj/Preferences.nib
|
nibtool -d Localizations/$language/PreferencesUI.strings Preferences/General/English.lproj/Preferences.nib -W Preferences/General/$language.lproj/Preferences.nib
|
||||||
cp Localizations/$language/MainProgram.strings $language.lproj/Localizable.strings
|
cp Localizations/$language/MainProgram.strings $language.lproj/Localizable.strings
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ if ! [ -d Localizations/English ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
nibtool -L English.lproj/MainMenu.nib > Localizations/English/MainUI.strings
|
nibtool -L English.lproj/MainMenu.nib > Localizations/English/MainUI.strings
|
||||||
|
nibtool -L English.lproj/OpenURLPanel.nib > Localizations/English/OpenURLPanel.strings
|
||||||
|
|
||||||
nibtool -L Preferences/General/English.lproj/Preferences.nib > Localizations/English/PreferencesUI.strings
|
nibtool -L Preferences/General/English.lproj/Preferences.nib > Localizations/English/PreferencesUI.strings
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
"QTKit Programming Guide" documentation.
|
"QTKit Programming Guide" documentation.
|
||||||
|
|
||||||
|
|
||||||
Copyright: © Copyright 2004, 2005 Apple Computer, Inc.
|
Copyright: © Copyright 2004, 2005 Apple Computer, Inc.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by
|
Disclaimer: IMPORTANT: This Apple software is supplied to you by
|
||||||
Apple Computer, Inc. ("Apple") in consideration of your agreement to the
|
Apple Computer, Inc. ("Apple") in consideration of your agreement to the
|
||||||
following terms, and your use, installation, modification or
|
following terms, and your use, installation, modification or
|
||||||
redistribution of this Apple software constitutes acceptance of these
|
redistribution of this Apple software constitutes acceptance of these
|
||||||
terms. If you do not agree with these terms, please do not use,
|
terms. If you do not agree with these terms, please do not use,
|
||||||
install, modify or redistribute this Apple software.
|
install, modify or redistribute this Apple software.
|
||||||
|
|
||||||
In consideration of your agreement to abide by the following terms, and
|
In consideration of your agreement to abide by the following terms, and
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
text and disclaimers in all such redistributions of the Apple Software.
|
text and disclaimers in all such redistributions of the Apple Software.
|
||||||
Neither the name, trademarks, service marks or logos of Apple Computer,
|
Neither the name, trademarks, service marks or logos of Apple Computer,
|
||||||
Inc. may be used to endorse or promote products derived from the Apple
|
Inc. may be used to endorse or promote products derived from the Apple
|
||||||
Software without specific prior written permission from Apple. Except
|
Software without specific prior written permission from Apple. Except
|
||||||
as expressly stated in this notice, no other rights or licenses, express
|
as expressly stated in this notice, no other rights or licenses, express
|
||||||
or implied, are granted by Apple herein, including but not limited to
|
or implied, are granted by Apple herein, including but not limited to
|
||||||
any patent rights that may be infringed by your derivative works or by
|
any patent rights that may be infringed by your derivative works or by
|
||||||
|
@ -56,38 +56,38 @@
|
||||||
|
|
||||||
@interface OpenURLPanel : NSObject
|
@interface OpenURLPanel : NSObject
|
||||||
{
|
{
|
||||||
// panel
|
// panel
|
||||||
IBOutlet NSPanel *mPanel;
|
IBOutlet NSPanel *mPanel;
|
||||||
IBOutlet NSComboBox *mUrlComboBox;
|
IBOutlet NSComboBox *mUrlComboBox;
|
||||||
|
|
||||||
// open url panel
|
// open url panel
|
||||||
id mDelegate;
|
id mDelegate;
|
||||||
SEL mDidEndSelector;
|
SEL mDidEndSelector;
|
||||||
void *mContextInfo;
|
void *mContextInfo;
|
||||||
NSMutableArray *mUrlArray;
|
NSMutableArray *mUrlArray;
|
||||||
BOOL mIsSheet;
|
BOOL mIsSheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
// class methods
|
// class methods
|
||||||
+ (id)openURLPanel;
|
+ (id)openURLPanel;
|
||||||
|
|
||||||
// getters
|
// getters
|
||||||
- (NSString *)urlString;
|
- (NSString *)urlString;
|
||||||
- (NSURL *)url;
|
- (NSURL *)url;
|
||||||
|
|
||||||
// setters
|
// setters
|
||||||
- (void)setURLArray:(NSMutableArray *)urlArray;
|
- (void)setURLArray:(NSMutableArray *)urlArray;
|
||||||
|
|
||||||
// delegates
|
// delegates
|
||||||
- (void)awakeFromNib;
|
- (void)awakeFromNib;
|
||||||
|
|
||||||
// notifications
|
// notifications
|
||||||
- (void)writeURLs:(NSNotification *)notification;
|
- (void)writeURLs:(NSNotification *)notification;
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
- (IBAction)doOpenURL:(id)sender;
|
- (IBAction)doOpenURL:(id)sender;
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
- (void)beginSheetWithWindow:(NSWindow *)window delegate:(id)delegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo;
|
- (void)beginSheetWithWindow:(NSWindow *)window delegate:(id)delegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo;
|
||||||
- (void)close;
|
- (void)close;
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,14 @@
|
||||||
"QTKit Programming Guide" documentation.
|
"QTKit Programming Guide" documentation.
|
||||||
|
|
||||||
|
|
||||||
Copyright: © Copyright 2004, 2005 Apple Computer, Inc.
|
Copyright: © Copyright 2004, 2005 Apple Computer, Inc.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Disclaimer: IMPORTANT: This Apple software is supplied to you by
|
Disclaimer: IMPORTANT: This Apple software is supplied to you by
|
||||||
Apple Computer, Inc. ("Apple") in consideration of your agreement to the
|
Apple Computer, Inc. ("Apple") in consideration of your agreement to the
|
||||||
following terms, and your use, installation, modification or
|
following terms, and your use, installation, modification or
|
||||||
redistribution of this Apple software constitutes acceptance of these
|
redistribution of this Apple software constitutes acceptance of these
|
||||||
terms. If you do not agree with these terms, please do not use,
|
terms. If you do not agree with these terms, please do not use,
|
||||||
install, modify or redistribute this Apple software.
|
install, modify or redistribute this Apple software.
|
||||||
|
|
||||||
In consideration of your agreement to abide by the following terms, and
|
In consideration of your agreement to abide by the following terms, and
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
text and disclaimers in all such redistributions of the Apple Software.
|
text and disclaimers in all such redistributions of the Apple Software.
|
||||||
Neither the name, trademarks, service marks or logos of Apple Computer,
|
Neither the name, trademarks, service marks or logos of Apple Computer,
|
||||||
Inc. may be used to endorse or promote products derived from the Apple
|
Inc. may be used to endorse or promote products derived from the Apple
|
||||||
Software without specific prior written permission from Apple. Except
|
Software without specific prior written permission from Apple. Except
|
||||||
as expressly stated in this notice, no other rights or licenses, express
|
as expressly stated in this notice, no other rights or licenses, express
|
||||||
or implied, are granted by Apple herein, including but not limited to
|
or implied, are granted by Apple herein, including but not limited to
|
||||||
any patent rights that may be infringed by your derivative works or by
|
any patent rights that may be infringed by your derivative works or by
|
||||||
|
@ -53,198 +53,199 @@
|
||||||
|
|
||||||
#import "OpenURLPanel.h"
|
#import "OpenURLPanel.h"
|
||||||
|
|
||||||
// user defaults keys
|
// user defaults keys
|
||||||
#define kUserDefaultURLsKey @"UserDefaultURLsKey"
|
#define kUserDefaultURLsKey @"UserDefaultURLsKey"
|
||||||
|
|
||||||
// maximum urls
|
// maximum urls
|
||||||
#define kMaximumURLs 15
|
#define kMaximumURLs 15
|
||||||
|
|
||||||
@implementation OpenURLPanel
|
@implementation OpenURLPanel
|
||||||
|
|
||||||
static OpenURLPanel *openURLPanel = nil;
|
static OpenURLPanel *openURLPanel = nil;
|
||||||
|
|
||||||
// class methods
|
// class methods
|
||||||
+ (id)openURLPanel
|
+ (id)openURLPanel
|
||||||
{
|
{
|
||||||
if (openURLPanel == nil)
|
if (openURLPanel == nil)
|
||||||
openURLPanel = [[self alloc] init];
|
openURLPanel = [[self alloc] init];
|
||||||
|
|
||||||
return openURLPanel;
|
return openURLPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)init
|
- (id)init
|
||||||
{
|
{
|
||||||
[super init];
|
[super init];
|
||||||
|
|
||||||
// init
|
// init
|
||||||
[self setURLArray:[NSMutableArray arrayWithCapacity:10]];
|
[self setURLArray:[NSMutableArray arrayWithCapacity:10]];
|
||||||
|
|
||||||
// listen for app termination notifications
|
// listen for app termination notifications
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(writeURLs:) name:NSApplicationWillTerminateNotification object:NSApp];
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(writeURLs:) name:NSApplicationWillTerminateNotification object:NSApp];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
[self setURLArray:nil];
|
[self setURLArray:nil];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
// getters
|
// getters
|
||||||
- (NSString *)urlString
|
- (NSString *)urlString
|
||||||
{
|
{
|
||||||
NSString *urlString = nil;
|
NSString *urlString = nil;
|
||||||
|
|
||||||
// get the url
|
// get the url
|
||||||
urlString = [mUrlComboBox stringValue];
|
urlString = [mUrlComboBox stringValue];
|
||||||
|
|
||||||
if (urlString == nil)
|
if (urlString == nil)
|
||||||
urlString = [mUrlComboBox objectValueOfSelectedItem];
|
urlString = [mUrlComboBox objectValueOfSelectedItem];
|
||||||
|
|
||||||
if ([urlString length] == 0)
|
if ([urlString length] == 0)
|
||||||
urlString = nil;
|
urlString = nil;
|
||||||
|
|
||||||
return urlString;
|
return urlString;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSURL *)url
|
- (NSURL *)url
|
||||||
{
|
{
|
||||||
NSURL *url = nil;
|
NSURL *url = nil;
|
||||||
NSString *urlString;
|
NSString *urlString;
|
||||||
|
|
||||||
// get the url
|
// get the url
|
||||||
urlString = [self urlString];
|
urlString = [self urlString];
|
||||||
|
|
||||||
if (urlString)
|
if (urlString)
|
||||||
url = [NSURL URLWithString:urlString];
|
url = [NSURL URLWithString:urlString];
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
// setters
|
// setters
|
||||||
- (void)setURLArray:(NSMutableArray *)urlLArray
|
- (void)setURLArray:(NSMutableArray *)urlLArray
|
||||||
{
|
{
|
||||||
[urlLArray retain];
|
[urlLArray retain];
|
||||||
[mUrlArray retain];
|
[mUrlArray retain];
|
||||||
mUrlArray = urlLArray;
|
mUrlArray = urlLArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
// delegates
|
// delegates
|
||||||
- (void)awakeFromNib
|
- (void)awakeFromNib
|
||||||
{
|
{
|
||||||
NSArray *urls;
|
NSArray *urls;
|
||||||
|
|
||||||
// restore the previous urls
|
// restore the previous urls
|
||||||
urls = [[NSUserDefaults standardUserDefaults] objectForKey:kUserDefaultURLsKey];
|
urls = [[NSUserDefaults standardUserDefaults] objectForKey:kUserDefaultURLsKey];
|
||||||
[mUrlArray addObjectsFromArray:urls];
|
[mUrlArray addObjectsFromArray:urls];
|
||||||
|
|
||||||
if (urls)
|
if (urls)
|
||||||
[mUrlComboBox addItemsWithObjectValues:urls];
|
[mUrlComboBox addItemsWithObjectValues:urls];
|
||||||
}
|
}
|
||||||
|
|
||||||
// notifications
|
// notifications
|
||||||
- (void)writeURLs:(NSNotification *)notification
|
- (void)writeURLs:(NSNotification *)notification
|
||||||
{
|
{
|
||||||
NSUserDefaults *userDefaults;
|
NSUserDefaults *userDefaults;
|
||||||
|
|
||||||
if ([mUrlArray count])
|
if ([mUrlArray count])
|
||||||
{
|
{
|
||||||
// init
|
// init
|
||||||
userDefaults = [NSUserDefaults standardUserDefaults];
|
userDefaults = [NSUserDefaults standardUserDefaults];
|
||||||
|
|
||||||
// write out the urls
|
// write out the urls
|
||||||
[userDefaults setObject:mUrlArray forKey:kUserDefaultURLsKey];
|
[userDefaults setObject:mUrlArray forKey:kUserDefaultURLsKey];
|
||||||
[userDefaults synchronize];
|
[userDefaults synchronize];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
- (IBAction)doOpenURL:(id)sender
|
- (IBAction)doOpenURL:(id)sender
|
||||||
{
|
{
|
||||||
NSString *urlString;
|
NSString *urlString;
|
||||||
NSURL *url;
|
NSURL *url;
|
||||||
BOOL informDelegate = YES;
|
BOOL informDelegate = YES;
|
||||||
IMP callback;
|
IMP callback;
|
||||||
|
|
||||||
if ([sender tag] == NSOKButton)
|
if ([sender tag] == NSOKButton)
|
||||||
{
|
{
|
||||||
// validate the URL
|
// validate the URL
|
||||||
url = [self url];
|
url = [self url];
|
||||||
urlString = [self urlString];
|
urlString = [self urlString];
|
||||||
|
|
||||||
if (url)
|
if (url)
|
||||||
{
|
{
|
||||||
// save the url
|
// save the url
|
||||||
if (![mUrlArray containsObject:urlString])
|
if (![mUrlArray containsObject:urlString])
|
||||||
{
|
{
|
||||||
// save the url
|
// save the url
|
||||||
[mUrlArray addObject:urlString];
|
[mUrlArray addObject:urlString];
|
||||||
|
|
||||||
// add the url to the combo box
|
// add the url to the combo box
|
||||||
[mUrlComboBox addItemWithObjectValue:urlString];
|
[mUrlComboBox addItemWithObjectValue:urlString];
|
||||||
|
|
||||||
// remove the oldest url if the maximum has been exceeded
|
// remove the oldest url if the maximum has been exceeded
|
||||||
if ([mUrlArray count] > kMaximumURLs)
|
if ([mUrlArray count] > kMaximumURLs)
|
||||||
{
|
{
|
||||||
[mUrlArray removeObjectAtIndex:0];
|
[mUrlArray removeObjectAtIndex:0];
|
||||||
[mUrlComboBox removeItemAtIndex:0];
|
[mUrlComboBox removeItemAtIndex:0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// move the url to the bottom of the list
|
// move the url to the bottom of the list
|
||||||
[mUrlArray removeObject:urlString];
|
[mUrlArray removeObject:urlString];
|
||||||
[mUrlArray addObject:urlString];
|
[mUrlArray addObject:urlString];
|
||||||
[mUrlComboBox removeItemWithObjectValue:urlString];
|
[mUrlComboBox removeItemWithObjectValue:urlString];
|
||||||
[mUrlComboBox addItemWithObjectValue:urlString];
|
[mUrlComboBox addItemWithObjectValue:urlString];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mIsSheet)
|
if (mIsSheet)
|
||||||
NSRunAlertPanel(@"Invalid URL", @"The URL is not valid.", nil, nil, nil);
|
NSRunAlertPanel(@"Invalid URL", @"The URL is not valid.", nil, nil, nil);
|
||||||
else
|
else
|
||||||
NSBeginAlertSheet(@"Invalid URL", nil, nil, nil, mPanel, nil, nil, nil, nil, @"The URL is not valid.");
|
NSBeginAlertSheet(@"Invalid URL", nil, nil, nil, mPanel, nil, nil, nil, nil, @"The URL is not valid.");
|
||||||
|
|
||||||
informDelegate = NO;
|
informDelegate = NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// inform the delegate
|
// inform the delegate
|
||||||
if (informDelegate && mDelegate && mDidEndSelector)
|
if (informDelegate && mDelegate && mDidEndSelector)
|
||||||
{
|
{
|
||||||
callback = [mDelegate methodForSelector:mDidEndSelector];
|
callback = [mDelegate methodForSelector:mDidEndSelector];
|
||||||
callback(mDelegate, mDidEndSelector, self, [sender tag], mContextInfo);
|
callback(mDelegate, mDidEndSelector, self, [sender tag], mContextInfo);
|
||||||
|
|
||||||
[self close];
|
[self close];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
- (void)beginSheetWithWindow:(NSWindow *)window delegate:(id)delegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo
|
- (void)beginSheetWithWindow:(NSWindow *)window delegate:(id)delegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo
|
||||||
{
|
{
|
||||||
// will this run as a sheet
|
// will this run as a sheet
|
||||||
mIsSheet = (window ? YES : NO);
|
mIsSheet = (window ? YES : NO);
|
||||||
|
|
||||||
// save the delegate, did end selector, and context info
|
// save the delegate, did end selector, and context info
|
||||||
mDelegate = delegate;
|
mDelegate = delegate;
|
||||||
mDidEndSelector = (didEndSelector);
|
mDidEndSelector = (didEndSelector);
|
||||||
mContextInfo = contextInfo;
|
mContextInfo = contextInfo;
|
||||||
|
|
||||||
// load the bundle (if necessary)
|
// load the bundle (if necessary)
|
||||||
if (mPanel == nil)
|
if (mPanel == nil)
|
||||||
[NSBundle loadNibNamed:@"OpenURLPanel" owner:self];
|
[NSBundle loadNibNamed:@"OpenURLPanel" owner:self];
|
||||||
|
|
||||||
// start the sheet (or window)
|
// start the sheet (or window)
|
||||||
[NSApp beginSheet:mPanel modalForWindow:window modalDelegate:nil didEndSelector:nil contextInfo:nil];
|
[NSApp beginSheet:mPanel modalForWindow:window modalDelegate:nil didEndSelector:nil contextInfo:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)close
|
- (void)close
|
||||||
{
|
{
|
||||||
// close it down
|
// close it down
|
||||||
[NSApp endSheet:mPanel];
|
[NSApp endSheet:mPanel];
|
||||||
[mPanel close];
|
[mPanel close];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue