macosx: Add mediaSourceInputItemAtRow method to VLCMediaSourceDataSource

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
This commit is contained in:
Claudio Cambra 2023-01-05 00:07:10 +01:00 committed by Steve Lhomme
parent 61d1019fa2
commit b6ff85a803
2 changed files with 20 additions and 6 deletions

View File

@ -24,6 +24,7 @@
NS_ASSUME_NONNULL_BEGIN
@class VLCInputItem;
@class VLCInputNode;
@class VLCMediaSource;
@ -37,6 +38,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (readwrite) BOOL gridViewMode;
- (void)setupViews;
- (VLCInputItem*)mediaSourceInputItemAtRow:(NSInteger)tableViewRow;
@end

View File

@ -120,12 +120,7 @@
cellView.identifier = @"VLCMediaSourceTableViewCellIdentifier";
}
VLCInputNode *rootNode = _nodeToDisplay;
NSArray *nodeChildren = rootNode.children;
VLCInputNode *childNode = nodeChildren[row];
VLCInputItem *childRootInput = childNode.inputItem;
cellView.representedInputItem = childRootInput;
cellView.representedInputItem = [self mediaSourceInputItemAtRow:row];
return cellView;
}
@ -156,6 +151,23 @@
[self performActionForNode:childNode allowPlayback:YES];
}
- (VLCInputItem*)mediaSourceInputItemAtRow:(NSInteger)tableViewRow
{
if (_nodeToDisplay == nil) {
return nil;
}
VLCInputNode *rootNode = _nodeToDisplay;
NSArray *nodeChildren = rootNode.children;
if (nodeChildren == nil || nodeChildren.count == 0) {
return nil;
}
VLCInputNode *childNode = nodeChildren[tableViewRow];
return childNode.inputItem;
}
#pragma mark - generic actions
- (void)performActionForNode:(VLCInputNode *)node allowPlayback:(BOOL)allowPlayback