macosx/main menu: merge repeat and loop

This way, you can cycle between the playback modes like with the Qt interface. Note that the key equivalent was changed to VLC's default

This addresses #10897.
This commit is contained in:
Felix Paul Kühne 2019-08-28 15:27:21 +02:00
parent 15bf19039c
commit baf77ff56d
3 changed files with 14 additions and 31 deletions

View File

@ -68,7 +68,6 @@
<outlet property="info" destination="1192" id="BPE-5A-AU4"/>
<outlet property="jumpToTime" destination="5138" id="XK6-rV-lr9"/>
<outlet property="license" destination="2834" id="0tU-nu-6dP"/>
<outlet property="loop" destination="5151" id="scu-xu-Tvh"/>
<outlet property="mcopyItem" destination="197" id="aBx-7l-f4e"/>
<outlet property="messages" destination="1003" id="q4C-pt-kQo"/>
<outlet property="minimize" destination="5606" id="tN3-Ho-T0c"/>
@ -447,17 +446,12 @@
<action selector="random:" target="-2" id="oVh-n6-tgV"/>
</connections>
</menuItem>
<menuItem title="Repeat Item" keyEquivalent="r" id="5143">
<menuItem title="Repeat Item" keyEquivalent="L" id="5143">
<connections>
<action selector="repeat:" target="-2" id="ThK-0C-9oZ"/>
</connections>
</menuItem>
<menuItem title="Repeat Playlist" keyEquivalent="l" id="5151">
<connections>
<action selector="loop:" target="-2" id="Oqv-EO-vhg"/>
</connections>
</menuItem>
<menuItem title="A→B Loop" keyEquivalent="L" id="5409">
<menuItem title="A→B Loop" keyEquivalent="l" id="5409">
<connections>
<action selector="toggleAtoBloop:" target="-2" id="Wrv-He-P33"/>
</connections>

View File

@ -86,7 +86,6 @@
@property (readwrite, weak) IBOutlet NSMenuItem *next;
@property (readwrite, weak) IBOutlet NSMenuItem *random;
@property (readwrite, weak) IBOutlet NSMenuItem *repeat;
@property (readwrite, weak) IBOutlet NSMenuItem *loop;
@property (readwrite, weak) IBOutlet NSMenuItem *AtoBloop;
@property (readwrite, weak) IBOutlet NSMenuItem *sortPlaylist;
@property (readwrite, weak) IBOutlet NSMenuItem *quitAfterPB;
@ -240,7 +239,6 @@
- (IBAction)next:(id)sender;
- (IBAction)random:(id)sender;
- (IBAction)repeat:(id)sender;
- (IBAction)loop:(id)sender;
- (IBAction)forward:(id)sender;
- (IBAction)backward:(id)sender;

View File

@ -385,8 +385,7 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
[_previous setTitle: _NS("Previous")];
[_next setTitle: _NS("Next")];
[_random setTitle: _NS("Random")];
[_repeat setTitle: _NS("Repeat One")];
[_loop setTitle: _NS("Repeat All")];
[_repeat setTitle: _NS("Repeat")];
[_AtoBloop setTitle: _NS("A→B Loop")];
[_sortPlaylist setTitle: _NS("Sort Playlist")];
[_quitAfterPB setTitle: _NS("Quit after Playback")];
@ -580,6 +579,11 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
[_random setKeyEquivalentModifierMask: VLCModifiersToCocoa(key)];
FREENULL(key);
key = config_GetPsz("key-loop");
[_repeat setKeyEquivalent: VLCKeyToString(key)];
[_repeat setKeyEquivalentModifierMask: VLCModifiersToCocoa(key)];
FREENULL(key);
key = config_GetPsz("key-zoom-half");
[_half_window setKeyEquivalent: VLCKeyToString(key)];
[_half_window setKeyEquivalentModifierMask: VLCModifiersToCocoa(key)];
@ -798,21 +802,14 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
- (IBAction)repeat:(id)sender
{
if (_playlistController.playbackRepeat == VLC_PLAYLIST_PLAYBACK_REPEAT_CURRENT) {
_playlistController.playbackRepeat = VLC_PLAYLIST_PLAYBACK_REPEAT_ALL;
} else if (_playlistController.playbackRepeat == VLC_PLAYLIST_PLAYBACK_REPEAT_ALL) {
_playlistController.playbackRepeat = VLC_PLAYLIST_PLAYBACK_REPEAT_NONE;
} else {
_playlistController.playbackRepeat = VLC_PLAYLIST_PLAYBACK_REPEAT_CURRENT;
}
}
- (IBAction)loop:(id)sender
{
if (_playlistController.playbackRepeat == VLC_PLAYLIST_PLAYBACK_REPEAT_ALL) {
_playlistController.playbackRepeat = VLC_PLAYLIST_PLAYBACK_REPEAT_NONE;
} else {
_playlistController.playbackRepeat = VLC_PLAYLIST_PLAYBACK_REPEAT_ALL;
}
}
- (IBAction)forward:(id)sender
{
[_playerController jumpForwardShort];
@ -1531,19 +1528,19 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
- (void)setRepeatOne
{
[_repeat setState: NSOnState];
[_loop setState: NSOffState];
[_repeat setTitle: _NS("Repeat One")];
}
- (void)setRepeatAll
{
[_repeat setState: NSOffState];
[_loop setState: NSOnState];
[_repeat setState: NSOnState];
[_repeat setTitle: _NS("Repeat All")];
}
- (void)setRepeatOff
{
[_repeat setState: NSOffState];
[_loop setState: NSOffState];
[_repeat setTitle: _NS("Repeat")];
}
#pragma mark - Dynamic menu creation and validation
@ -1823,12 +1820,6 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
} else if (mi == _random) {
enum vlc_playlist_playback_order playbackOrder = [_playlistController playbackOrder];
[mi setState: playbackOrder == VLC_PLAYLIST_PLAYBACK_ORDER_RANDOM ? NSOnState : NSOffState];
} else if (mi == _repeat) {
enum vlc_playlist_playback_repeat playbackRepeat = [_playlistController playbackRepeat];
[mi setState: playbackRepeat == VLC_PLAYLIST_PLAYBACK_REPEAT_CURRENT ? NSOnState : NSOffState];
} else if (mi == _loop) {
enum vlc_playlist_playback_repeat playbackRepeat = [_playlistController playbackRepeat];
[mi setState: playbackRepeat == VLC_PLAYLIST_PLAYBACK_REPEAT_ALL ? NSOnState : NSOffState];
} else if (mi == _quitAfterPB) {
BOOL state = _playerController.actionAfterStop == VLC_PLAYER_MEDIA_STOPPED_EXIT;
[mi setState: state ? NSOnState : NSOffState];