vlc | branch: master | Felix Paul Kühne <[email protected]> | Wed May 30 00:05:52 2012 +0200| [22495438124c771cfed93a0d6335d32d331f93fe] | committer: Felix Paul Kühne
macosx: prepare drag & drop support for the Convert and Save panel > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=22495438124c771cfed93a0d6335d32d331f93fe --- modules/gui/macosx/ConvertAndSave.h | 10 ++++++ modules/gui/macosx/ConvertAndSave.m | 63 +++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/modules/gui/macosx/ConvertAndSave.h b/modules/gui/macosx/ConvertAndSave.h index 6f26fd7..da07d0b 100644 --- a/modules/gui/macosx/ConvertAndSave.h +++ b/modules/gui/macosx/ConvertAndSave.h @@ -46,7 +46,11 @@ IBOutlet id o_dropin_view; IBOutlet id o_dropin_icon_view; IBOutlet id o_dropin_media_lbl; + + NSString * MRL; } +@property (readwrite, nonatomic, retain) NSString * MRL; + + (VLCConvertAndSave *)sharedInstance; - (IBAction)toggleWindow; @@ -57,4 +61,10 @@ - (IBAction)customizeProfile:(id)sender; - (IBAction)chooseDestination:(id)sender; +- (void)updateDropView; + +@end + +@interface VLCDropEnabledBox : NSBox + @end diff --git a/modules/gui/macosx/ConvertAndSave.m b/modules/gui/macosx/ConvertAndSave.m index adc7102..857df2a 100644 --- a/modules/gui/macosx/ConvertAndSave.m +++ b/modules/gui/macosx/ConvertAndSave.m @@ -22,8 +22,13 @@ *****************************************************************************/ #import "ConvertAndSave.h" +#import <vlc_common.h> +#import <vlc_url.h> @implementation VLCConvertAndSave + +@synthesize MRL; + static VLCConvertAndSave *_o_sharedInstance = nil; + (VLCConvertAndSave *)sharedInstance @@ -72,4 +77,62 @@ static VLCConvertAndSave *_o_sharedInstance = nil; { } +- (void)updateDropView +{ + +} + @end + + +@implementation VLCDropEnabledBox + +- (void)awakeFromNib +{ + [self registerForDraggedTypes:[NSArray arrayWithObject: NSFilenamesPboardType]]; +} + +- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender +{ + if ((NSDragOperationGeneric & [sender draggingSourceOperationMask]) == NSDragOperationGeneric) + return NSDragOperationGeneric; + + return NSDragOperationNone; +} + +- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender +{ + return YES; +} + +- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender +{ + NSPasteboard *o_paste = [sender draggingPasteboard]; + NSArray *o_types = [NSArray arrayWithObject: NSFilenamesPboardType]; + NSString *o_desired_type = [o_paste availableTypeFromArray:o_types]; + NSData *o_carried_data = [o_paste dataForType:o_desired_type]; + + if( o_carried_data ) + { + if( [o_desired_type isEqualToString:NSFilenamesPboardType] ) + { + NSArray *o_values = [[o_paste propertyListForType: NSFilenamesPboardType] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; + + if ([o_values count] > 0) + { + id VLCCAS = [VLCConvertAndSave sharedInstance]; + [VLCCAS setMRL: [NSString stringWithUTF8String:make_URI([[o_values objectAtIndex:0] UTF8String], NULL)]]; + [VLCCAS updateDropView]; + return YES; + } + } + } + return NO; +} + +- (void)concludeDragOperation:(id <NSDraggingInfo>)sender +{ + [self setNeedsDisplay:YES]; +} + +@end \ No newline at end of file _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
