[Menu] Add Stop after Selection to context menu

Since the existing code already supports setting any arbitrary track as
a stopping point, add a menu interface to toggle Stop After for any
track in the playlist. Stop After will be removed from the given track
after it has been played. Stop After will not be remembered on disk.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
swiftingly
Christopher Snowhill 2022-05-30 22:23:02 -07:00
parent aabd9431f1
commit 05f17ea950
2 changed files with 19 additions and 0 deletions

View File

@ -2136,6 +2136,12 @@ Gw
</binding> </binding>
</connections> </connections>
</menuItem> </menuItem>
<menuItem title="Stop after Selection" id="omb-wi-loX">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="stopAfterSelection:" target="218" id="ZRy-Mw-4cY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="2047"/> <menuItem isSeparatorItem="YES" id="2047"/>
<menuItem title="Search for Artist" id="2045"> <menuItem title="Search for Artist" id="2045">
<modifierMask key="keyEquivalentModifierMask"/> <modifierMask key="keyEquivalentModifierMask"/>

View File

@ -1455,6 +1455,19 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
[self.tableView reloadDataForRowIndexes:refreshSet columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, columns)]]; [self.tableView reloadDataForRowIndexes:refreshSet columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, columns)]];
} }
- (IBAction)stopAfterSelection:(id)sender {
NSMutableIndexSet *refreshSet = [[NSMutableIndexSet alloc] init];
for(PlaylistEntry *pe in [self selectedObjects]) {
pe.stopAfter = !pe.stopAfter;
[refreshSet addIndex:pe.index];
}
// Refresh entire row of all affected items to update tooltips
unsigned long columns = [[self.tableView tableColumns] count];
[self.tableView reloadDataForRowIndexes:refreshSet columnIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, columns)]];
}
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem { - (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
SEL action = [menuItem action]; SEL action = [menuItem action];