]> git.sesse.net Git - vlc/blobdiff - modules/gui/macosx/ConvertAndSave.m
macosx: implement simpler and generic drop view for all drag / drop operations
[vlc] / modules / gui / macosx / ConvertAndSave.m
index f504d3c0bb98d38bf36eb0a5c08d44cb28bc7747..2f5d9b0758b8789b5b0199726709d9469c40f25d 100644 (file)
 
 @synthesize MRL=_MRL, outputDestination=_outputDestination, profileNames=_profileNames, profileValueList=_profileValueList, currentProfile=_currentProfile;
 
+@synthesize vidBitrate, vidFramerate, audBitrate, audChannels;
+
 static VLCConvertAndSave *_o_sharedInstance = nil;
 
 #pragma mark -
 #pragma mark Initialization
 
-+ (void)initialize{
++ (void)initialize
+{
     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
 
     /* We are using the same format as the Qt4 intf here:
@@ -84,11 +87,11 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
                                  @"ts;1;1;0;mp2v;800;1;0;0;0;mpga;128;2;44100;0;0",
                                  @"asf;1;1;0;WMV2;800;1;0;0;0;wma2;128;2;44100;0;0",
                                  @"asf;1;1;0;DIV3;800;1;0;0;0;mp3;128;2;44100;0;0",
-                                 @"ogg;1;1;0;none;800;1;0;0;0;vorb;128;2;44100;none;0",
-                                 @"raw;1;1;0;none;800;1;0;0;0;mp3;128;2;44100;none;0",
-                                 @"mp4;1;1;0;none;800;1;0;0;0;mpga;128;2;44100;none;0",
-                                 @"raw;1;1;0;none;800;1;0;0;0;flac;128;2;44100;none;0",
-                                 @"wav;1;1;0;none;800;1;0;0;0;s16l;128;2;44100;none;0", nil];
+                                 @"ogg;0;1;0;none;800;1;0;0;0;vorb;128;2;44100;none;0",
+                                 @"raw;0;1;0;none;800;1;0;0;0;mp3;128;2;44100;none;0",
+                                 @"mp4;0;1;0;none;800;1;0;0;0;mpga;128;2;44100;none;0",
+                                 @"raw;0;1;0;none;800;1;0;0;0;flac;128;2;44100;none;0",
+                                 @"wav;0;1;0;none;800;1;0;0;0;s16l;128;2;44100;none;0", nil];
 
     NSArray * defaultProfileNames = [[NSArray alloc] initWithObjects:
                                      @"Video - H.264 + MP3 (MP4)",
@@ -146,8 +149,8 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
 
 - (void)awakeFromNib
 {
-    [_window setTitle: _NS("Convert & Save")];
-    [_ok_btn setTitle: _NS("Save")];
+    [_window setTitle: _NS("Convert & Stream")];
+    [_ok_btn setTitle: _NS("Go!")];
     [_drop_lbl setStringValue: _NS("Drop media here")];
     [_drop_btn setTitle: _NS("Open media...")];
     [_profile_lbl setStringValue: _NS("Choose Profile")];
@@ -184,10 +187,11 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
     [_customize_aud_codec_lbl setStringValue: _NS("Codec")];
     [_customize_aud_bitrate_lbl setStringValue: _NS("Bitrate")];
     [_customize_aud_channels_lbl setStringValue: _NS("Channels")];
-    [_customize_aud_samplerate_lbl setStringValue: _NS("Sample Rate")];
+    [_customize_aud_samplerate_lbl setStringValue: _NS("Samplerate")];
     [_customize_subs_ckb setTitle: _NS("Subtitles")];
     [_customize_subs_overlay_ckb setTitle: _NS("Overlay subtitles on the video")];
-    [_stream_ok_btn setTitle:_NS("Close")];
+    [_stream_ok_btn setTitle: _NS("Apply")];
+    [_stream_cancel_btn setTitle: _NS("Cancel")];
     [_stream_destination_lbl setStringValue:_NS("Stream Destination")];
     [_stream_announcement_lbl setStringValue:_NS("Stream Announcement")];
     [_stream_type_lbl setStringValue:_NS("Type")];
@@ -228,7 +232,7 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
     _subsCodecs = [[NSArray alloc] initWithObjects:
                    [NSArray arrayWithObjects:@"DVB subtitle", @"T.140", nil],
                    [NSArray arrayWithObjects:@"dvbs", @"t140", nil],
-                   nil];
+                    nil];
 
     [_customize_vid_codec_pop removeAllItems];
     [_customize_vid_scale_pop removeAllItems];
@@ -257,6 +261,10 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
 
     [_ok_btn setEnabled: NO];
 
+    // setup drop view
+    [_drop_box enablePlaylistItems];
+    [_drop_box setDropHandler: self];
+
     [self resetCustomizationSheetBasedOnProfile:[self.profileValueList objectAtIndex:0]];
 }
 
@@ -273,7 +281,18 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
 
 - (IBAction)finalizePanel:(id)sender
 {
-    // HTTP, TODO: mux checking, since only MPEG PS, MPEG TS, MPEG 1, OGG, RAW and ASF are allowed
+    if (b_streaming) {
+        if ([[[_stream_type_pop selectedItem] title] isEqualToString:@"HTTP"]) {
+            NSString *muxformat = [self.currentProfile objectAtIndex:0];
+            if ([muxformat isEqualToString:@"wav"] || [muxformat isEqualToString:@"mov"] || [muxformat isEqualToString:@"mp4"] || [muxformat isEqualToString:@"mkv"]) {
+                NSBeginInformationalAlertSheet(_NS("Invalid container format for HTTP streaming"), _NS("OK"), @"", @"", _window,
+                                               nil, nil, nil, nil,
+                                               _NS("Media encapsulated as %@ cannot be streamed through the HTTP protocol for technical reasons."),
+                                               [[self currentEncapsulationFormatAsFileExtension:YES] uppercaseString]);
+                return;
+            }
+        }
+    }
 
     playlist_t * p_playlist = pl_Get(VLCIntf);
 
@@ -325,7 +344,8 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
 - (IBAction)switchProfile:(id)sender
 {
     NSUInteger index = [_profile_pop indexOfSelectedItem];
-    if (index < ([self.profileValueList count] - 1))
+    // last index is "custom"
+    if (index <= ([self.profileValueList count] - 1))
         [self resetCustomizationSheetBasedOnProfile:[self.profileValueList objectAtIndex:index]];
 }
 
@@ -442,6 +462,12 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
 
 - (IBAction)closeStreamPanel:(id)sender
 {
+    [_stream_panel orderOut:sender];
+    [NSApp endSheet: _stream_panel];
+
+    if (sender == _stream_cancel_btn)
+        return;
+
     /* provide a summary of the user selections */
     NSMutableString * labelContent = [[NSMutableString alloc] initWithFormat:_NS("%@ stream to %@:%@"), [_stream_type_pop titleOfSelectedItem], [_stream_address_fld stringValue], [_stream_port_fld stringValue]];
 
@@ -452,6 +478,13 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
     [labelContent release];
 
     /* catch obvious errors */
+    if (![[_stream_address_fld stringValue] length] > 0) {
+        NSBeginInformationalAlertSheet(_NS("No Address given"),
+                                       _NS("OK"), @"", @"", _stream_panel, nil, nil, nil, nil,
+                                       @"%@", _NS("In order to stream, a valid destination address is required."));
+        return;
+    }
+
     if ([_stream_sap_ckb state] && ![[_stream_channel_fld stringValue] length] > 0) {
         NSBeginInformationalAlertSheet(_NS("No Channel Name given"),
                                        _NS("OK"), @"", @"", _stream_panel, nil, nil, nil, nil,
@@ -469,9 +502,6 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
     /* store destination for further reference and update UI */
     [self setOutputDestination: [_stream_address_fld stringValue]];
     [self updateOKButton];
-
-    [_stream_panel orderOut:sender];
-    [NSApp endSheet: _stream_panel];
 }
 
 - (IBAction)streamTypeToggle:(id)sender
@@ -522,7 +552,7 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
 {
     NSPasteboard *paste = [sender draggingPasteboard];
-    NSArray *types = [NSArray arrayWithObjects: NSFilenamesPboardType, @"VLCPlaylistItemPboardType", nil];
+    NSArray *types = [NSArray arrayWithObjects:NSFilenamesPboardType, @"VLCPlaylistItemPboardType", nil];
     NSString *desired_type = [paste availableTypeFromArray: types];
     NSData *carried_data = [paste dataForType: desired_type];
 
@@ -550,7 +580,7 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
                     if (p_item) {
                         if (p_item->p_input) {
                             if (p_item->p_input->psz_uri != nil) {
-                                [self setMRL: [NSString stringWithFormat:@"%s", p_item->p_input->psz_uri]];
+                                [self setMRL: toNSStr(p_item->p_input->psz_uri)];
                                 [self updateDropView];
                                 [self updateOKButton];
 
@@ -580,8 +610,9 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
             [workArray addObject:text];
             [self setProfileNames:[[[NSArray alloc] initWithArray:workArray] autorelease]];
             [workArray release];
+
             workArray = [[NSMutableArray alloc] initWithArray:self.profileValueList];
-            [workArray addObject:[[[NSArray alloc] initWithArray:self.currentProfile] autorelease]];
+            [workArray addObject:[self.currentProfile componentsJoinedByString:@";"]];
             [self setProfileValueList:[[[NSArray alloc] initWithArray:workArray] autorelease]];
             [workArray release];
 
@@ -610,13 +641,7 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
         [workArray release];
 
         /* update UI */
-        [_profile_pop removeAllItems];
-        [_profile_pop addItemsWithTitles:self.profileNames];
-        [_profile_pop addItemWithTitle:_NS("Custom")];
-        [[_profile_pop menu] addItem:[NSMenuItem separatorItem]];
-        [_profile_pop addItemWithTitle:_NS("Organize Profiles...")];
-        [[_profile_pop lastItem] setTarget: self];
-        [[_profile_pop lastItem] setAction: @selector(deleteProfileAction:)];
+        [self recreateProfilePopup];
 
         /* update internals */
         [self switchProfile:self];
@@ -624,6 +649,27 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
     }
 }
 
+- (IBAction)videoSettingsChanged:(id)sender
+{
+    bool enableSettings = [_customize_vid_ckb state] == NSOnState && [_customize_vid_keep_ckb state] == NSOffState;
+    [_customize_vid_settings_box enableSubviews:enableSettings];
+    [_customize_vid_keep_ckb setEnabled:[_customize_vid_ckb state] == NSOnState];
+}
+
+- (IBAction)audioSettingsChanged:(id)sender
+{
+    bool enableSettings = [_customize_aud_ckb state] == NSOnState && [_customize_aud_keep_ckb state] == NSOffState;
+    [_customize_aud_settings_box enableSubviews:enableSettings];
+    [_customize_aud_keep_ckb setEnabled:[_customize_aud_ckb state] == NSOnState];
+}
+
+- (IBAction)subSettingsChanged:(id)sender
+{
+    bool enableSettings = [_customize_subs_ckb state] == NSOnState;
+    [_customize_subs_overlay_ckb setEnabled:enableSettings];
+    [_customize_subs_pop setEnabled:enableSettings];
+}
+
 # pragma mark -
 # pragma mark Private Functionality
 - (void)updateDropView
@@ -676,13 +722,13 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
     [_customize_vid_ckb setState:[[components objectAtIndex:1] intValue]];
     [_customize_aud_ckb setState:[[components objectAtIndex:2] intValue]];
     [_customize_subs_ckb setState:[[components objectAtIndex:3] intValue]];
-    [_customize_vid_bitrate_fld setStringValue:[components objectAtIndex:5]];
+    [self setVidBitrate:[[components objectAtIndex:5] intValue]];
     [_customize_vid_scale_pop selectItemWithTitle:[components objectAtIndex:6]];
-    [_customize_vid_framerate_fld setStringValue:[components objectAtIndex:7]];
+    [self setVidFramerate:[[components objectAtIndex:7] intValue]];
     [_customize_vid_width_fld setStringValue:[components objectAtIndex:8]];
     [_customize_vid_height_fld setStringValue:[components objectAtIndex:9]];
-    [_customize_aud_bitrate_fld setStringValue:[components objectAtIndex:11]];
-    [_customize_aud_channels_fld setStringValue:[components objectAtIndex:12]];
+    [self setAudBitrate:[[components objectAtIndex:11] intValue]];
+    [self setAudChannels:[[components objectAtIndex:12] intValue]];
     [_customize_aud_samplerate_pop selectItemWithTitle:[components objectAtIndex:13]];
     [_customize_subs_overlay_ckb setState:[[components objectAtIndex:15] intValue]];
 
@@ -690,7 +736,9 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
     NSArray * tempArray = [_videoCodecs objectAtIndex:1];
     NSUInteger count = [tempArray count];
     NSString * searchString = [components objectAtIndex:4];
-    if ([searchString isEqualToString:@"none"] || [searchString isEqualToString:@"0"]) {
+    int videoKeep = [searchString isEqualToString:@"copy"];
+    [_customize_vid_keep_ckb setState:videoKeep];
+    if ([searchString isEqualToString:@"none"] || [searchString isEqualToString:@"0"] || videoKeep) {
         [_customize_vid_codec_pop selectItemAtIndex:-1];
     } else {
         for (NSUInteger x = 0; x < count; x++) {
@@ -704,7 +752,9 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
     tempArray = [_audioCodecs objectAtIndex:1];
     count = [tempArray count];
     searchString = [components objectAtIndex:10];
-    if ([searchString isEqualToString:@"none"] || [searchString isEqualToString:@"0"]) {
+    int audioKeep = [searchString isEqualToString:@"copy"];
+    [_customize_aud_keep_ckb setState:audioKeep];
+    if ([searchString isEqualToString:@"none"] || [searchString isEqualToString:@"0"] || audioKeep) {
         [_customize_aud_codec_pop selectItemAtIndex:-1];
     } else {
         for (NSUInteger x = 0; x < count; x++) {
@@ -729,6 +779,10 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
         }
     }
 
+    [self videoSettingsChanged:nil];
+    [self audioSettingsChanged:nil];
+    [self subSettingsChanged:nil];
+
     [self setCurrentProfile: [[[NSMutableArray alloc] initWithArray: [profileString componentsSeparatedByString:@";"]] autorelease]];
 }
 
@@ -841,10 +895,11 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
 - (NSString *)composedOptions
 {
     NSMutableString *composedOptions = [[NSMutableString alloc] initWithString:@":sout=#transcode{"];
+    BOOL haveVideo = YES;
     if ([[self.currentProfile objectAtIndex:1] intValue]) {
         // video is enabled
+        if (![[self.currentProfile objectAtIndex:4] isEqualToString:@"copy"]) {
         [composedOptions appendFormat:@"vcodec=%@", [self.currentProfile objectAtIndex:4]];
-        if (![[self.currentProfile objectAtIndex:4] isEqualToString:@"none"]) {
             if ([[self.currentProfile objectAtIndex:5] intValue] > 0) // bitrate
                 [composedOptions appendFormat:@",vb=%@", [self.currentProfile objectAtIndex:5]];
             if ([[self.currentProfile objectAtIndex:6] floatValue] > 0.) // scale
@@ -855,25 +910,37 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
                 [composedOptions appendFormat:@",width=%@", [self.currentProfile objectAtIndex:8]];
             if ([[self.currentProfile objectAtIndex:9] intValue] > 0) // height
                 [composedOptions appendFormat:@",height=%@", [self.currentProfile objectAtIndex:9]];
+        } else {
+            haveVideo = NO;
         }
+    } else {
+        [composedOptions appendString:@"vcodec=none"];
     }
+
+    BOOL haveAudio = YES;
     if ([[self.currentProfile objectAtIndex:2] intValue]) {
         // audio is enabled
-
-        // add another comma in case video is enabled
-        if ([[self.currentProfile objectAtIndex:1] intValue])
-            [composedOptions appendString:@","];
-
-        [composedOptions appendFormat:@"acodec=%@", [self.currentProfile objectAtIndex:10]];
-        if (![[self.currentProfile objectAtIndex:10] isEqualToString:@"none"]) {
+        if (![[self.currentProfile objectAtIndex:10] isEqualToString:@"copy"]) {
+            if(haveVideo)
+                [composedOptions appendString:@","];
+            [composedOptions appendFormat:@"acodec=%@", [self.currentProfile objectAtIndex:10]];
             [composedOptions appendFormat:@",ab=%@", [self.currentProfile objectAtIndex:11]]; // bitrate
             [composedOptions appendFormat:@",channels=%@", [self.currentProfile objectAtIndex:12]]; // channel number
             [composedOptions appendFormat:@",samplerate=%@", [self.currentProfile objectAtIndex:13]]; // sample rate
+        } else {
+            haveAudio = NO;
         }
+    } else {
+        if(haveVideo)
+            [composedOptions appendString:@","];
+
+        [composedOptions appendString:@"acodec=none"];
     }
     if ([self.currentProfile objectAtIndex:3]) {
+        if(haveVideo || haveAudio)
+            [composedOptions appendString:@","];
         // subtitles enabled
-        [composedOptions appendFormat:@",scodec=%@", [self.currentProfile objectAtIndex:14]];
+        [composedOptions appendFormat:@"scodec=%@", [self.currentProfile objectAtIndex:14]];
         if ([[self.currentProfile objectAtIndex:15] intValue])
             [composedOptions appendFormat:@",soverlay"];
     }
@@ -884,7 +951,7 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
         [composedOptions appendFormat:@"}:standard{mux=%@", [self.currentProfile objectAtIndex:0]];
 
         // add output destination
-        [composedOptions appendFormat:@",dst=%@,access=file}", _outputDestination];
+        [composedOptions appendFormat:@",access=file{no-overwrite},dst=%@}", _outputDestination];
     } else {
         /* streaming */
         if ([[[_stream_type_pop selectedItem] title] isEqualToString:@"RTP"])
@@ -932,23 +999,39 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
     [self.currentProfile addObject: [NSString stringWithFormat:@"%li", [_customize_vid_ckb state]]];
     [self.currentProfile addObject: [NSString stringWithFormat:@"%li", [_customize_aud_ckb state]]];
     [self.currentProfile addObject: [NSString stringWithFormat:@"%li", [_customize_subs_ckb state]]];
-    i = [_customize_vid_codec_pop indexOfSelectedItem];
-    if (i >= 0)
-        [self.currentProfile addObject: [[_videoCodecs objectAtIndex:1] objectAtIndex:i]];
-    else
-        [self.currentProfile addObject: @"none"];
-    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [_customize_vid_bitrate_fld intValue]]];
+    
+    NSString *videoCodec;
+    if([_customize_vid_keep_ckb state] == NSOnState)
+        videoCodec = @"copy";
+    else {
+        i = [_customize_vid_codec_pop indexOfSelectedItem];
+        if (i >= 0)
+            videoCodec = [[_videoCodecs objectAtIndex:1] objectAtIndex:i];
+        else
+            videoCodec = @"none";
+    }
+    [self.currentProfile addObject: videoCodec];
+
+    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [self vidBitrate]]];
     [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [[[_customize_vid_scale_pop selectedItem] title] intValue]]];
-    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [_customize_vid_framerate_fld intValue]]];
+    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [self vidFramerate]]];
     [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [_customize_vid_width_fld intValue]]];
     [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [_customize_vid_height_fld intValue]]];
