Commit e52a34f9 authored by David Fuhrmann's avatar David Fuhrmann

macosx: playlist context menu: Improve add files

Only enqueue the files. Add them under the selected item.

refs #17726
parent 06959ed0
......@@ -1074,7 +1074,9 @@
- (IBAction)intfOpenFile:(id)sender
{
[[[VLCMain sharedInstance] open] openFile];
[[[VLCMain sharedInstance] open] openFileWithAction:^(NSArray *files) {
[[[VLCMain sharedInstance] playlist] addPlaylistItems:files];
}];
}
- (IBAction)intfOpenFileGeneric:(id)sender
......
......@@ -230,5 +230,6 @@
- (IBAction)panelCancel:(id)sender;
- (IBAction)panelOk:(id)sender;
- (void)openFile;
- (void)openFileWithAction:(void (^)(NSArray *files))action;
@end
......@@ -610,7 +610,7 @@ static NSString *kCaptureTabViewId = @"capture";
[self openTarget: kCaptureTabViewId];
}
- (void)openFile
- (void)openFileWithAction:(void (^)(NSArray *files))action;
{
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
[openPanel setAllowsMultipleSelection: YES];
......@@ -633,13 +633,11 @@ static NSString *kCaptureTabViewId = @"capture";
if (!psz_uri)
continue;
dictionary = [NSDictionary dictionaryWithObject:toNSStr(psz_uri) forKey:@"ITEM_URL"];
NSLog(@"dict: %@", dictionary);
free(psz_uri);
[array addObject: dictionary];
}
NSLog(@"adding %@", array);
[[[VLCMain sharedInstance] playlist] addPlaylistItems:array];
action(array);
}
}
......
......@@ -74,9 +74,9 @@
/**
* Simplified version to add new items at the end of the current playlist
* @param o_array array of items. Each item is a Dictionary with meta info.
* @param array array of items. Each item is a Dictionary with meta info.
*/
- (void)addPlaylistItems:(NSArray*)o_array;
- (void)addPlaylistItems:(NSArray*)array;
/**
* Add new items to playlist, with the possibility to check if an item can be added
......
......@@ -341,7 +341,24 @@
- (IBAction)addFilesToPlaylist:(id)sender
{
[[[VLCMain sharedInstance] open] openFile];
NSIndexSet *selectedRows = [_outlineView selectedRowIndexes];
NSInteger position = -1;
VLCPLItem *parentItem = [[self model] rootItem];
if (selectedRows.count >= 1) {
position = selectedRows.firstIndex + 1;
parentItem = [_outlineView itemAtRow:selectedRows.firstIndex];
if ([parentItem parent] != nil)
parentItem = [parentItem parent];
}
[[[VLCMain sharedInstance] open] openFileWithAction:^(NSArray *files) {
[self addPlaylistItems:files
withParentItemId:[parentItem plItemId]
atPos:position
startPlayback:NO];
}];
}
- (IBAction)deleteItem:(id)sender
......
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