-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVideoQTMovieView.m
47 lines (39 loc) · 1.49 KB
/
VideoQTMovieView.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// VideoQTMovieView.m
// Tumblg
//
// Created by orta on 13/08/2008.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import "VideoQTMovieView.h"
@implementation VideoQTMovieView
- (void) awakeFromNib{
[self registerForDraggedTypes:[NSArray arrayWithObjects: NSFilenamesPboardType, nil]];
}
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
// if ((NSDragOperationGeneric & [sender draggingSourceOperationMask]) == NSDragOperationGeneric){
[self setNeedsDisplay:YES];
NSPasteboard *pboard = [sender draggingPasteboard];
NSString *fileName = [[pboard propertyListForType:NSFilenamesPboardType] objectAtIndex: 0];
NSString *extension = [fileName pathExtension];
log(@" ext = %@", extension);
if (([extension caseInsensitiveCompare:@"mp4"] == NSOrderedSame) ||
([extension caseInsensitiveCompare:@"avi"] == NSOrderedSame) ||
([extension caseInsensitiveCompare:@"flv"] == NSOrderedSame) ||
([extension caseInsensitiveCompare:@"mov"] == NSOrderedSame) ||
([extension caseInsensitiveCompare:@"mpg"] == NSOrderedSame) ||
([extension caseInsensitiveCompare:@"wmv"] == NSOrderedSame)){
return NSDragOperationCopy;
// }
}
return NSDragOperationNone;
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
NSPasteboard *pboard = [sender draggingPasteboard];
NSString *fileName = [[pboard propertyListForType:NSFilenamesPboardType] objectAtIndex: 0];
[videoController setSource:fileName];
return YES;
}
@end