Reworked contextual menu, added more menu validation items
parent
588fa5ddc6
commit
386078fdc5
File diff suppressed because it is too large
Load Diff
|
@ -660,6 +660,9 @@
|
|||
|
||||
[queueList addObject:queueItem];
|
||||
}
|
||||
|
||||
for (PlaylistEntry *ap in queueList)
|
||||
NSLog(@"hehe now: %d", ap.queuePosition);
|
||||
}
|
||||
|
||||
- (IBAction)removeFromQueue:(id)sender
|
||||
|
@ -697,6 +700,23 @@
|
|||
if (action == @selector(emptyQueueList:) && ([queueList count] < 1))
|
||||
return NO;
|
||||
|
||||
// if nothing is selected, gray out these
|
||||
if ([[self selectedObjects] count] < 1)
|
||||
{
|
||||
|
||||
if (action == @selector(remove:))
|
||||
return NO;
|
||||
|
||||
if (action == @selector(addToQueue:))
|
||||
return NO;
|
||||
|
||||
if (action == @selector(searchByArtist:))
|
||||
return NO;
|
||||
|
||||
if (action == @selector(searchByAlbum:))
|
||||
return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@
|
|||
action:@selector(searchByAlbum:)
|
||||
keyEquivalent:@""];
|
||||
albumMenuItem.target = playlistController;
|
||||
[tableViewMenu insertItem:albumMenuItem atIndex:0];
|
||||
[tableViewMenu insertItem:albumMenuItem atIndex:[tableViewMenu numberOfItems]];
|
||||
[albumMenuItem release];
|
||||
addedItems++;
|
||||
}
|
||||
|
@ -193,22 +193,12 @@
|
|||
action:@selector(searchByArtist:)
|
||||
keyEquivalent:@""];
|
||||
artistMenuItem.target = playlistController;
|
||||
[tableViewMenu insertItem:artistMenuItem atIndex:0];
|
||||
[tableViewMenu insertItem:artistMenuItem atIndex:[tableViewMenu numberOfItems]];
|
||||
[artistMenuItem release];
|
||||
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 (song.queuePosition > 0)
|
||||
{
|
||||
NSMenuItem *queueRemoveMenuItem = [NSMenuItem alloc];
|
||||
|
@ -220,13 +210,12 @@
|
|||
queueRemoveMenuItem.target = playlistController;
|
||||
[tableViewMenu insertItem:queueRemoveMenuItem atIndex:1];
|
||||
[queueRemoveMenuItem release];
|
||||
addedItems++;
|
||||
}
|
||||
|
||||
if(addedItems)
|
||||
{
|
||||
// add a separator in the right place
|
||||
[tableViewMenu insertItem:[NSMenuItem separatorItem] atIndex:addedItems];
|
||||
// add a separator in the right place - turned into a hack now
|
||||
[tableViewMenu insertItem:[NSMenuItem separatorItem] atIndex:[tableViewMenu numberOfItems]-2];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue