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)addToPlaylistExternal:(id)sender;
- (IBAction)setAsPlaylist:(id)sender;
- (IBAction)playPauseResume:(NSObject *)id;
- (IBAction)showEntryInFinder:(id)sender;

View File

@ -14,18 +14,28 @@
- (IBAction)addToPlaylist:(id)sender
{
NSUInteger index;
NSIndexSet *selectedIndexes = [outlineView selectedRowIndexes];
NSMutableArray *urls = [[NSMutableArray alloc] init];
[self doAddToPlaylist:sender origin:URLOriginInternal];
}
for (index = [selectedIndexes firstIndex];
index != NSNotFound; index = [selectedIndexes indexGreaterThanIndex: index])
{
[urls addObject:[[outlineView itemAtRow:index] URL]];
}
[controller addToPlaylist:urls];
[urls release];
- (void)doAddToPlaylist:(id)sender origin:(URLOrigin)origin
{
NSUInteger index;
NSIndexSet *selectedIndexes = [outlineView selectedRowIndexes];
NSMutableArray *urls = [[NSMutableArray alloc] init];
for (index = [selectedIndexes firstIndex];
index != NSNotFound; index = [selectedIndexes indexGreaterThanIndex: index])
{
[urls addObject:[[outlineView itemAtRow:index] URL]];
}
[controller doAddToPlaylist:urls origin:origin];
[urls release];
}
- (void)addToPlaylistExternal:(id)sender
{
[self doAddToPlaylist:sender origin:URLOriginExternal];
}
- (IBAction)setAsPlaylist:(id)sender

View File

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

View File

@ -16,10 +16,20 @@
return [super initWithNibName:@"FileTree" bundle:[NSBundle mainBundle]];
}
- (void)addToPlaylist:(NSArray *)urls
- (void)addToPlaylistInternal:(NSArray *)urls
{
[playlistLoader willInsertURLs:urls origin:URLOriginInternal];
[playlistLoader didInsertURLs:[playlistLoader addURLs:urls sort:YES] origin:URLOriginInternal];
[self doAddToPlaylist:urls 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