Added Remove from Queue right click menu item, still lacks validation. Updated KnownIssues.

CQTexperiment
areff 2008-02-22 15:26:46 +00:00
parent 85b830f76b
commit e3216e0ef1
9 changed files with 2578 additions and 2435 deletions

File diff suppressed because it is too large Load Diff

View File

@ -14,4 +14,8 @@ Repeat Album isn't implemented.
Menu items do not transform into "Hide Spotlight Panel" and Menu items do not transform into "Hide Spotlight Panel" and
"Hide File Drawer" when they are active. "Hide File Drawer" when they are active.
I anticipate that status should be flag based so statuses are not mutually exclusive. I anticipate that status should be flag based so statuses are not mutually exclusive.
Right click menu item should gray out when not applicable.
Issues with queueing the same song multiple times

View File

@ -92,6 +92,7 @@ typedef enum {
// queue methods // queue methods
- (IBAction)addToQueue:(id)sender; - (IBAction)addToQueue:(id)sender;
- (IBAction)removeFromQueue:(id)sender;
- (IBAction)emptyQueueList:(id)sender; - (IBAction)emptyQueueList:(id)sender;
- (NSMutableArray *)queueList; - (NSMutableArray *)queueList;

View File

@ -399,7 +399,8 @@
for (i = 0; i < [queueList count]; i++) for (i = 0; i < [queueList count]; i++)
{ {
PlaylistEntry *queueItem = [queueList objectAtIndex:i]; PlaylistEntry *queueItem = [queueList objectAtIndex:i];
[queueItem setStatusMessage:[NSString stringWithFormat:@"Queued: %i", i+1]]; [queueItem setQueuePosition: i+1];
[queueItem setStatusMessage:[NSString stringWithFormat:@"Queued: %i", queueItem.queuePosition]];
} }
return pe; return pe;
@ -431,7 +432,7 @@
if ([pe album] == nil) if ([pe album] == nil)
i--; i--;
else else
i = [(PlaylistEntry *)[[filtered objectAtIndex:0] index] intValue]; i = [(NSNumber *)[[filtered objectAtIndex:0] index] intValue];
} }
} }
@ -649,6 +650,7 @@
{ {
[queueItem setStatus:[NSNumber numberWithInteger:kCogEntryNormal]]; [queueItem setStatus:[NSNumber numberWithInteger:kCogEntryNormal]];
[queueItem setStatusMessage:nil]; [queueItem setStatusMessage:nil];
[queueItem setQueuePosition:-1];
} }
[queueList removeAllObjects]; [queueList removeAllObjects];
@ -660,10 +662,27 @@
for (PlaylistEntry *queueItem in [self selectedObjects]) for (PlaylistEntry *queueItem in [self selectedObjects])
{ {
[queueItem setStatus: [NSNumber numberWithInteger:kCogEntryQueued]]; [queueItem setStatus: [NSNumber numberWithInteger:kCogEntryQueued]];
[queueItem setStatusMessage: [NSString stringWithFormat:@"Queued: %i", [queueList count] + 1]]; [queueItem setQueuePosition: [queueList count]+1];
[queueItem setStatusMessage: [NSString stringWithFormat:@"Queued: %i", queueItem.queuePosition]];
[queueList addObject:queueItem]; [queueList addObject:queueItem];
} }
} }
- (IBAction)removeFromQueue:(id)sender
{
for (PlaylistEntry *queueItem in [self selectedObjects])
{
// temporary hack until Remove from Queue menu item gets validation.
if (queueItem.queuePosition < 0)
break;
[queueItem setStatus:[NSNumber numberWithInteger:kCogEntryNormal]];
[queueItem setStatusMessage:nil];
[queueList removeObjectAtIndex:queueItem.queuePosition - 1];
}
}
@end @end

View File

@ -21,6 +21,7 @@ typedef enum {
NSNumber *shuffleIndex; NSNumber *shuffleIndex;
NSNumber *status; NSNumber *status;
NSString *statusMessage; NSString *statusMessage;
int queuePosition;
NSURL *URL; NSURL *URL;
@ -53,8 +54,8 @@ typedef enum {
@property(retain) NSNumber *index; @property(retain) NSNumber *index;
@property(retain) NSNumber *shuffleIndex; @property(retain) NSNumber *shuffleIndex;
@property(retain) NSNumber *status; @property(retain) NSNumber *status;
@property(retain) NSString *statusMessage;; @property(retain) NSString *statusMessage;
@property int queuePosition;
@property(retain) NSURL *URL; @property(retain) NSURL *URL;
@property(retain) NSString *artist; @property(retain) NSString *artist;

View File

@ -16,6 +16,7 @@
@synthesize shuffleIndex; @synthesize shuffleIndex;
@synthesize status; @synthesize status;
@synthesize statusMessage; @synthesize statusMessage;
@synthesize queuePosition;
@synthesize URL; @synthesize URL;

View File

@ -252,7 +252,7 @@
[pe setURL:url]; [pe setURL:url];
[pe setIndex:[NSNumber numberWithInt:(index+i)]]; [pe setIndex:[NSNumber numberWithInt:(index+i)]];
[pe setTitle:[[url path] lastPathComponent]]; [pe setTitle:[[url path] lastPathComponent]];
[pe setQueuePosition:-1];
[entries addObject:pe]; [entries addObject:pe];
[pe release]; [pe release];

View File

@ -20,7 +20,8 @@
- (IBAction)sortByPath:(id)sender; - (IBAction)sortByPath:(id)sender;
- (IBAction)shufflePlaylist:(id)sender; - (IBAction)shufflePlaylist:(id)sender;
- (BOOL)validateMenuItem:(NSMenuItem *)item;
- (IBAction)toggleColumn:(id)sender; - (IBAction)toggleColumn:(id)sender;
- (IBAction)scrollToCurrentEntry:(id)sender; - (IBAction)scrollToCurrentEntry:(id)sender;

View File

@ -216,6 +216,18 @@
[queueMenuItem release]; [queueMenuItem release];
addedItems++; addedItems++;
NSMenuItem *queueRemoveMenuItem = [NSMenuItem alloc];
NSString *retitle = [NSString
stringWithFormat:@"Remove from Queue"];
[queueRemoveMenuItem initWithTitle:retitle
action:@selector(removeFromQueue:)
keyEquivalent:@""];
queueRemoveMenuItem.target = playlistController;
[tableViewMenu insertItem:queueRemoveMenuItem atIndex:1];
[queueRemoveMenuItem release];
addedItems++;
if(addedItems) if(addedItems)
{ {
// add a separator in the right place // add a separator in the right place
@ -226,7 +238,6 @@
return [tableViewMenu autorelease]; return [tableViewMenu autorelease];
} }
- (void)keyDown:(NSEvent *)e - (void)keyDown:(NSEvent *)e
{ {
unsigned int modifiers = [e modifierFlags] & (NSCommandKeyMask | NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask); unsigned int modifiers = [e modifierFlags] & (NSCommandKeyMask | NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask);