[vlc-commits] macosx/main menu: use global list of supported subtitle extensions instead of hardcoding another one

Felix Paul Kühne git at videolan.org
Wed Apr 17 00:18:14 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Wed Apr 17 00:17:20 2019 +0200| [0d2f717083cb0e6e98ccc9b75182671c02daa562] | committer: Felix Paul Kühne

macosx/main menu: use global list of supported subtitle extensions instead of hardcoding another one

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

 modules/gui/macosx/menus/VLCMainMenu.m | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/gui/macosx/menus/VLCMainMenu.m b/modules/gui/macosx/menus/VLCMainMenu.m
index 0c07b31b22..8f0bafcc42 100644
--- a/modules/gui/macosx/menus/VLCMainMenu.m
+++ b/modules/gui/macosx/menus/VLCMainMenu.m
@@ -53,6 +53,8 @@
 #import "windows/logging/VLCLogWindowController.h"
 #import "windows/addons/VLCAddonsWindowController.h"
 
+#import <vlc_interface.h>
+
 #ifdef HAVE_SPARKLE
 #import <Sparkle/Sparkle.h>
 #endif
@@ -1201,7 +1203,9 @@ typedef NS_ENUM(NSInteger, VLCObjectType) {
     [openPanel setCanChooseDirectories: NO];
     [openPanel setAllowsMultipleSelection: YES];
 
-    [openPanel setAllowedFileTypes: [NSArray arrayWithObjects:@"cdg",@"idx",@"srt",@"sub",@"utf",@"ass",@"ssa",@"aqt",@"jss",@"psb",@"rt",@"smi",@"txt",@"smil",@"stl",@"usf",@"dks",@"pjs",@"mpl2",@"mks",@"vtt",@"ttml",@"dfxp",nil]];
+    NSMutableString *subtitleExtensionsString = [toNSStr(EXTENSIONS_SUBTITLE) mutableCopy];
+    [subtitleExtensionsString replaceOccurrencesOfString:@"*." withString:@"" options:NSLiteralSearch range:NSMakeRange(0, subtitleExtensionsString.length)];
+    [openPanel setAllowedFileTypes:[subtitleExtensionsString componentsSeparatedByString:@";"]];
 
     NSURL *url = _playerController.URLOfCurrentMediaItem;
     url = [url URLByDeletingLastPathComponent];



More information about the vlc-commits mailing list