[vlc-commits] macosx: add playlist sorting menu to main menu and playlist context menu

Felix Paul Kühne git at videolan.org
Fri May 31 19:58:23 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Fri May 31 19:57:45 2019 +0200| [414e4b1a28a90ba9ee26b3d2cc8ad79e1b08ca4c] | committer: Felix Paul Kühne

macosx: add playlist sorting menu to main menu and playlist context menu

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

 modules/gui/macosx/UI/MainMenu.xib                      | 4 ++++
 modules/gui/macosx/menus/VLCMainMenu.h                  | 1 +
 modules/gui/macosx/menus/VLCMainMenu.m                  | 5 +++++
 modules/gui/macosx/playlist/VLCPlaylistMenuController.m | 8 ++++++++
 4 files changed, 18 insertions(+)

diff --git a/modules/gui/macosx/UI/MainMenu.xib b/modules/gui/macosx/UI/MainMenu.xib
index 0b1a8cd1f8..ea72fd3f1e 100644
--- a/modules/gui/macosx/UI/MainMenu.xib
+++ b/modules/gui/macosx/UI/MainMenu.xib
@@ -118,6 +118,7 @@
                 <outlet property="services" destination="1996" id="X3H-XI-xFK"/>
                 <outlet property="show_all" destination="150" id="XQ2-CW-0PI"/>
                 <outlet property="snapshot" destination="2249" id="6bO-HY-I3I"/>
+                <outlet property="sortPlaylist" destination="lkj-Wj-TYr" id="T45-2w-c0O"/>
                 <outlet property="stop" destination="5156" id="irh-Cr-vBT"/>
                 <outlet property="subtitle_bgcolor" destination="5581" id="moz-G5-DBl"/>
                 <outlet property="subtitle_bgcolorMenu" destination="5582" id="gPd-5S-3xK"/>
@@ -448,6 +449,9 @@
                                     <action selector="toggleAtoBloop:" target="-2" id="Wrv-He-P33"/>
                                 </connections>
                             </menuItem>
+                            <menuItem title="Sort Playlist" id="lkj-Wj-TYr">
+                                <modifierMask key="keyEquivalentModifierMask"/>
+                            </menuItem>
                             <menuItem isSeparatorItem="YES" id="5141"/>
                             <menuItem title="Quit after Playback" id="5140">
                                 <modifierMask key="keyEquivalentModifierMask"/>
diff --git a/modules/gui/macosx/menus/VLCMainMenu.h b/modules/gui/macosx/menus/VLCMainMenu.h
index 049f610a30..c5b8c2ad8a 100644
--- a/modules/gui/macosx/menus/VLCMainMenu.h
+++ b/modules/gui/macosx/menus/VLCMainMenu.h
@@ -88,6 +88,7 @@
 @property (readwrite, weak) IBOutlet NSMenuItem *repeat;
 @property (readwrite, weak) IBOutlet NSMenuItem *loop;
 @property (readwrite, weak) IBOutlet NSMenuItem *AtoBloop;
+ at property (readwrite, weak) IBOutlet NSMenuItem *sortPlaylist;
 @property (readwrite, weak) IBOutlet NSMenuItem *quitAfterPB;
 @property (readwrite, weak) IBOutlet NSMenuItem *fwd;
 @property (readwrite, weak) IBOutlet NSMenuItem *bwd;
diff --git a/modules/gui/macosx/menus/VLCMainMenu.m b/modules/gui/macosx/menus/VLCMainMenu.m
index 655ab9da88..b5b5c78e98 100644
--- a/modules/gui/macosx/menus/VLCMainMenu.m
+++ b/modules/gui/macosx/menus/VLCMainMenu.m
@@ -42,6 +42,7 @@
 
 #import "playlist/VLCPlaylistController.h"
 #import "playlist/VLCPlayerController.h"
+#import "playlist/VLCPlaylistSortingMenuController.h"
 #import "preferences/VLCSimplePrefsController.h"
 
 #import "windows/VLCAboutWindowController.h"
@@ -95,6 +96,7 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
     VLCPlaylistController *_playlistController;
     VLCPlayerController *_playerController;
     NSTimer *_cancelRendererDiscoveryTimer;
+    VLCPlaylistSortingMenuController *_playlistSortingController;
 
     NSMenu *_playlistTableColumnsContextMenu;
 
@@ -147,6 +149,8 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
     _rendererMenuController = [[VLCRendererMenuController alloc] init];
     _rendererMenuController.rendererNoneItem = _rendererNoneItem;
     _rendererMenuController.rendererMenu = _rendererMenu;
+    _playlistSortingController = [[VLCPlaylistSortingMenuController alloc] init];
+    _sortPlaylist.submenu = _playlistSortingController.playlistSortingMenu;
 
     [self mediaItemChanged:nil];
     [self updateTitleAndChapterMenus:nil];
@@ -382,6 +386,7 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
     [_repeat setTitle: _NS("Repeat One")];
     [_loop setTitle: _NS("Repeat All")];
     [_AtoBloop setTitle: _NS("A→B Loop")];
+    [_sortPlaylist setTitle: _NS("Sort Playlist")];
     [_quitAfterPB setTitle: _NS("Quit after Playback")];
     [_fwd setTitle: _NS("Step Forward")];
     [_bwd setTitle: _NS("Step Backward")];
diff --git a/modules/gui/macosx/playlist/VLCPlaylistMenuController.m b/modules/gui/macosx/playlist/VLCPlaylistMenuController.m
index 3f627a9a3f..446f04e46d 100644
--- a/modules/gui/macosx/playlist/VLCPlaylistMenuController.m
+++ b/modules/gui/macosx/playlist/VLCPlaylistMenuController.m
@@ -29,17 +29,20 @@
 #import "playlist/VLCPlaylistController.h"
 #import "playlist/VLCPlaylistModel.h"
 #import "playlist/VLCPlaylistItem.h"
+#import "playlist/VLCPlaylistSortingMenuController.h"
 #import "windows/VLCOpenWindowController.h"
 
 @interface VLCPlaylistMenuController ()
 {
     VLCPlaylistController *_playlistController;
+    VLCPlaylistSortingMenuController *_playlistSortingMenuController;
 
     NSMenuItem *_playMenuItem;
     NSMenuItem *_revealInFinderMenuItem;
     NSMenuItem *_addFilesToPlaylistMenuItem;
     NSMenuItem *_removeMenuItem;
     NSMenuItem *_clearPlaylistMenuItem;
+    NSMenuItem *_sortMenuItem;
 }
 @end
 
@@ -80,6 +83,11 @@
     _clearPlaylistMenuItem = [[NSMenuItem alloc] initWithTitle:_NS("Clear the playlist") action:@selector(clearPlaylist:) keyEquivalent:@""];
     _clearPlaylistMenuItem.target = self;
     [_playlistMenu addItem:_clearPlaylistMenuItem];
+
+    _playlistSortingMenuController = [[VLCPlaylistSortingMenuController alloc] init];
+    _sortMenuItem = [[NSMenuItem alloc] initWithTitle:_NS("Sort") action:nil keyEquivalent:@""];
+    [_sortMenuItem setSubmenu:_playlistSortingMenuController.playlistSortingMenu];
+    [_playlistMenu addItem:_sortMenuItem];
 }
 
 - (void)play:(id)sender



More information about the vlc-commits mailing list