[vlc-commits] [Git][videolan/vlc][master] 3 commits: macosx: Make VLCLibraryTableViewDataSource protocol take tableView in addition...
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu Dec 15 09:18:57 UTC 2022
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
b987e12b by Claudio Cambra at 2022-12-15T06:30:56+00:00
macosx: Make VLCLibraryTableViewDataSource protocol take tableView in addition to row for libraryItemAtRow
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
c55d5416 by Claudio Cambra at 2022-12-15T06:30:56+00:00
macosx: Make VLCLibraryVideoTableViewDataSource compliant with VLCLibraryTableViewDataSource protocol
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
2edd2534 by Claudio Cambra at 2022-12-15T06:30:56+00:00
macosx: Do not make video library groupings table view a VLCLibraryTableView
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
7 changed files:
- modules/gui/macosx/UI/VLCLibraryWindow.xib
- modules/gui/macosx/library/VLCLibraryTableView.h
- modules/gui/macosx/library/VLCLibraryTableView.m
- modules/gui/macosx/library/audio-library/VLCLibraryAlbumTracksDataSource.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.m
- modules/gui/macosx/library/video-library/VLCLibraryVideoTableViewDataSource.h
- modules/gui/macosx/library/video-library/VLCLibraryVideoTableViewDataSource.m
Changes:
=====================================
modules/gui/macosx/UI/VLCLibraryWindow.xib
=====================================
@@ -811,7 +811,7 @@
<rect key="frame" x="0.0" y="0.0" width="230" height="808"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
- <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" viewBased="YES" id="ceR-Vd-9ss" customClass="VLCLibraryTableView">
+ <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" viewBased="YES" id="ceR-Vd-9ss">
<rect key="frame" x="0.0" y="0.0" width="230" height="808"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="2"/>
=====================================
modules/gui/macosx/library/VLCLibraryTableView.h
=====================================
@@ -28,7 +28,8 @@ NS_ASSUME_NONNULL_BEGIN
@protocol VLCLibraryTableViewDataSource <NSTableViewDataSource>
-- (id<VLCMediaLibraryItemProtocol>)libraryItemAtRow:(NSInteger)row;
+- (id<VLCMediaLibraryItemProtocol>)libraryItemAtRow:(NSInteger)row
+ forTableView:(NSTableView *)tableView;
@end
@@ -36,4 +37,4 @@ NS_ASSUME_NONNULL_BEGIN
@end
-NS_ASSUME_NONNULL_END
\ No newline at end of file
+NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/VLCLibraryTableView.m
=====================================
@@ -65,7 +65,7 @@
return;
}
- [_menuController setRepresentedItem:[(id<VLCLibraryTableViewDataSource>)self.dataSource libraryItemAtRow:self.clickedRow]];
+ [_menuController setRepresentedItem:[(id<VLCLibraryTableViewDataSource>)self.dataSource libraryItemAtRow:self.clickedRow forTableView:self]];
}
- at end
\ No newline at end of file
+ at end
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAlbumTracksDataSource.m
=====================================
@@ -68,11 +68,13 @@ const CGFloat VLCLibraryTracksRowHeight = 40.;
cellView.identifier = VLCAudioLibrarySongCellIdentifier;
}
- cellView.representedMediaItem = (VLCMediaLibraryMediaItem *)[self libraryItemAtRow:row];
+ cellView.representedMediaItem = (VLCMediaLibraryMediaItem *)[self libraryItemAtRow:row
+ forTableView:tableView];
return cellView;
}
- (id<VLCMediaLibraryItemProtocol>)libraryItemAtRow:(NSInteger)row
+ forTableView:(NSTableView *)tableView
{
return _tracks[row];
}
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.m
=====================================
@@ -150,17 +150,20 @@ static NSString *VLCLibraryYearSortDescriptorKey = @"VLCLibraryYearSortDescripto
const NSInteger collectionSelectionTableViewRow = _collectionSelectionTableView.selectedRow;
if(collectionSelectionTableViewRow >= 0 && !_collectionSelectionTableView.hidden) {
- _selectedCollectionSelectionTableViewItem = [self libraryItemAtRow:collectionSelectionTableViewRow];
+ _selectedCollectionSelectionTableViewItem = [self libraryItemAtRow:collectionSelectionTableViewRow
+ forTableView:_collectionSelectionTableView];
}
const NSInteger groupSelectionTableViewRow = _groupSelectionTableView.selectedRow;
if(groupSelectionTableViewRow >= 0 && !_groupSelectionTableView.hidden) {
- _selectedGroupSelectionTableViewItem = [self libraryItemAtRow:groupSelectionTableViewRow];
+ _selectedGroupSelectionTableViewItem = [self libraryItemAtRow:groupSelectionTableViewRow
+ forTableView:_groupSelectionTableView];
}
const NSInteger songsTableViewRow = _songsTableView.selectedRow;
if(songsTableViewRow >= 0 && !_songsTableView.hidden) {
- _selectedSongTableViewItem = [self libraryItemAtRow:songsTableViewRow];
+ _selectedSongTableViewItem = [self libraryItemAtRow:songsTableViewRow
+ forTableView:_songsTableView];
}
}
@@ -435,7 +438,7 @@ static NSString *VLCLibraryYearSortDescriptorKey = @"VLCLibraryYearSortDescripto
// and we use a vanilla NSTableView created in the VLCLibraryWindow XIB for it
if ([tableView.identifier isEqualToString:@"VLCLibrarySongsTableViewIdentifier"]) {
const NSString * const columnIdentifier = tableColumn.identifier;
- const VLCMediaLibraryMediaItem * const mediaItem = [self libraryItemAtRow:row];
+ const VLCMediaLibraryMediaItem * const mediaItem = [self libraryItemAtRow:row forTableView:tableView];
const VLCMediaLibraryAlbum * const album = [VLCMediaLibraryAlbum albumWithID:mediaItem.albumID];
const VLCMediaLibraryGenre * const genre = [VLCMediaLibraryGenre genreWithID:mediaItem.genreID];
@@ -445,7 +448,7 @@ static NSString *VLCLibraryYearSortDescriptorKey = @"VLCLibraryYearSortDescripto
if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewSongPlayingColumnIdentifier]) {
VLCLibrarySongsTableViewSongPlayingTableCellView *cellView = (VLCLibrarySongsTableViewSongPlayingTableCellView*)[tableView makeViewWithIdentifier:@"VLCLibrarySongsTableViewSongPlayingTableCellViewIdentifier" owner:self];
NSAssert(cellView, @"Unexpectedly received null cellview");
- cellView.representedMediaItem = [self libraryItemAtRow:row];
+ cellView.representedMediaItem = (VLCMediaLibraryMediaItem *)mediaItem;
return cellView;
} else if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewTitleColumnIdentifier]) {
cellIdentifier = @"VLCLibrarySongsTableViewTitleTableCellViewIdentifier";
@@ -484,11 +487,12 @@ static NSString *VLCLibraryYearSortDescriptorKey = @"VLCLibraryYearSortDescripto
cellView.identifier = VLCAudioLibraryCellIdentifier;
}
- [cellView setRepresentedItem:[self libraryItemAtRow:row]];
+ [cellView setRepresentedItem:[self libraryItemAtRow:row forTableView:tableView]];
return cellView;
}
- (id<VLCMediaLibraryItemProtocol>)libraryItemAtRow:(NSInteger)row
+ forTableView:(NSTableView *)tableView
{
return _displayedCollection[row];
}
@@ -683,11 +687,12 @@ viewForSupplementaryElementOfKind:(NSCollectionViewSupplementaryElementKind)kind
cellView.identifier = VLCAudioLibraryCellIdentifier;
}
- cellView.representedAlbum = (VLCMediaLibraryAlbum *)[self libraryItemAtRow:row];
+ cellView.representedAlbum = (VLCMediaLibraryAlbum *)[self libraryItemAtRow:row forTableView:tableView];
return cellView;
}
- (id<VLCMediaLibraryItemProtocol>)libraryItemAtRow:(NSInteger)row
+ forTableView:(NSTableView *)tableView
{
return _representedListOfAlbums[row];
}
=====================================
modules/gui/macosx/library/video-library/VLCLibraryVideoTableViewDataSource.h
=====================================
@@ -22,11 +22,13 @@
#import <Cocoa/Cocoa.h>
+#import "library/VLCLibraryTableView.h"
+
NS_ASSUME_NONNULL_BEGIN
@class VLCLibraryModel;
- at interface VLCLibraryVideoTableViewDataSource : NSObject <NSTableViewDataSource, NSTableViewDelegate>
+ at interface VLCLibraryVideoTableViewDataSource : NSObject <VLCLibraryTableViewDataSource, NSTableViewDelegate>
@property (readwrite, assign) VLCLibraryModel *libraryModel;
@property (readwrite, assign) NSTableView *groupsTableView;
=====================================
modules/gui/macosx/library/video-library/VLCLibraryVideoTableViewDataSource.m
=====================================
@@ -156,4 +156,22 @@
}
}
+- (id<VLCMediaLibraryItemProtocol>)libraryItemAtRow:(NSInteger)row
+ forTableView:(NSTableView *)tableView
+{
+ if (tableView == _groupSelectionTableView && _groupsTableView.selectedRow > -1) {
+ switch(_groupsTableView.selectedRow + 1) { // Group 0 is invalid so add one
+ case VLCLibraryVideoRecentsGroup:
+ return _recentsArray[row];
+ case VLCLibraryVideoLibraryGroup:
+ return _libraryArray[row];
+ default:
+ NSAssert(1, @"Reached unreachable case for video library section");
+ break;
+ }
+ }
+
+ return nil;
+}
+
@end
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4d238946ca2a699ce69ea78c50f1d451dc770333...2edd2534edc88927b2334fe77a037872f4414798
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4d238946ca2a699ce69ea78c50f1d451dc770333...2edd2534edc88927b2334fe77a037872f4414798
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list