-    i = [_customize_aud_codec_pop indexOfSelectedItem];
-    if (i >= 0)
-        [self.currentProfile addObject: [[_audioCodecs objectAtIndex:1] objectAtIndex:i]];
-    else
-        [self.currentProfile addObject: @"none"];
-    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [_customize_aud_bitrate_fld intValue]]];
-    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [_customize_aud_channels_fld intValue]]];
+
+    NSString *audioCodec;
+    if([_customize_aud_keep_ckb state] == NSOnState)
+        audioCodec = @"copy";
+    else {
+        i = [_customize_aud_codec_pop indexOfSelectedItem];
+        if (i >= 0)
+            audioCodec = [[_audioCodecs objectAtIndex:1] objectAtIndex:i];
+        else
+            audioCodec = @"none";
+    }
+    [self.currentProfile addObject: audioCodec];
+    
+    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [self audBitrate]]];
+    [self.currentProfile addObject: [NSString stringWithFormat:@"%i", [self audChannels]]];
     [self.currentProfile addObject: [[_customize_aud_samplerate_pop selectedItem] title]];
     i = [_customize_subs_pop indexOfSelectedItem];
     if (i >= 0)
@@ -978,130 +1061,3 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
 }
 
 @end
-
-# pragma mark -
-# pragma mark Drag and drop handling
-
-@implementation VLCDropEnabledBox
-
-- (void)awakeFromNib
-{
-    [self registerForDraggedTypes:[NSArray arrayWithObjects: NSFilenamesPboardType, @"VLCPlaylistItemPboardType", nil]];
-}
-
-- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
-{
-    b_activeDragAndDrop = YES;
-    [self setNeedsDisplay:YES];
-
-    [[NSCursor dragCopyCursor] set];
-
-    if ((NSDragOperationGeneric & [sender draggingSourceOperationMask]) == NSDragOperationGeneric)
-        return NSDragOperationGeneric;
-
-    return NSDragOperationNone;
-}
-
-- (void)draggingEnded:(id < NSDraggingInfo >)sender
-{
-    [[NSCursor arrowCursor] set];
-    b_activeDragAndDrop = NO;
-    [self setNeedsDisplay:YES];
-}
-
-- (void)draggingExited:(id < NSDraggingInfo >)sender
-{
-    [[NSCursor arrowCursor] set];
-    b_activeDragAndDrop = NO;
-    [self setNeedsDisplay:YES];
-}
-
-- (void)drawRect:(NSRect)dirtyRect
-{
-    if (b_activeDragAndDrop) {
-        [[NSColor colorWithCalibratedRed:(.154/.255) green:(.154/.255) blue:(.154/.255) alpha:1.] setFill];
-        NSRect frameRect = [[self contentView] bounds];
-        frameRect.origin.x += 10;
-        frameRect.origin.y += 10;
-        frameRect.size.width -= 17;
-        frameRect.size.height -= 17;
-        NSFrameRectWithWidthUsingOperation(frameRect, 4., NSCompositeHighlight);
-    }
-
-    [super drawRect:dirtyRect];
-}
-
-- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
-{
-    return YES;
-}
-
-- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
-{
-    return [[VLCConvertAndSave sharedInstance] performDragOperation: sender];
-}
-
-- (void)concludeDragOperation:(id <NSDraggingInfo>)sender
-{
-    [self setNeedsDisplay:YES];
-}
-
-@end
-
-@implementation VLCDropEnabledImageView
-
-- (void)awakeFromNib
-{
-    [self registerForDraggedTypes:[NSArray arrayWithObjects: NSFilenamesPboardType, @"VLCPlaylistItemPboardType", nil]];
-}
-
-- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
-{
-    return [[[self superview] superview] draggingEntered:sender];
-}
-
-- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
-{
-    return YES;
-}
-
-- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
-{
-    return [[VLCConvertAndSave sharedInstance] performDragOperation: sender];
-}
-
-- (void)concludeDragOperation:(id <NSDraggingInfo>)sender
-{
-    [self setNeedsDisplay:YES];
-}
-
-@end
-
-@implementation VLCDropEnabledButton
-
-- (void)awakeFromNib
-{
-    [self registerForDraggedTypes:[NSArray arrayWithObjects: NSFilenamesPboardType, @"VLCPlaylistItemPboardType", nil]];
-}
-
-- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
-{
-    return [[[self superview] superview] draggingEntered:sender];
-}
-
-- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
-{
-    return YES;
-}
-
-- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
-{
-    return [[VLCConvertAndSave sharedInstance] performDragOperation: sender];
-}
-
-- (void)concludeDragOperation:(id <NSDraggingInfo>)sender
-{
-    [self setNeedsDisplay:YES];
-}
-
-@end