Moved stopAfterCurrent check to requestNextStream, so it won't interfere other than when the player is reaching the end of a track by natural means. Added menu item validation.

CQTexperiment
areff 2008-02-25 17:02:06 +00:00
parent 771a6de380
commit 89cd984b7d
2 changed files with 17 additions and 11 deletions

View File

@ -491,7 +491,12 @@
- (void)audioPlayer:(AudioPlayer *)player requestNextStream:(id)userInfo
{
PlaylistEntry *curEntry = (PlaylistEntry *)userInfo;
PlaylistEntry *pe = [playlistController getNextEntry:curEntry];
PlaylistEntry *pe;
if (curEntry.status == kCogEntryStoppingAfterCurrent)
return;
else
pe = [playlistController getNextEntry:curEntry];
[player setNextStream:[pe URL] withUserInfo:pe];
}

View File

@ -382,9 +382,6 @@
- (PlaylistEntry *)getNextEntry:(PlaylistEntry *)pe
{
if (pe.status == kCogEntryStoppingAfterCurrent)
return nil;
if (repeat == RepeatOne) {
return pe;
}
@ -687,6 +684,14 @@
}
}
- (IBAction)stopAfterCurrent:(id)sender
{
if (currentEntry.status != kCogEntryStoppingAfterCurrent)
currentEntry.status = kCogEntryStoppingAfterCurrent;
else
currentEntry.status = kCogEntryPlaying;
}
-(BOOL)validateMenuItem:(NSMenuItem*)menuItem
{
SEL action = [menuItem action];
@ -703,6 +708,9 @@
if (action == @selector(emptyQueueList:) && ([queueList count] < 1))
return NO;
if (action == @selector(stopAfterCurrent:) && (currentEntry.status == kCogEntryNormal))
return NO;
// if nothing is selected, gray out these
if ([[self selectedObjects] count] < 1)
{
@ -723,12 +731,5 @@
return YES;
}
- (IBAction)stopAfterCurrent:(id)sender
{
if (currentEntry.status != kCogEntryStoppingAfterCurrent)
currentEntry.status = kCogEntryStoppingAfterCurrent;
else
currentEntry.status = kCogEntryPlaying;
}
@end