Fixed up menu items.

Added OpenURL panel.
CQTexperiment
vspader 2007-05-26 14:43:31 +00:00
parent 20dd4930ee
commit c28e8d058d
13 changed files with 525 additions and 128 deletions

View File

@ -22,9 +22,6 @@
IBOutlet NSPanel *mainWindow;
IBOutlet NSPanel *addURLPanel;
IBOutlet NSComboBox *urlComboBox;
IBOutlet NSButton *playButton;
IBOutlet NSButton *prevButton;
IBOutlet NSButton *nextButton;
@ -58,17 +55,11 @@
BOOL remoteButtonHeld; /* true as long as the user holds the left,right,plus or minus on the remote control */
}
- (IBAction)addURL:(id)sender;
- (IBAction)addURLSheetOK:(id)sender;
- (IBAction)addURLSheetCancel:(id)sender;
- (IBAction)openURL:(id)sender;
- (IBAction)openFiles:(id)sender;
- (IBAction)delEntries:(id)sender;
- (IBAction)savePlaylist:(id)sender;
- (IBAction)savePlaylistAs:(id)sender;
- (IBAction)loadPlaylist:(id)sender;
- (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo;
- (IBAction)donate:(id)sender;

View File

@ -8,6 +8,7 @@
#import "NDHotKeyEvent.h"
#import "AppleRemote.h"
#import "PlaylistLoader.h"
#import "OpenURLPanel.h"
@implementation AppController
@ -133,13 +134,6 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
[p setAllowsMultipleSelection:YES];
[p beginSheetForDirectory:nil file:nil types:[playlistLoader acceptableFileTypes] modalForWindow:mainWindow modalDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
// [p beginForDirectory:nil file:nil types:[playlistController acceptableFileTypes] modelessDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:nil];
/* if ([p runModalForTypes:[playlistController acceptableFileTypes]] == NSOKButton)
{
[playlistController addPaths:[p filenames] sort:YES];
}
*/
}
- (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo
@ -148,32 +142,42 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
{
[playlistLoader addURLs:[panel URLs] sort:YES];
}
// [panel release];
}
- (IBAction)addURL:(id)sender
- (IBAction)savePlaylist:(id)sender
{
[NSApp beginSheet:addURLPanel modalForWindow:mainWindow modalDelegate:self didEndSelector:nil contextInfo:nil];
}
- (IBAction)addURLSheetOK:(id)sender
{
NSURL *url = [NSURL URLWithString:[urlComboBox stringValue]];
NSSavePanel *p;
[playlistLoader addURLs:[NSArray arrayWithObject:url] sort:NO];
p = [NSSavePanel savePanel];
[NSApp endSheet:addURLPanel];
[addURLPanel orderOut:self];
[p setAllowedFileTypes:[playlistLoader acceptablePlaylistTypes]];
[p beginSheetForDirectory:nil file:nil modalForWindow:mainWindow modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
}
- (IBAction)addURLSheetCancel:(id)sender
- (void)savePanelDidEnd:(NSSavePanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
NSLog(@"GONE!");
[NSApp endSheet:addURLPanel];
[addURLPanel orderOut:self];
if (returnCode == NSOKButton)
{
[playlistLoader save:[panel filename]];
}
}
- (IBAction)openURL:(id)sender
{
OpenURLPanel *p;
p = [OpenURLPanel openURLPanel];
[p beginSheetWithWindow:mainWindow delegate:self didEndSelector:@selector(openURLPanelDidEnd:returnCode:contextInfo:) contextInfo:nil];
}
- (void)openURLPanelDidEnd:(OpenURLPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
if (returnCode == NSOKButton)
{
[playlistLoader addURLs:[NSArray arrayWithObject:[panel url]] sort:NO];
}
}
- (IBAction)delEntries:(id)sender
{
@ -187,7 +191,6 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
- (BOOL)application:(NSApplication *)sender delegateHandlesKey:(NSString *)key
{
// DBLog(@"W00t");
return [key isEqualToString:@"currentEntry"];
}
@ -263,41 +266,6 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
}
- (IBAction)savePlaylist:(id)sender
{
[playlistLoader save];
}
- (IBAction)savePlaylistAs:(id)sender
{
NSSavePanel *p;
p = [NSSavePanel savePanel];
[p setAllowedFileTypes:[playlistLoader acceptablePlaylistTypes]];
if ([p runModalForDirectory:nil file:[[playlistLoader currentFile] lastPathComponent]] == NSOKButton)
{
[playlistLoader save:[p filename]];
}
}
- (IBAction)loadPlaylist:(id)sender
{
NSOpenPanel *p;
p = [NSOpenPanel openPanel];
[p setCanChooseDirectories:NO];
[p setAllowsMultipleSelection:NO];
if ([p runModalForTypes:[playlistLoader acceptablePlaylistTypes]] == NSOKButton)
{
[playlistLoader load:[p filename]];
}
[mainWindow makeKeyAndOrderFront:self];
}
- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
{
// if (flag == NO)

View File

@ -62,6 +62,9 @@
177FD1090B90CB5F0011C3B5 /* MAD.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 177FD01B0B90CAC60011C3B5 /* MAD.bundle */; };
177FD10A0B90CB5F0011C3B5 /* Flac.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 177FD0170B90CABF0011C3B5 /* Flac.bundle */; };
177FD10B0B90CB5F0011C3B5 /* CoreAudio.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 177FD0130B90CAB50011C3B5 /* CoreAudio.bundle */; };
179790E00C087AB7001D6996 /* OpenURLPanel.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 179790DE0C087AB7001D6996 /* OpenURLPanel.h */; };
179790E10C087AB7001D6996 /* OpenURLPanel.m in Sources */ = {isa = PBXBuildFile; fileRef = 179790DF0C087AB7001D6996 /* OpenURLPanel.m */; };
179790F20C087B46001D6996 /* OpenURLPanel.nib in Resources */ = {isa = PBXBuildFile; fileRef = 179790F00C087B46001D6996 /* OpenURLPanel.nib */; };
17ADB4580B979C7C00257CA2 /* FileSource.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17ADB4450B979C5700257CA2 /* FileSource.bundle */; };
17ADB6650B97A97100257CA2 /* HTTPSource.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 17ADB65C0B97A96400257CA2 /* HTTPSource.bundle */; };
17BB5CED0B8A86010009ACB1 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17BB5CEC0B8A86010009ACB1 /* AudioToolbox.framework */; };
@ -91,13 +94,9 @@
8E75757409F31D5A0080F1EE /* PlaylistView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E75753209F31D5A0080F1EE /* PlaylistView.m */; };
8E75757509F31D5A0080F1EE /* Shuffle.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E75753409F31D5A0080F1EE /* Shuffle.m */; };
8E7575BE09F31D800080F1EE /* wheel.icns in Resources */ = {isa = PBXBuildFile; fileRef = 8E7575A609F31D800080F1EE /* wheel.icns */; };
8E7575CB09F31DCA0080F1EE /* Changelog in Resources */ = {isa = PBXBuildFile; fileRef = 8E7575C309F31DCA0080F1EE /* Changelog */; };
8E7575CC09F31DCA0080F1EE /* Cog.scriptSuite in Resources */ = {isa = PBXBuildFile; fileRef = 8E7575C409F31DCA0080F1EE /* Cog.scriptSuite */; };
8E7575CD09F31DCA0080F1EE /* Cog.scriptTerminology in Resources */ = {isa = PBXBuildFile; fileRef = 8E7575C509F31DCA0080F1EE /* Cog.scriptTerminology */; };
8E7575CE09F31DCA0080F1EE /* COMPILE in Resources */ = {isa = PBXBuildFile; fileRef = 8E7575C609F31DCA0080F1EE /* COMPILE */; };
8E7575CF09F31DCA0080F1EE /* COPYING in Resources */ = {isa = PBXBuildFile; fileRef = 8E7575C709F31DCA0080F1EE /* COPYING */; };
8E7575D009F31DCA0080F1EE /* Credits.html in Resources */ = {isa = PBXBuildFile; fileRef = 8E7575C809F31DCA0080F1EE /* Credits.html */; };
8E7575D109F31DCA0080F1EE /* README in Resources */ = {isa = PBXBuildFile; fileRef = 8E7575C909F31DCA0080F1EE /* README */; };
8E7575DB09F31E930080F1EE /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8E7575D909F31E930080F1EE /* Localizable.strings */; };
8E9A2E860BA78B500091081B /* SecondsFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E9A2E840BA78B500091081B /* SecondsFormatter.m */; };
8E9A2EDA0BA78D9D0091081B /* IndexFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E9A2ED80BA78D9D0091081B /* IndexFormatter.m */; };
@ -142,6 +141,7 @@
17E94E560C03B09A00D92B9B /* CogAudio.framework in CopyFiles */,
170680840B950164006BA573 /* Growl.framework in CopyFiles */,
17F94CCD0B8D090800A34E87 /* Sparkle.framework in CopyFiles */,
179790E00C087AB7001D6996 /* OpenURLPanel.h in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -228,6 +228,9 @@
177FD0270B90CADE0011C3B5 /* Shorten.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = Shorten.bundle; path = Plugins/Shorten/build/Release/Shorten.bundle; sourceTree = "<group>"; };
177FD02B0B90CAE50011C3B5 /* TagLib.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = TagLib.bundle; path = Plugins/TagLib/build/Release/TagLib.bundle; sourceTree = "<group>"; };
177FD02F0B90CAEC0011C3B5 /* Vorbis.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = Vorbis.bundle; path = Plugins/Vorbis/build/Release/Vorbis.bundle; sourceTree = "<group>"; };
179790DE0C087AB7001D6996 /* OpenURLPanel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = OpenURLPanel.h; sourceTree = "<group>"; };
179790DF0C087AB7001D6996 /* OpenURLPanel.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = OpenURLPanel.m; sourceTree = "<group>"; };
179790F10C087B46001D6996 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/OpenURLPanel.nib; sourceTree = "<group>"; };
17ADB4450B979C5700257CA2 /* FileSource.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = FileSource.bundle; path = Plugins/FileSource/build/Release/FileSource.bundle; sourceTree = "<group>"; };
17ADB65C0B97A96400257CA2 /* HTTPSource.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = HTTPSource.bundle; path = Plugins/HTTPSource/build/Release/HTTPSource.bundle; sourceTree = "<group>"; };
17BB5CEC0B8A86010009ACB1 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = "<absolute>"; };
@ -268,13 +271,9 @@
8E75753309F31D5A0080F1EE /* Shuffle.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Shuffle.h; sourceTree = "<group>"; };
8E75753409F31D5A0080F1EE /* Shuffle.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = Shuffle.m; sourceTree = "<group>"; };
8E7575A609F31D800080F1EE /* wheel.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = wheel.icns; sourceTree = "<group>"; };
8E7575C309F31DCA0080F1EE /* Changelog */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = Changelog; sourceTree = "<group>"; };
8E7575C409F31DCA0080F1EE /* Cog.scriptSuite */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Cog.scriptSuite; sourceTree = "<group>"; };
8E7575C509F31DCA0080F1EE /* Cog.scriptTerminology */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.xml; path = Cog.scriptTerminology; sourceTree = "<group>"; };
8E7575C609F31DCA0080F1EE /* COMPILE */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = COMPILE; sourceTree = "<group>"; };
8E7575C709F31DCA0080F1EE /* COPYING */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = COPYING; sourceTree = "<group>"; };
8E7575C809F31DCA0080F1EE /* Credits.html */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.html; path = Credits.html; sourceTree = "<group>"; };
8E7575C909F31DCA0080F1EE /* README */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
8E7575DA09F31E930080F1EE /* English */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; };
8E7575DC09F31EAF0080F1EE /* French */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = French; path = French.lproj/Localizable.strings; sourceTree = "<group>"; };
8E9A2E830BA78B500091081B /* SecondsFormatter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SecondsFormatter.h; sourceTree = "<group>"; };
@ -392,6 +391,7 @@
177EBF7D0B8BC2A70000BC8C /* AppleRemote */,
177EBF850B8BC2A70000BC8C /* ImageTextCell */,
177EBF880B8BC2A70000BC8C /* KFTypeSelectTableView */,
179790DD0C087AB7001D6996 /* OpenURLPanel */,
177EBF8B0B8BC2A70000BC8C /* NDHotKeys */,
177EBF900B8BC2A70000BC8C /* UKKQueue */,
);
@ -511,6 +511,15 @@
name = Images;
sourceTree = "<group>";
};
179790DD0C087AB7001D6996 /* OpenURLPanel */ = {
isa = PBXGroup;
children = (
179790DE0C087AB7001D6996 /* OpenURLPanel.h */,
179790DF0C087AB7001D6996 /* OpenURLPanel.m */,
);
path = OpenURLPanel;
sourceTree = "<group>";
};
17B619FF0B909ED400BC003F /* PlugIns */ = {
isa = PBXGroup;
children = (
@ -569,14 +578,11 @@
8D1107310486CEB800E47090 /* Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
8E7575D909F31E930080F1EE /* Localizable.strings */,
179790F00C087B46001D6996 /* OpenURLPanel.nib */,
29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
8E7575C309F31DCA0080F1EE /* Changelog */,
8E7575C409F31DCA0080F1EE /* Cog.scriptSuite */,
8E7575C509F31DCA0080F1EE /* Cog.scriptTerminology */,
8E7575C609F31DCA0080F1EE /* COMPILE */,
8E7575C709F31DCA0080F1EE /* COPYING */,
8E7575C809F31DCA0080F1EE /* Credits.html */,
8E7575C909F31DCA0080F1EE /* README */,
);
name = Resources;
sourceTree = "<group>";
@ -726,13 +732,9 @@
8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
8E7575BE09F31D800080F1EE /* wheel.icns in Resources */,
8E7575CB09F31DCA0080F1EE /* Changelog in Resources */,
8E7575CC09F31DCA0080F1EE /* Cog.scriptSuite in Resources */,
8E7575CD09F31DCA0080F1EE /* Cog.scriptTerminology in Resources */,
8E7575CE09F31DCA0080F1EE /* COMPILE in Resources */,
8E7575CF09F31DCA0080F1EE /* COPYING in Resources */,
8E7575D009F31DCA0080F1EE /* Credits.html in Resources */,
8E7575D109F31DCA0080F1EE /* README in Resources */,
8E7575DB09F31E930080F1EE /* Localizable.strings in Resources */,
177EC0440B8BC2FF0000BC8C /* add_blue.png in Resources */,
177EC0450B8BC2FF0000BC8C /* add_gray.png in Resources */,
@ -757,6 +759,7 @@
1766C8970B912FB4004A7AE4 /* repeat_on.png in Resources */,
1766C8980B912FB4004A7AE4 /* shuffle_off.png in Resources */,
1766C8990B912FB4004A7AE4 /* shuffle_on.png in Resources */,
179790F20C087B46001D6996 /* OpenURLPanel.nib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -811,6 +814,7 @@
8E9A2E860BA78B500091081B /* SecondsFormatter.m in Sources */,
8E9A2EDA0BA78D9D0091081B /* IndexFormatter.m in Sources */,
8E9A30160BA792DC0091081B /* NSFileHandle+CreateFile.m in Sources */,
179790E10C087AB7001D6996 /* OpenURLPanel.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -825,6 +829,14 @@
name = InfoPlist.strings;
sourceTree = "<group>";
};
179790F00C087B46001D6996 /* OpenURLPanel.nib */ = {
isa = PBXVariantGroup;
children = (
179790F10C087B46001D6996 /* English */,
);
name = OpenURLPanel.nib;
sourceTree = "<group>";
};
29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = {
isa = PBXVariantGroup;
children = (

View File

@ -14,15 +14,11 @@
},
{
ACTIONS = {
addURL = id;
addURLSheetCancel = id;
addURLSheetOK = id;
delEntries = id;
donate = id;
loadPlaylist = id;
openFiles = id;
openURL = id;
savePlaylist = id;
savePlaylistAs = id;
toggleFileDrawer = id;
toggleInfoDrawer = id;
};

View File

@ -34,12 +34,11 @@
<integer>4</integer>
<key>IBOpenObjects</key>
<array>
<integer>1307</integer>
<integer>1324</integer>
<integer>29</integer>
<integer>1156</integer>
<integer>513</integer>
<integer>21</integer>
<integer>1156</integer>
<integer>463</integer>
<integer>1063</integer>
</array>

Binary file not shown.

107
English.lproj/OpenURLPanel.nib/classes.nib generated Normal file
View File

@ -0,0 +1,107 @@
{
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{
ACTIONS = {
doArchive = id;
doClone = id;
doEditable = id;
doEnableQTMovieNotifications = id;
doExport = id;
doFlatten = id;
doLayer = id;
doLoop = id;
doLoopPalindrome = id;
doNewMovieFromSelection = id;
doPlayAllFrames = id;
doPlaySelectionOnly = id;
doPreserveAspectRatio = id;
doRate = id;
doSetBounds = id;
doSetFillColour = id;
doSetFillColourPanel = id;
doSetPosterTime = id;
doSetStartTime = id;
doSetTime = id;
doShowController = id;
doShowMovieInspector = id;
doShowTrackInspector = id;
doVolume = id;
updateCurrentTime = id;
};
CLASS = MovieDocument;
LANGUAGE = ObjC;
OUTLETS = {
"_exportAccessoryView" = NSView;
"_exportTypePopUpButton" = NSPopUpButton;
"_movieCanStepButton" = NSButton;
"_movieCopyrightTextField" = NSTextField;
"_movieCurrentTimeTextField" = NSTextField;
"_movieDataRefTypeTextField" = NSTextField;
"_movieDataSizeTextField" = NSTextField;
"_movieDisplayNameTextField" = NSTextField;
"_movieDurationTextField" = NSTextField;
"_movieHasAudioButton" = NSButton;
"_movieHasDurationButton" = NSButton;
"_movieHasSkinButton" = NSButton;
"_movieHasVideoButton" = NSButton;
"_movieInspectorPanel" = NSPanel;
"_movieIsEditableButton" = NSButton;
"_movieIsInteractiveButton" = NSButton;
"_movieIsLinearButton" = NSButton;
"_movieMuteButton" = NSButton;
"_movieNaturalSizeTextField" = NSTextField;
"_movieNotificationsTextView" = NSTextView;
"_moviePosterTimeTextField" = NSTextField;
"_moviePreferredMuteButton" = NSButton;
"_moviePreferredRateSlider" = NSSlider;
"_moviePreferredVolumeSlider" = NSSlider;
"_movieRateSlider" = NSSlider;
"_movieSetTimeTextField" = NSTextField;
"_movieURLTextField" = NSTextField;
"_movieView" = QTMovieView;
"_movieVolumeSlider" = NSSlider;
"_movieWindow" = NSWindow;
"_trackBoundsOriginTextField" = NSTextField;
"_trackBoundsSizeTextField" = NSTextField;
"_trackCanSendVideoButton" = NSButton;
"_trackCanStepButton" = NSButton;
"_trackDurationTextField" = NSTextField;
"_trackHasAudioButton" = NSButton;
"_trackHasDurationButton" = NSButton;
"_trackHasSkinButton" = NSButton;
"_trackHasVideoButton" = NSButton;
"_trackHasVideoFrameRateButton" = NSButton;
"_trackInspectorPanel" = NSPanel;
"_trackIsLinearButton" = NSButton;
"_trackLayerStepper" = NSStepper;
"_trackLayerTextField" = NSTextField;
"_trackMediaDataReferenceTableView" = NSTableView;
"_trackProvidesActionsButton" = NSButton;
"_trackProvidesKeyFocusButton" = NSButton;
"_trackSetBoundsButton" = NSButton;
"_trackSetBoundsTextField" = NSTextField;
"_trackSetStartTimeTextField" = NSTextField;
"_trackStartTimeTextField" = NSTextField;
"_trackTableView" = NSTableView;
"_trackVolumeSlider" = NSSlider;
};
SUPERCLASS = NSDocument;
},
{CLASS = NSTextField; LANGUAGE = ObjC; SUPERCLASS = NSControl; },
{
ACTIONS = {doOpenURL = id; };
CLASS = OpenURLPanel;
LANGUAGE = ObjC;
OUTLETS = {mPanel = NSPanel; mUrlComboBox = NSComboBox; };
SUPERCLASS = NSObject;
},
{
ACTIONS = {doOpenURL = id; };
CLASS = QTKitPlayerAppDelegate;
LANGUAGE = ObjC;
SUPERCLASS = NSObject;
}
);
IBVersion = 1;
}

16
English.lproj/OpenURLPanel.nib/info.nib generated Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBDocumentLocation</key>
<string>143 34 356 240 0 0 1680 1028 </string>
<key>IBFramework Version</key>
<string>446.1</string>
<key>IBOpenObjects</key>
<array>
<integer>5</integer>
</array>
<key>IBSystem Version</key>
<string>8P2137</string>
</dict>
</plist>

Binary file not shown.

View File

@ -17,9 +17,6 @@ typedef enum {
@interface PlaylistLoader : NSObject {
IBOutlet PlaylistController *playlistController;
PlaylistType currentType; //m3u or pls
NSString *currentFile;
}
//load arrays of urls...

View File

@ -34,11 +34,6 @@
}
}
- (BOOL)save
{
return [self save:currentFile asType:currentType];
}
- (BOOL)save:(NSString *)filename
{
NSString *ext = [filename pathExtension];
@ -161,9 +156,6 @@
[fileHandle closeFile];
[self setCurrentFile:filename];
[self setCurrentType:kPlaylistM3u];
return YES;
}
@ -230,9 +222,6 @@
[fileHandle writeData:[@"\nVERSION=2" dataUsingEncoding:NSUTF8StringEncoding]];
[fileHandle closeFile];
[self setCurrentFile:filename];
[self setCurrentType:kPlaylistM3u];
return YES;
}
@ -395,26 +384,4 @@
return [NSArray arrayWithObjects:@"m3u",@"pls",nil];
}
- (PlaylistType)currentType
{
return currentType;
}
- (void)setCurrentType:(PlaylistType)type
{
currentType = type;
}
- (NSString *)currentFile
{
return currentFile;
}
- (void)setCurrentFile:(NSString *)file
{
[file retain];
[currentFile release];
currentFile = file;
}
@end

