From 89cd984b7dd68eedcb3bfa60d574b177d5ee8586 Mon Sep 17 00:00:00 2001 From: areff Date: Mon, 25 Feb 2008 17:02:06 +0000 Subject: [PATCH] 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. --- Application/PlaybackController.m | 7 ++++++- Playlist/PlaylistController.m | 21 +++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Application/PlaybackController.m b/Application/PlaybackController.m index d35a4d49b..42c31d826 100644 --- a/Application/PlaybackController.m +++ b/Application/PlaybackController.m @@ -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]; } diff --git a/Playlist/PlaylistController.m b/Playlist/PlaylistController.m index 1b649a0ca..4dfff0b75 100644 --- a/Playlist/PlaylistController.m +++ b/Playlist/PlaylistController.m @@ -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