Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits: 2724c104 by Claudio Cambra at 2026-05-03T13:20:27+02:00 macosx: Add convenience method to get extension array from EXTENSIONS_ strings Signed-off-by: Claudio Cambra <[email protected]> - - - - - d55e331a by Claudio Cambra at 2026-05-03T13:20:27+02:00 macosx: Filter by media extensions in conversion window Signed-off-by: Claudio Cambra <[email protected]> - - - - - 569530a4 by Claudio Cambra at 2026-05-03T13:20:27+02:00 macosx: Filter by expected types in open window controller openpanels Signed-off-by: Claudio Cambra <[email protected]> - - - - - 6 changed files: - modules/gui/macosx/extensions/NSString+Helpers.h - modules/gui/macosx/extensions/NSString+Helpers.m - modules/gui/macosx/menus/VLCMainMenu.m - modules/gui/macosx/views/VLCPlaybackEndViewController.m - modules/gui/macosx/windows/VLCOpenWindowController.m - modules/gui/macosx/windows/convertandsave/VLCConvertAndSaveWindowController.m Changes: ===================================== modules/gui/macosx/extensions/NSString+Helpers.h ===================================== @@ -163,6 +163,12 @@ NSImage *imageFromRes(NSString *name); */ - (NSString *)stringWithIncrementedTrailingNumber; +/** + * Returns an array of file extensions from a semicolon-separated string of extensions, + * stripping any leading "*." prefix. + */ ++ (NSArray<NSString *> *)extensionsArrayFromVLCStyleString:(const char *)extensionsString; + @end /** ===================================== modules/gui/macosx/extensions/NSString+Helpers.m ===================================== @@ -231,6 +231,17 @@ NSString *const kVLCMediaUnknown = @"Unknown"; return result.copy; } ++ (NSArray<NSString *> *)extensionsArrayFromVLCStyleString:(const char *)extensionsString +{ + if (extensionsString == NULL) { + return @[]; + } + + NSString *extensions = [NSString stringWithCString:extensionsString encoding:NSUTF8StringEncoding]; + extensions = [extensions stringByReplacingOccurrencesOfString:@"*." withString:@""]; + return [extensions componentsSeparatedByString:@";"]; +} + @end #pragma mark - ===================================== modules/gui/macosx/menus/VLCMainMenu.m ===================================== @@ -1234,10 +1234,7 @@ typedef NS_ENUM(NSInteger, VLCObjectType) { [openPanel setCanChooseFiles: YES]; [openPanel setCanChooseDirectories: NO]; [openPanel setAllowsMultipleSelection: YES]; - - NSMutableString *subtitleExtensionsString = [toNSStr(EXTENSIONS_SUBTITLE) mutableCopy]; - [subtitleExtensionsString replaceOccurrencesOfString:@"*." withString:@"" options:NSLiteralSearch range:NSMakeRange(0, subtitleExtensionsString.length)]; - [openPanel setAllowedFileTypes:[subtitleExtensionsString componentsSeparatedByString:@";"]]; + [openPanel setAllowedFileTypes:[NSString extensionsArrayFromVLCStyleString:EXTENSIONS_SUBTITLE]]; NSURL *url = _playerController.URLOfCurrentMediaItem; url = [url URLByDeletingLastPathComponent]; ===================================== modules/gui/macosx/views/VLCPlaybackEndViewController.m ===================================== @@ -147,10 +147,7 @@ NSString * const VLCPlaybackEndViewReturnToLibraryNotificationName = @"VLCPlayba return nil; } - NSArray<NSString *> * const playableExtensions = [[[NSString - stringWithCString:EXTENSIONS_MEDIA encoding:NSUTF8StringEncoding] - stringByReplacingOccurrencesOfString:@"*." withString:@""] - componentsSeparatedByString:@";"]; + NSArray<NSString *> * const playableExtensions = [NSString extensionsArrayFromVLCStyleString:EXTENSIONS_MEDIA]; NSArray<NSString *> * const itemPlayableSiblingItemPaths = [[itemSiblingItemPaths sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)] filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSString * const _Nonnull siblingItemPath, NSDictionary<NSString *, id> * const _Nullable __unused bindings) { ===================================== modules/gui/macosx/windows/VLCOpenWindowController.m ===================================== @@ -546,6 +546,7 @@ NSString *const VLCOpenTextFieldWasClicked = @"VLCOpenTextFieldWasClicked"; NSOpenPanel *openPanel = [NSOpenPanel openPanel]; [openPanel setAllowsMultipleSelection: YES]; [openPanel setCanChooseDirectories: YES]; + [openPanel setAllowedFileTypes:[NSString extensionsArrayFromVLCStyleString:EXTENSIONS_MEDIA]]; [openPanel setTitle: _NS("Open File")]; [openPanel setPrompt: _NS("Open")]; @@ -628,6 +629,7 @@ NSString *const VLCOpenTextFieldWasClicked = @"VLCOpenTextFieldWasClicked"; NSOpenPanel *openPanel = [NSOpenPanel openPanel]; [openPanel setAllowsMultipleSelection: NO]; [openPanel setCanChooseDirectories: YES]; + [openPanel setAllowedFileTypes:[NSString extensionsArrayFromVLCStyleString:EXTENSIONS_MEDIA]]; [openPanel setTitle: _NS("Open File")]; [openPanel setPrompt: _NS("Open")]; [openPanel beginSheetModalForWindow:[sender window] completionHandler:^(NSInteger returnCode) { @@ -652,6 +654,7 @@ NSString *const VLCOpenTextFieldWasClicked = @"VLCOpenTextFieldWasClicked"; openPanel = [NSOpenPanel openPanel]; [openPanel setCanChooseFiles: YES]; [openPanel setCanChooseDirectories: NO]; + [openPanel setAllowedFileTypes:[NSString extensionsArrayFromVLCStyleString:EXTENSIONS_MEDIA]]; if ([openPanel runModal] == NSModalResponseOK) { _fileSlavePath = [[[openPanel URLs] firstObject] path]; } @@ -1264,6 +1267,7 @@ NSString *const VLCOpenTextFieldWasClicked = @"VLCOpenTextFieldWasClicked"; { NSOpenPanel *openPanel = [NSOpenPanel openPanel]; [openPanel setAllowsMultipleSelection: NO]; + [openPanel setAllowedFileTypes:[NSString extensionsArrayFromVLCStyleString:EXTENSIONS_SUBTITLE]]; [openPanel setTitle: _NS("Open File")]; [openPanel setPrompt: _NS("Open")]; ===================================== modules/gui/macosx/windows/convertandsave/VLCConvertAndSaveWindowController.m ===================================== @@ -328,6 +328,7 @@ NSString *VLCConvertAndSaveProfileNamesKey = @"CASProfileNames"; [openPanel setCanChooseDirectories:NO]; [openPanel setResolvesAliases:YES]; [openPanel setAllowsMultipleSelection:NO]; + [openPanel setAllowedFileTypes:[NSString extensionsArrayFromVLCStyleString:EXTENSIONS_MEDIA]]; [openPanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger returnCode) { if (returnCode == NSModalResponseOK) { [self setMRL: [[openPanel URL] absoluteString]]; View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8d47a38afdd3a18969e241ade782396573de8e78...569530a4ff3530b2eff2f3448d22e8af6afa9522 -- View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/8d47a38afdd3a18969e241ade782396573de8e78...569530a4ff3530b2eff2f3448d22e8af6afa9522 You're receiving this email because of your account on code.videolan.org.
_______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
