Playback: Implement Always Stop After Current

A new menu option under the Control menu, disabled by default, which
stops playback after the current track completes.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
Christopher Snowhill 2025-03-03 18:32:01 -08:00
parent 5e324927c5
commit a8902b4ee6
5 changed files with 22 additions and 0 deletions

View file

@ -657,6 +657,8 @@ static BOOL consentLastEnabled = NO;
[userDefaultsValuesDict setObject:@(2) forKey:@"synthDefaultLoopCount"];
[userDefaultsValuesDict setObject:@(44100) forKey:@"synthSampleRate"];
[userDefaultsValuesDict setObject:@NO forKey:@"alwaysStopAfterCurrent"];
// Register and sync defaults
[[NSUserDefaults standardUserDefaults] registerDefaults:userDefaultsValuesDict];
[[NSUserDefaults standardUserDefaults] synchronize];

View file

@ -1882,6 +1882,12 @@
<action selector="stopAfterCurrent:" target="218" id="1896"/>
</connections>
</menuItem>
<menuItem title="Always Stop After Current" keyEquivalent="." id="y8c-n8-5Uh">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<binding destination="1689" name="value" keyPath="values.alwaysStopAfterCurrent" id="rwr-s6-PnE"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>

View file

@ -1288,6 +1288,10 @@ static void *playlistControllerContext = &playlistControllerContext;
}
- (PlaylistEntry *)getNextEntry:(PlaylistEntry *)pe ignoreRepeatOne:(BOOL)ignoreRepeatOne {
if(!ignoreRepeatOne && [[NSUserDefaults standardUserDefaults] boolForKey:@"alwaysStopAfterCurrent"]) {
return nil;
}
if(!ignoreRepeatOne && [self repeat] == RepeatModeRepeatOne) {
return pe;
}
@ -1357,6 +1361,10 @@ static void *playlistControllerContext = &playlistControllerContext;
}
- (PlaylistEntry *)getPrevEntry:(PlaylistEntry *)pe ignoreRepeatOne:(BOOL)ignoreRepeatOne {
if(!ignoreRepeatOne && [[NSUserDefaults standardUserDefaults] boolForKey:@"alwaysStopAfterCurrent"]) {
return nil;
}
if(!ignoreRepeatOne && [self repeat] == RepeatModeRepeatOne) {
return pe;
}

View file

@ -461,6 +461,9 @@
/* Class = "NSMenuItem"; title = "Stop After Current"; ObjectID = "1895"; */
"1895.title" = "Stop After Current";
/* Class = "NSMenuItem"; title = "Always Stop After Current"; ObjectID = "y8c-n8-5Uh"; */
"y8c-n8-5Uh.title" = "Always Stop After Current";
/* Class = "CocoaBindingsConnection"; ibShadowedIsNilPlaceholder = "Cog"; ObjectID = "1903"; */
"1903.ibShadowedIsNilPlaceholder" = "Cog";

View file

@ -461,6 +461,9 @@
/* Class = "NSMenuItem"; title = "Stop After Current"; ObjectID = "1895"; */
"1895.title" = "Detener después de la pista actual";
/* Class = "NSMenuItem"; title = "Always Stop After Current"; ObjectID = "y8c-n8-5Uh"; */
"y8c-n8-5Uh.title" = "Detener siempre al finalizar";
/* Class = "CocoaBindingsConnection"; ibShadowedIsNilPlaceholder = "Cog"; ObjectID = "1903"; */
"1903.ibShadowedIsNilPlaceholder" = "Cog";