[vlc-commits] macosx/main menu: merge repeat and loop

Felix Paul Kühne git at videolan.org
Wed Aug 28 15:28:16 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Wed Aug 28 15:27:21 2019 +0200| [baf77ff56d25d7956df943feae7af5e4a860fb98] | committer: Felix Paul Kühne

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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=baf77ff56d25d7956df943feae7af5e4a860fb98
---

 modules/gui/macosx/UI/MainMenu.xib     | 10 ++--------
 modules/gui/macosx/menus/VLCMainMenu.h |  2 --
 modules/gui/macosx/menus/VLCMainMenu.m | 33 ++++++++++++---------------------
 3 files changed, 14 insertions(+), 31 deletions(-)

diff --git a/modules/gui/macosx/UI/MainMenu.xib b/modules/gui/macosx/UI/MainMenu.xib
index 07a48c4e54..c64532935c 100644
--- a/modules/gui/macosx/UI/MainMenu.xib
+++ b/modules/gui/macosx/UI/MainMenu.xib
@@ -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>
diff --git a/modules/gui/macosx/menus/VLCMainMenu.h b/modules/gui/macosx/menus/VLCMainMenu.h
index 996cc89383..1517b32ccc 100644
--- a/modules/gui/macosx/menus/VLCMainMenu.h
+++ b/modules/gui/macosx/menus/VLCMainMenu.h
@@ -86,7 +86,6 @@
 @property (readwrite, weak) IBOutlet NSMenuItem *next;
 @property (readwrite, weak) IBOutlet NSMenuItem *random;
 @property (readwrite, weak) IBOutlet NSMenuItem *repeat;
- at 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;
diff --git a/modules/gui/macosx/menus/VLCMainMenu.m b/modules/gui/macosx/menus/VLCMainMenu.m
index 1890e78691..c90e1e7caa 100644
--- a/modules/gui/macosx/menus/VLCMainMenu.m
+++ b/modules/gui/macosx/menus/VLCMainMenu.m
@@ -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];



More information about the vlc-commits mailing list