Implemented Add to Queue as choice in Right click menu, added Clear Queue to Playlist menu.

CQTexperiment
areff 2008-02-21 07:30:28 +00:00
parent ea57907678
commit 8bff745c38
4 changed files with 2112 additions and 2036 deletions

File diff suppressed because it is too large Load Diff

View File

@ -30,6 +30,7 @@ typedef enum {
NSString *totalTimeDisplay; NSString *totalTimeDisplay;
NSMutableArray *shuffleList; NSMutableArray *shuffleList;
NSMutableArray *queueList;
PlaylistEntry *currentEntry; PlaylistEntry *currentEntry;
@ -88,4 +89,9 @@ typedef enum {
- (PlaylistEntry *)shuffledEntryAtIndex:(int)i; - (PlaylistEntry *)shuffledEntryAtIndex:(int)i;
- (PlaylistEntry *)entryAtIndex:(int)i; - (PlaylistEntry *)entryAtIndex:(int)i;
// queue methods
- (IBAction)addToQueue:(id)sender;
- (IBAction)emptyQueueList:(id)sender;
- (NSMutableArray *)queueList;
@end @end

View File

@ -47,6 +47,7 @@
if (self) if (self)
{ {
shuffleList = [[NSMutableArray alloc] init]; shuffleList = [[NSMutableArray alloc] init];
queueList = [[NSMutableArray alloc] init];
} }
return self; return self;
@ -55,6 +56,7 @@
- (void)dealloc - (void)dealloc
{ {
[shuffleList release]; [shuffleList release];
[queueList release];
[super dealloc]; [super dealloc];
} }
@ -373,6 +375,14 @@
return pe; return pe;
} }
if ([queueList count] > 0)
{
pe = [queueList objectAtIndex:0];
[queueList removeObjectAtIndex:0];
return pe;
}
if (shuffle == YES) if (shuffle == YES)
{ {
return [self shuffledEntryAtIndex:([[pe shuffleIndex] intValue] + 1)]; return [self shuffledEntryAtIndex:([[pe shuffleIndex] intValue] + 1)];
@ -559,6 +569,16 @@
[self updateIndexesFromRow:0]; [self updateIndexesFromRow:0];
} }
- (NSMutableArray *)queueList
{
return queueList;
}
- (IBAction)emptyQueueList:(id)sender
{
[queueList removeAllObjects];
}
- (IBAction)showEntryInFinder:(id)sender - (IBAction)showEntryInFinder:(id)sender
{ {
NSWorkspace* ws = [NSWorkspace sharedWorkspace]; NSWorkspace* ws = [NSWorkspace sharedWorkspace];
@ -581,4 +601,10 @@
[spotlightWindowController searchForAlbum:[entry album]]; [spotlightWindowController searchForAlbum:[entry album]];
} }
- (IBAction)addToQueue:(id)sender
{
for (PlaylistEntry *queueItem in [self selectedObjects])
[queueList addObject:queueItem];
}
@end @end

View File

@ -203,6 +203,17 @@
[artistMenuItem release]; [artistMenuItem release];
addedItems++; addedItems++;
} }
NSMenuItem *queueMenuItem = [NSMenuItem alloc];
NSString *title = [NSString
stringWithFormat:@"Add to Queue (%d queued)", [[playlistController queueList] count]];
[queueMenuItem initWithTitle:title
action:@selector(addToQueue:)
keyEquivalent:@""];
queueMenuItem.target = playlistController;
[tableViewMenu insertItem:queueMenuItem atIndex:0];
[queueMenuItem release];
addedItems++;
if(addedItems) if(addedItems)
{ {
// add a separator in the right place // add a separator in the right place