From 8fcde66f6ae16352e8473a35d5b87cd4482e70e7 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Tue, 15 Jan 2019 14:26:33 +0100 Subject: MacGui: support SSA file import. --- macosx/HBSubtitlesController.m | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'macosx/HBSubtitlesController.m') diff --git a/macosx/HBSubtitlesController.m b/macosx/HBSubtitlesController.m index 623f3053a..b9c88e940 100644 --- a/macosx/HBSubtitlesController.m +++ b/macosx/HBSubtitlesController.m @@ -70,14 +70,14 @@ }]; } -#pragma mark - Srt import +#pragma mark - External subtitles import /** - * Imports a srt file. + * Imports a srt/ssa file. * * @param sender */ -- (IBAction)browseImportSrtFile:(id)sender +- (IBAction)browseImportExternalFile:(id)sender { NSOpenPanel *panel = [NSOpenPanel openPanel]; panel.allowsMultipleSelection = NO; @@ -85,9 +85,9 @@ panel.canChooseDirectories = NO; NSURL *sourceDirectory; - if ([[NSUserDefaults standardUserDefaults] URLForKey:@"LastSrtImportDirectoryURL"]) + if ([[NSUserDefaults standardUserDefaults] URLForKey:@"LastExternalSubImportDirectoryURL"]) { - sourceDirectory = [[NSUserDefaults standardUserDefaults] URLForKey:@"LastSrtImportDirectoryURL"]; + sourceDirectory = [[NSUserDefaults standardUserDefaults] URLForKey:@"LastExternalSubImportDirectoryURL"]; } else { @@ -95,17 +95,17 @@ } panel.directoryURL = sourceDirectory; - panel.allowedFileTypes = @[@"srt"]; + panel.allowedFileTypes = @[@"srt", @"ssa", @"ass"]; [panel beginSheetModalForWindow:self.view.window completionHandler:^(NSInteger result) { if (result == NSModalResponseOK) { - NSURL *importSrtFileURL = panel.URL; - NSURL *importSrtDirectory = importSrtFileURL.URLByDeletingLastPathComponent; - [[NSUserDefaults standardUserDefaults] setURL:importSrtDirectory forKey:@"LastSrtImportDirectoryURL"]; + NSURL *importFileURL = panel.URL; + NSURL *importDirectory = importFileURL.URLByDeletingLastPathComponent; + [[NSUserDefaults standardUserDefaults] setURL:importDirectory forKey:@"LastExternalSubImportDirectoryURL"]; - [self.subtitles addSrtTrackFromURL:importSrtFileURL]; + [self.subtitles addExternalTrackFromURL:importFileURL]; } }]; } -- cgit v1.2.3