Commit 22495438 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: prepare drag & drop support for the Convert and Save panel

parent 823af4bc
......@@ -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
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment