Don’t show the import sheet if we are importing only subtitles. Patch by Aymeric Bard.
This commit is contained in:
1 parent
494f2f537e
commit
ff487cfd2f
3 files changed
+32
-5
No files matched your search
+10
-4
@@ -720,11 +720,17 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
||||
|
||||
importWindow = [[SBFileImport alloc] initWithDelegate:self andFiles:fileURLs error:&error];
|
||||
|
||||
if (importWindow)
|
||||
[NSApp beginSheet:[importWindow window] modalForWindow:documentWindow
|
||||
modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:importWindow];
|
||||
else if (error)
|
||||
if (importWindow) {
|
||||
if ([importWindow onlyContainsSubtitleTracks]) { //execute always. Maybe we should do this only for subtitle
|
||||
[importWindow addTracks:nil];
|
||||
[self sheetDidEnd:nil returnCode:NSOKButton contextInfo:nil];
|
||||
} else { // show the dialog
|
||||
[NSApp beginSheet:[importWindow window] modalForWindow:documentWindow
|
||||
modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:importWindow];
|
||||
}
|
||||
} else if (error) {
|
||||
[self presentError:error modalForWindow:documentWindow delegate:nil didPresentSelector:NULL contextInfo:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;{
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
- (IBAction)closeWindow:(id)sender;
|
||||
- (IBAction)addTracks:(id)sender;
|
||||
|
||||
- (BOOL)onlyContainsSubtitleTracks;
|
||||
|
||||
- (IBAction)checkSelected:(id)sender;
|
||||
- (IBAction)uncheckSelected:(id)sender;
|
||||
|
||||
|
||||
+20
-1
@@ -35,7 +35,7 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
- (void)_prepareActionArray
|
||||
{
|
||||
_importCheckArray = [[NSMutableArray alloc] initWithCapacity:[_tracks count]];
|
||||
_actionArray = [[NSMutableArray alloc] initWithCapacity:[_tracks count]];
|
||||
@@ -84,10 +84,26 @@
|
||||
[importMetadata setEnabled:YES];
|
||||
else
|
||||
[importMetadata setEnabled:NO];
|
||||
}
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
[self _prepareActionArray];
|
||||
[addTracksButton setEnabled:YES];
|
||||
}
|
||||
|
||||
- (BOOL)onlyContainsSubtitleTracks
|
||||
{
|
||||
BOOL onlySubtitle = YES;
|
||||
for (id track in _tracks) {
|
||||
if ([track isKindOfClass:[MP42Track class]]) {
|
||||
if (![track isMemberOfClass:[MP42SubtitleTrack class]])
|
||||
onlySubtitle = NO;
|
||||
}
|
||||
}
|
||||
return onlySubtitle;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfRowsInTableView:(NSTableView *)t
|
||||
{
|
||||
return [_tracks count];
|
||||
@@ -318,6 +334,9 @@
|
||||
|
||||
- (IBAction)addTracks:(id)sender
|
||||
{
|
||||
if (!_actionArray) // if add tracks is called directly, need to prepare actions
|
||||
[self _prepareActionArray];
|
||||
|
||||
NSMutableArray *tracks = [[NSMutableArray alloc] init];
|
||||
NSInteger i = 0;
|
||||
|
||||
|
||||
Reference in new issue
Block a user