Set title for movie panel
This commit is contained in:
parent
531f55758b
commit
484e5279b3
|
@ -20,6 +20,7 @@
|
|||
IBOutlet NSView * textExportAccessoryView;
|
||||
IBOutlet MAMovieWindow * moviePanel;
|
||||
QTMovie * currentMovie;
|
||||
NSString * currentMovieTitle;
|
||||
QTTime lastMovieTime;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ static const char * kMADocWindowObserver = "MADocWindowObserver";
|
|||
self = [super initWithWindow:window];
|
||||
|
||||
exportAnnotations = YES;
|
||||
currentMovieTitle = @"";
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -40,6 +41,7 @@ static const char * kMADocWindowObserver = "MADocWindowObserver";
|
|||
[annotationController setSortDescriptors:[NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"location" ascending:YES]]];
|
||||
[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(updateMovieTime:) userInfo:nil repeats:YES];
|
||||
[mediaController addObserver:self forKeyPath:@"selection.media" options:0 context:&kMADocWindowObserver];
|
||||
[mediaController addObserver:self forKeyPath:@"selection.name" options:0 context:&kMADocWindowObserver];
|
||||
}
|
||||
|
||||
- (MAMovieWindow *)moviePanel
|
||||
|
@ -50,7 +52,7 @@ static const char * kMADocWindowObserver = "MADocWindowObserver";
|
|||
- (void)moviePanelDidAppear
|
||||
{
|
||||
[movieView setMovie:nil];
|
||||
if (![[self moviePanel] shouldDisplayMovie:currentMovie])
|
||||
if (![[self moviePanel] shouldDisplayMovie:currentMovie withTitle:currentMovieTitle])
|
||||
[movieView setMovie:currentMovie];
|
||||
}
|
||||
|
||||
|
@ -61,7 +63,7 @@ static const char * kMADocWindowObserver = "MADocWindowObserver";
|
|||
|
||||
- (void)moviePanelDidClose
|
||||
{
|
||||
[[self moviePanel] shouldDisplayMovie:nil];
|
||||
[[self moviePanel] shouldDisplayMovie:nil withTitle:@""];
|
||||
[movieView setMovie:currentMovie];
|
||||
}
|
||||
|
||||
|
@ -77,8 +79,14 @@ static const char * kMADocWindowObserver = "MADocWindowObserver";
|
|||
//
|
||||
// Current movie changed
|
||||
//
|
||||
MAMedia * currentMedia = [mediaController selection];
|
||||
currentMovie = [[QTMovie alloc] initWithFile:[currentMedia valueForKey:@"media"] error:nil];
|
||||
if ([[mediaController selectionIndexes] count] > 0) {
|
||||
MAMedia * currentMedia = [[mediaController selectedObjects] objectAtIndex:0];
|
||||
currentMovie = [[QTMovie alloc] initWithFile:[currentMedia media] error:nil];
|
||||
currentMovieTitle = [currentMedia name];
|
||||
} else {
|
||||
currentMovie = nil;
|
||||
currentMovieTitle = @"";
|
||||
}
|
||||
}
|
||||
[self moviePanelDidAppear];
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
IBOutlet QTMovieView * panelMovieView;
|
||||
}
|
||||
|
||||
- (BOOL)shouldDisplayMovie:(QTMovie *)movie;
|
||||
- (BOOL)shouldDisplayMovie:(QTMovie *)movie withTitle:(NSString *)title;
|
||||
- (IBAction)toggleWindow:(id)sender;
|
||||
|
||||
@end
|
||||
|
|
|
@ -23,13 +23,15 @@
|
|||
[super windowDidLoad];
|
||||
}
|
||||
|
||||
- (BOOL)shouldDisplayMovie:(QTMovie *)movie
|
||||
- (BOOL)shouldDisplayMovie:(QTMovie *)movie withTitle:(NSString *)title
|
||||
{
|
||||
if ([self isWindowLoaded] && [[self window] isVisible]) {
|
||||
[panelMovieView setMovie:movie];
|
||||
[[self window] setTitle:title];
|
||||
return YES;
|
||||
} else {
|
||||
[panelMovieView setMovie:nil];
|
||||
[[self window] setTitle:@""];
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user