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];
|
[queueList addObject:queueItem];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (PlaylistEntry *ap in queueList)
|
||||||
|
NSLog(@"hehe now: %d", ap.queuePosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)removeFromQueue:(id)sender
|
- (IBAction)removeFromQueue:(id)sender
|
||||||
|
@ -697,6 +700,23 @@
|
||||||
if (action == @selector(emptyQueueList:) && ([queueList count] < 1))
|
if (action == @selector(emptyQueueList:) && ([queueList count] < 1))
|
||||||
return NO;
|
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;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@
|
||||||
action:@selector(searchByAlbum:)
|
action:@selector(searchByAlbum:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
albumMenuItem.target = playlistController;
|
albumMenuItem.target = playlistController;
|
||||||
[tableViewMenu insertItem:albumMenuItem atIndex:0];
|
[tableViewMenu insertItem:albumMenuItem atIndex:[tableViewMenu numberOfItems]];
|
||||||
[albumMenuItem release];
|
[albumMenuItem release];
|
||||||
addedItems++;
|
addedItems++;
|
||||||
}
|
}
|
||||||
|
@ -193,22 +193,12 @@
|
||||||
action:@selector(searchByArtist:)
|
action:@selector(searchByArtist:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
artistMenuItem.target = playlistController;
|
artistMenuItem.target = playlistController;
|
||||||
[tableViewMenu insertItem:artistMenuItem atIndex:0];
|
[tableViewMenu insertItem:artistMenuItem atIndex:[tableViewMenu numberOfItems]];
|
||||||
[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 (song.queuePosition > 0)
|
if (song.queuePosition > 0)
|
||||||
{
|
{
|
||||||
NSMenuItem *queueRemoveMenuItem = [NSMenuItem alloc];
|
NSMenuItem *queueRemoveMenuItem = [NSMenuItem alloc];
|
||||||
|
@ -220,13 +210,12 @@
|
||||||
queueRemoveMenuItem.target = playlistController;
|
queueRemoveMenuItem.target = playlistController;
|
||||||
[tableViewMenu insertItem:queueRemoveMenuItem atIndex:1];
|
[tableViewMenu insertItem:queueRemoveMenuItem atIndex:1];
|
||||||
[queueRemoveMenuItem release];
|
[queueRemoveMenuItem release];
|
||||||
addedItems++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(addedItems)
|
if(addedItems)
|
||||||
{
|
{
|
||||||
// add a separator in the right place
|
// add a separator in the right place - turned into a hack now
|
||||||
[tableViewMenu insertItem:[NSMenuItem separatorItem] atIndex:addedItems];
|
[tableViewMenu insertItem:[NSMenuItem separatorItem] atIndex:[tableViewMenu numberOfItems]-2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue