[vlc-commits] macosx/playlist: allow multi-select and multi-delete

Felix Paul Kühne git at videolan.org
Thu Jan 31 19:07:26 CET 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Thu Jan 31 18:34:28 2019 +0100| [9feb7ca812d7e80053b1ab61a49241025b6c90eb] | committer: Felix Paul Kühne

macosx/playlist: allow multi-select and multi-delete

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

 modules/gui/macosx/UI/VLCLibraryWindow.xib |  2 +-
 modules/gui/macosx/VLCPlaylistTableView.m  | 12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/modules/gui/macosx/UI/VLCLibraryWindow.xib b/modules/gui/macosx/UI/VLCLibraryWindow.xib
index dabe0892db..0cfef78402 100644
--- a/modules/gui/macosx/UI/VLCLibraryWindow.xib
+++ b/modules/gui/macosx/UI/VLCLibraryWindow.xib
@@ -91,7 +91,7 @@
                                             <rect key="frame" x="0.0" y="0.0" width="237" height="235"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             <subviews>
-                                                <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="Fr1-af-8gb" customClass="VLCPlaylistTableView">
+                                                <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="Fr1-af-8gb" customClass="VLCPlaylistTableView">
                                                     <rect key="frame" x="0.0" y="0.0" width="237" height="235"/>
                                                     <autoresizingMask key="autoresizingMask"/>
                                                     <size key="intercellSpacing" width="3" height="2"/>
diff --git a/modules/gui/macosx/VLCPlaylistTableView.m b/modules/gui/macosx/VLCPlaylistTableView.m
index fc0fad676f..0c6034912b 100644
--- a/modules/gui/macosx/VLCPlaylistTableView.m
+++ b/modules/gui/macosx/VLCPlaylistTableView.m
@@ -61,14 +61,24 @@
     }
 
     size_t indexOfSelectedItem = self.selectedRow;
+    NSIndexSet *selectedIndexes = [self selectedRowIndexes];
 
     switch(key) {
         case NSDeleteCharacter:
         case NSDeleteFunctionKey:
         case NSDeleteCharFunctionKey:
         case NSBackspaceCharacter:
-            [[[VLCMain sharedInstance] playlistController] removeItemAtIndex:indexOfSelectedItem];
+        {
+            if (selectedIndexes.count == 1) {
+                [[[VLCMain sharedInstance] playlistController] removeItemAtIndex:indexOfSelectedItem];
+            } else {
+                VLCPlaylistController *playlistController = [[VLCMain sharedInstance] playlistController];
+                [selectedIndexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL * _Nonnull stop) {
+                    [playlistController removeItemAtIndex:idx];
+                }];
+            }
             break;
+        }
 
         case NSEnterCharacter:
         case NSCarriageReturnCharacter:



More information about the vlc-commits mailing list