Browse Source

macosx: Implement updateHeaderForTableView in abstract grouping data source

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
pull/201/head
Claudio Cambra 5 months ago
committed by Felix Paul Kühne
parent
commit
712be53585
  1. 2
      modules/gui/macosx/library/VLCLibraryAbstractGroupingDataSource.h
  2. 25
      modules/gui/macosx/library/VLCLibraryAbstractGroupingDataSource.m

2
modules/gui/macosx/library/VLCLibraryAbstractGroupingDataSource.h

@ -24,6 +24,7 @@
#import "library/VLCLibraryCollectionViewDataSource.h"
#import "library/VLCLibraryMasterDetailViewTableViewDataSource.h"
#import "library/VLCLibraryGroupHeaderDelegate.h"
NS_ASSUME_NONNULL_BEGIN
@ -36,6 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (readwrite, weak) NSCollectionView *collectionView;
@property (readwrite, weak) NSTableView *masterTableView;
@property (readwrite, weak) NSTableView *detailTableView;
@property (readwrite, weak, nullable) id<VLCLibraryGroupHeaderDelegate> headerDelegate;
- (void)reloadData;

25
modules/gui/macosx/library/VLCLibraryAbstractGroupingDataSource.m

@ -51,6 +51,7 @@
[self.masterTableView reloadData];
[self.detailTableView reloadData];
[self.collectionView reloadData];
[self updateHeaderForTableView:self.masterTableView];
}
- (NSUInteger)indexOfMediaItem:(const int64_t)libraryId inArray:(NSArray const *)array
@ -105,6 +106,30 @@
return nil;
}
- (void)updateHeaderForTableView:(NSTableView *)tableView
{
if (self.headerDelegate == nil) {
return;
}
VLCLibraryRepresentedItem *representedItem = nil;
NSString *fallbackTitle = nil;
NSString *fallbackDetail = nil;
const NSInteger selectedRow = tableView.selectedRow;
if (selectedRow != -1) {
const id<VLCMediaLibraryItemProtocol> selectedItem = [self libraryItemAtRow:selectedRow forTableView:tableView];
representedItem = [[VLCLibraryRepresentedItem alloc] initWithItem:selectedItem parentType:self.currentParentType];
fallbackTitle = selectedItem.displayString;
fallbackDetail = selectedItem.primaryDetailString;
}
[self.headerDelegate updateHeaderForTableView:tableView
withRepresentedItem:representedItem
fallbackTitle:fallbackTitle
fallbackDetail:fallbackDetail];
}
- (NSInteger)rowForLibraryItem:(id<VLCMediaLibraryItemProtocol>)libraryItem
{
if (libraryItem == nil) {

Loading…
Cancel
Save