Restrict to sane number of types, with sane defaults
This commit is contained in:
parent
d24a3e783d
commit
514fffddbd
|
@ -139,10 +139,21 @@
|
||||||
[exportMovie writeToFile:[url path] withAttributes:attributes];
|
[exportMovie writeToFile:[url path] withAttributes:attributes];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define kMAAudioTypes @"m4a", @"aiff", @"aif", @"wav", @"caf", @"mp3"
|
||||||
|
#define kMAVideoTypes @"mov", @"mp4"
|
||||||
|
|
||||||
- (IBAction)exportMedia:(id)sender
|
- (IBAction)exportMedia:(id)sender
|
||||||
{
|
{
|
||||||
|
QTMovie * currentMovie = [self currentMovie];
|
||||||
NSSavePanel * savePanel = [NSSavePanel savePanel];
|
NSSavePanel * savePanel = [NSSavePanel savePanel];
|
||||||
[savePanel setAllowedFileTypes:[QTMovie movieFileTypes:QTIncludeCommonTypes]];
|
NSDictionary *attrs = [currentMovie movieAttributes];
|
||||||
|
BOOL hasVideo = [[attrs objectForKey:QTMovieHasVideoAttribute] boolValue];
|
||||||
|
BOOL hasAudio = !hasVideo || [[attrs objectForKey:QTMovieHasAudioAttribute] boolValue];
|
||||||
|
[savePanel setAllowedFileTypes:(hasVideo
|
||||||
|
? (hasAudio
|
||||||
|
? [NSArray arrayWithObjects: kMAVideoTypes, kMAAudioTypes, nil]
|
||||||
|
: [NSArray arrayWithObjects: kMAVideoTypes, nil])
|
||||||
|
: [NSArray arrayWithObjects: kMAAudioTypes, nil])];
|
||||||
[savePanel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger result) {
|
[savePanel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger result) {
|
||||||
[savePanel orderOut:self];
|
[savePanel orderOut:self];
|
||||||
if (result == NSFileHandlingPanelOKButton)
|
if (result == NSFileHandlingPanelOKButton)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user