94
ThirdParty/OpenURLPanel/OpenURLPanel.h vendored Executable file
View File

@ -0,0 +1,94 @@
/*
File: OpenURLPanel.h
Originally introduced at WWDC 2004 at
Session 214, "Programming QuickTime with Cocoa."
Sample code is explained in detail in
"QTKit Programming Guide" documentation.
Copyright: © Copyright 2004, 2005 Apple Computer, Inc.
All rights reserved.
Disclaimer: IMPORTANT: This Apple software is supplied to you by
Apple Computer, Inc. ("Apple") in consideration of your agreement to the
following terms, and your use, installation, modification or
redistribution of this Apple software constitutes acceptance of these
terms. If you do not agree with these terms, please do not use,
install, modify or redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under AppleÕs copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Computer,
Inc. may be used to endorse or promote products derived from the Apple
Software without specific prior written permission from Apple. Except
as expressly stated in this notice, no other rights or licenses, express
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
other works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import <Cocoa/Cocoa.h>
#import <QTKit/QTKit.h>
@interface OpenURLPanel : NSObject
{
// panel
IBOutlet NSPanel *mPanel;
IBOutlet NSComboBox *mUrlComboBox;
// open url panel
id mDelegate;
SEL mDidEndSelector;
void *mContextInfo;
NSMutableArray *mUrlArray;
BOOL mIsSheet;
}
// class methods
+ (id)openURLPanel;
// getters
- (NSString *)urlString;
- (NSURL *)url;
// setters
- (void)setURLArray:(NSMutableArray *)urlArray;
// delegates
- (void)awakeFromNib;
// notifications
- (void)writeURLs:(NSNotification *)notification;
// actions
- (IBAction)doOpenURL:(id)sender;
// methods
- (void)beginSheetWithWindow:(NSWindow *)window delegate:(id)delegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo;
- (void)close;
@end

250
ThirdParty/OpenURLPanel/OpenURLPanel.m vendored Executable file
View File

@ -0,0 +1,250 @@
/*
File: OpenURLPanel.m
Originally introduced at WWDC 2004 at
Session 214, "Programming QuickTime with Cocoa."
Sample code is explained in detail in
"QTKit Programming Guide" documentation.
Copyright: © Copyright 2004, 2005 Apple Computer, Inc.
All rights reserved.
Disclaimer: IMPORTANT: This Apple software is supplied to you by
Apple Computer, Inc. ("Apple") in consideration of your agreement to the
following terms, and your use, installation, modification or
redistribution of this Apple software constitutes acceptance of these
terms. If you do not agree with these terms, please do not use,
install, modify or redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under AppleÕs copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Computer,
Inc. may be used to endorse or promote products derived from the Apple
Software without specific prior written permission from Apple. Except
as expressly stated in this notice, no other rights or licenses, express
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
other works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import "OpenURLPanel.h"
// user defaults keys
#define kUserDefaultURLsKey @"UserDefaultURLsKey"
// maximum urls
#define kMaximumURLs 15
@implementation OpenURLPanel
static OpenURLPanel *openURLPanel = nil;
// class methods
+ (id)openURLPanel
{
if (openURLPanel == nil)
openURLPanel = [[self alloc] init];
return openURLPanel;
}
- (id)init
{
[super init];
// init
[self setURLArray:[NSMutableArray arrayWithCapacity:10]];
// listen for app termination notifications
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(writeURLs:) name:NSApplicationWillTerminateNotification object:NSApp];
return self;
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[self setURLArray:nil];
[super dealloc];
}
// getters
- (NSString *)urlString
{
NSString *urlString = nil;
// get the url
urlString = [mUrlComboBox stringValue];
if (urlString == nil)
urlString = [mUrlComboBox objectValueOfSelectedItem];
if ([urlString length] == 0)
urlString = nil;
return urlString;
}
- (NSURL *)url
{
NSURL *url = nil;
NSString *urlString;
// get the url
urlString = [self urlString];
if (urlString)
url = [NSURL URLWithString:urlString];
return url;
}
// setters
- (void)setURLArray:(NSMutableArray *)urlLArray
{
[urlLArray retain];
[mUrlArray retain];
mUrlArray = urlLArray;
}
// delegates
- (void)awakeFromNib
{
NSArray *urls;
// restore the previous urls
urls = [[NSUserDefaults standardUserDefaults] objectForKey:kUserDefaultURLsKey];
[mUrlArray addObjectsFromArray:urls];
if (urls)
[mUrlComboBox addItemsWithObjectValues:urls];
}
// notifications
- (void)writeURLs:(NSNotification *)notification
{
NSUserDefaults *userDefaults;
if ([mUrlArray count])
{
// init
userDefaults = [NSUserDefaults standardUserDefaults];
// write out the urls
[userDefaults setObject:mUrlArray forKey:kUserDefaultURLsKey];
[userDefaults synchronize];
}
}
// actions
- (IBAction)doOpenURL:(id)sender
{
NSString *urlString;
NSURL *url;
BOOL informDelegate = YES;
IMP callback;
if ([sender tag] == NSOKButton)
{
// validate the URL
url = [self url];
urlString = [self urlString];
if (url)
{
// save the url
if (![mUrlArray containsObject:urlString])
{
// save the url
[mUrlArray addObject:urlString];
// add the url to the combo box
[mUrlComboBox addItemWithObjectValue:urlString];
// remove the oldest url if the maximum has been exceeded
if ([mUrlArray count] > kMaximumURLs)
{
[mUrlArray removeObjectAtIndex:0];
[mUrlComboBox removeItemAtIndex:0];
}
}
else
{
// move the url to the bottom of the list
[mUrlArray removeObject:urlString];
[mUrlArray addObject:urlString];
[mUrlComboBox removeItemWithObjectValue:urlString];
[mUrlComboBox addItemWithObjectValue:urlString];
}
}
else
{
if (mIsSheet)
NSRunAlertPanel(@"Invalid URL", @"The URL is not valid.", nil, nil, nil);
else
NSBeginAlertSheet(@"Invalid URL", nil, nil, nil, mPanel, nil, nil, nil, nil, @"The URL is not valid.");
informDelegate = NO;
}
}
// inform the delegate
if (informDelegate && mDelegate && mDidEndSelector)
{
callback = [mDelegate methodForSelector:mDidEndSelector];
callback(mDelegate, mDidEndSelector, self, [sender tag], mContextInfo);
[self close];
}
}
// methods
- (void)beginSheetWithWindow:(NSWindow *)window delegate:(id)delegate didEndSelector:(SEL)didEndSelector contextInfo:(void *)contextInfo
{
// will this run as a sheet
mIsSheet = (window ? YES : NO);
// save the delegate, did end selector, and context info
mDelegate = delegate;
mDidEndSelector = (didEndSelector);
mContextInfo = contextInfo;
// load the bundle (if necessary)
if (mPanel == nil)
[NSBundle loadNibNamed:@"OpenURLPanel" owner:self];
// start the sheet (or window)
[NSApp beginSheet:mPanel modalForWindow:window modalDelegate:nil didEndSelector:nil contextInfo:nil];
}
- (void)close
{
// close it down
[NSApp endSheet:mPanel];
[mPanel close];
}
@end