mamburu: Happy New Year commit (which accidentally fixes #83 - enqueueing from FileTree now respects playlist settings while FileTree context menu items still do what they say and don't depend on playlist settings). Also, the code should be cleaned up a bit, but i'm too sleepy to do it now.

CQTexperiment
Chris Moeller 2013-10-12 14:31:28 -07:00
parent 85937086d2
commit af76c33bb0
4 changed files with 37 additions and 16 deletions

View File

@ -17,6 +17,7 @@
} }
- (IBAction)addToPlaylist:(id)sender; - (IBAction)addToPlaylist:(id)sender;
- (IBAction)addToPlaylistExternal:(id)sender;
- (IBAction)setAsPlaylist:(id)sender; - (IBAction)setAsPlaylist:(id)sender;
- (IBAction)playPauseResume:(NSObject *)id; - (IBAction)playPauseResume:(NSObject *)id;
- (IBAction)showEntryInFinder:(id)sender; - (IBAction)showEntryInFinder:(id)sender;

View File

@ -13,6 +13,11 @@
@implementation FileTreeController @implementation FileTreeController
- (IBAction)addToPlaylist:(id)sender - (IBAction)addToPlaylist:(id)sender
{
[self doAddToPlaylist:sender origin:URLOriginInternal];
}
- (void)doAddToPlaylist:(id)sender origin:(URLOrigin)origin
{ {
NSUInteger index; NSUInteger index;
NSIndexSet *selectedIndexes = [outlineView selectedRowIndexes]; NSIndexSet *selectedIndexes = [outlineView selectedRowIndexes];
@ -24,10 +29,15 @@
[urls addObject:[[outlineView itemAtRow:index] URL]]; [urls addObject:[[outlineView itemAtRow:index] URL]];
} }
[controller addToPlaylist:urls]; [controller doAddToPlaylist:urls origin:origin];
[urls release]; [urls release];
} }
- (void)addToPlaylistExternal:(id)sender
{
[self doAddToPlaylist:sender origin:URLOriginExternal];
}
- (IBAction)setAsPlaylist:(id)sender - (IBAction)setAsPlaylist:(id)sender
{ {
[controller clear:sender]; [controller clear:sender];

View File

@ -15,7 +15,7 @@
- (void)awakeFromNib - (void)awakeFromNib
{ {
[self setDoubleAction:@selector(addToPlaylist:)]; [self setDoubleAction:@selector(addToPlaylistExternal:)];
[self setTarget:[self delegate]]; [self setTarget:[self delegate]];
} }
@ -31,7 +31,7 @@
if (modifiers == 0 && (c == NSEnterCharacter || c == NSCarriageReturnCharacter)) if (modifiers == 0 && (c == NSEnterCharacter || c == NSCarriageReturnCharacter))
{ {
[(FileTreeController *)[self delegate] addToPlaylist:self]; [(FileTreeController *)[self delegate] addToPlaylistExternal:self];
return; return;
} }

View File

@ -16,10 +16,20 @@
return [super initWithNibName:@"FileTree" bundle:[NSBundle mainBundle]]; return [super initWithNibName:@"FileTree" bundle:[NSBundle mainBundle]];
} }
- (void)addToPlaylist:(NSArray *)urls - (void)addToPlaylistInternal:(NSArray *)urls
{ {
[playlistLoader willInsertURLs:urls origin:URLOriginInternal]; [self doAddToPlaylist:urls origin:URLOriginInternal];
[playlistLoader didInsertURLs:[playlistLoader addURLs:urls sort:YES] origin:URLOriginInternal]; }
- (void)addToPlaylistExternal:(NSArray *)urls
{
[self doAddToPlaylist:urls origin:URLOriginExternal];
}
- (void)doAddToPlaylist:(NSArray *)urls origin:(URLOrigin)origin
{
[playlistLoader willInsertURLs:urls origin:origin];
[playlistLoader didInsertURLs:[playlistLoader addURLs:urls sort:YES] origin:origin];
} }
- (void)clear:(id)sender - (void)clear:(id)sender