[vlc-commits] [Git][videolan/vlc][master] 26 commits: macosx: Add a VLCLibraryAudioTableViewDelegate
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat Mar 25 17:22:29 UTC 2023
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
c4d0ef83 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Add a VLCLibraryAudioTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
3f07a9c2 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Add table item view delegation to VLCLibraryAudioTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
77ee38d4 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Add tableViewSelectionDidChange handling in VLCLibraryAudioTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
5d83c720 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Replace audio data source table view delegation with new VLCLibraryAudioTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
acdc5a79 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Add a VLCLibraryAudioGroupTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
083c3f8e by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Add heightOfRow method to VLCLibraryAudioGroupTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
f2b92efe by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Implement viewForTableColum in VLCLibraryAudioGroupTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
902fbc52 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Implement heightOfRow for VLCLibraryAudioGroupTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
41afb1b5 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Replace all audio group table views' delegation using VLCLibraryAudioGroupDataSource with VLCLibraryAudioGroupTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
71a06b68 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Add VLCLibraryAlbumTracksTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
63bd60ec by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Implement viewForTableColumn in VLCLibraryAlbumTracksTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
c8351209 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Replace album tracks table views delegation use of VLCLibraryAlbumTracksDataSource with VLCLibraryAlbumTracksTableViewDelegate
- - - - -
69e09d04 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Add VLCLibraryVideoTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
7f28c752 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Implement viewForTableColumn in VLCLibraryVideoTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
e1d5ba08 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Implement tableViewSelectionDidChange in VLCLibraryVideoTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
80da84b0 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Replace table view delegation for video view tables using VLCLibraryVideoTableViewDataSource with VLCLibraryVideoTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
9669442a by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Add VLCLibraryTableCellViewProtocol
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
c5ec7f73 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Adapt various table cell views to conform to VLCLibraryTableCellViewProtocol
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
27b0bf84 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Add VLCLibraryTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
f50f8114 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Provide cellViewType in VLCLibraryTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
5fc3a7f4 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Add base viewForTableColumn implementation in VLCLibraryTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
500d3506 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Remove unneeded VLCLibraryAlbumTracksTableViewDelegate method in favour of just using VLCLibraryTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
ccfe32b3 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Simplify VLCLibraryAudioGroupTableViewDelegate by using super method
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
8af7ebc1 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Remove need for custom cellview by using super method in VLCLibraryAudioTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
e5578407 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Use the super method for most common path to generate cellview in VLCLibraryVideoTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
3faaa1e1 by Claudio Cambra at 2023-03-25T13:04:59+00:00
macosx: Cover case where table cell view not registered in table view in VLCLibraryTableViewDelegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
30 changed files:
- extras/package/macosx/VLC.xcodeproj/project.pbxproj
- modules/gui/macosx/Makefile.am
- modules/gui/macosx/library/VLCLibraryTableCellView.h
- + modules/gui/macosx/library/VLCLibraryTableCellViewProtocol.h
- + modules/gui/macosx/library/VLCLibraryTableViewDelegate.h
- + modules/gui/macosx/library/VLCLibraryTableViewDelegate.m
- modules/gui/macosx/library/audio-library/VLCLibraryAlbumTableCellView.h
- modules/gui/macosx/library/audio-library/VLCLibraryAlbumTableCellView.m
- modules/gui/macosx/library/audio-library/VLCLibraryAlbumTracksDataSource.h
- modules/gui/macosx/library/audio-library/VLCLibraryAlbumTracksDataSource.m
- + modules/gui/macosx/library/audio-library/VLCLibraryAlbumTracksTableViewDelegate.h
- + modules/gui/macosx/library/audio-library/VLCLibraryAlbumTracksTableViewDelegate.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.h
- modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupDataSource.h
- modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupDataSource.m
- + modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupTableViewDelegate.h
- + modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupTableViewDelegate.m
- + modules/gui/macosx/library/audio-library/VLCLibraryAudioTableViewDelegate.h
- + modules/gui/macosx/library/audio-library/VLCLibraryAudioTableViewDelegate.m
- modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
- modules/gui/macosx/library/audio-library/VLCLibraryCollectionViewAlbumSupplementaryDetailView.m
- modules/gui/macosx/library/audio-library/VLCLibraryCollectionViewAudioGroupSupplementaryDetailView.m
- modules/gui/macosx/library/audio-library/VLCLibrarySongTableCellView.h
- modules/gui/macosx/library/audio-library/VLCLibrarySongTableCellView.m
- modules/gui/macosx/library/video-library/VLCLibraryVideoTableViewDataSource.h
- modules/gui/macosx/library/video-library/VLCLibraryVideoTableViewDataSource.m
- + modules/gui/macosx/library/video-library/VLCLibraryVideoTableViewDelegate.h
- + modules/gui/macosx/library/video-library/VLCLibraryVideoTableViewDelegate.m
- modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m
Changes:
=====================================
extras/package/macosx/VLC.xcodeproj/project.pbxproj
=====================================
@@ -104,6 +104,11 @@
53B447F8293BB47B00857588 /* VLCLibraryVideoCollectionViewsStackViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B447EF293BB47A00857588 /* VLCLibraryVideoCollectionViewsStackViewController.m */; };
53B447F9293BB47B00857588 /* VLCLibraryVideoTableViewDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B447F3293BB47A00857588 /* VLCLibraryVideoTableViewDataSource.m */; };
53B447FA293BB47B00857588 /* VLCLibraryVideoGroupDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B447F4293BB47A00857588 /* VLCLibraryVideoGroupDescriptor.m */; };
+ 53ED472329C74D1F00795DB1 /* VLCLibraryAudioTableViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 53ED472229C74D1F00795DB1 /* VLCLibraryAudioTableViewDelegate.m */; };
+ 53ED472629C78FE700795DB1 /* VLCLibraryAudioGroupTableViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 53ED472529C78FE700795DB1 /* VLCLibraryAudioGroupTableViewDelegate.m */; };
+ 53ED472B29C8FF9D00795DB1 /* VLCLibraryAlbumTracksTableViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 53ED472A29C8FF9D00795DB1 /* VLCLibraryAlbumTracksTableViewDelegate.m */; };
+ 53ED472E29C907C200795DB1 /* VLCLibraryVideoTableViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 53ED472D29C907C200795DB1 /* VLCLibraryVideoTableViewDelegate.m */; };
+ 53ED473629CA4F3400795DB1 /* VLCLibraryTableViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 53ED473529CA4F3400795DB1 /* VLCLibraryTableViewDelegate.m */; };
53F0E92D299B002300491D49 /* VLCInputNodePathControlItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 53F0E92C299B002300491D49 /* VLCInputNodePathControlItem.m */; };
53F0E930299B17DF00491D49 /* VLCInputNodePathControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 53F0E92F299B17DF00491D49 /* VLCInputNodePathControl.m */; };
6B0292E61F43256300A50082 /* VLCBottomBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B0292E51F43256300A50082 /* VLCBottomBarView.m */; };
@@ -307,6 +312,17 @@
53B447F3293BB47A00857588 /* VLCLibraryVideoTableViewDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryVideoTableViewDataSource.m; sourceTree = "<group>"; };
53B447F4293BB47A00857588 /* VLCLibraryVideoGroupDescriptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryVideoGroupDescriptor.m; sourceTree = "<group>"; };
53B447F5293BB47B00857588 /* VLCLibraryVideoCollectionViewsStackViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VLCLibraryVideoCollectionViewsStackViewController.h; sourceTree = "<group>"; };
+ 53ED472129C74D1F00795DB1 /* VLCLibraryAudioTableViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryAudioTableViewDelegate.h; sourceTree = "<group>"; };
+ 53ED472229C74D1F00795DB1 /* VLCLibraryAudioTableViewDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryAudioTableViewDelegate.m; sourceTree = "<group>"; };
+ 53ED472429C78FE700795DB1 /* VLCLibraryAudioGroupTableViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryAudioGroupTableViewDelegate.h; sourceTree = "<group>"; };
+ 53ED472529C78FE700795DB1 /* VLCLibraryAudioGroupTableViewDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryAudioGroupTableViewDelegate.m; sourceTree = "<group>"; };
+ 53ED472929C8FF9D00795DB1 /* VLCLibraryAlbumTracksTableViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryAlbumTracksTableViewDelegate.h; sourceTree = "<group>"; };
+ 53ED472A29C8FF9D00795DB1 /* VLCLibraryAlbumTracksTableViewDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryAlbumTracksTableViewDelegate.m; sourceTree = "<group>"; };
+ 53ED472C29C907C200795DB1 /* VLCLibraryVideoTableViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryVideoTableViewDelegate.h; sourceTree = "<group>"; };
+ 53ED472D29C907C200795DB1 /* VLCLibraryVideoTableViewDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryVideoTableViewDelegate.m; sourceTree = "<group>"; };
+ 53ED473729CAF67F00795DB1 /* VLCLibraryTableCellViewProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryTableCellViewProtocol.h; sourceTree = "<group>"; };
+ 53ED473429CA4F3400795DB1 /* VLCLibraryTableViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryTableViewDelegate.h; sourceTree = "<group>"; };
+ 53ED473529CA4F3400795DB1 /* VLCLibraryTableViewDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryTableViewDelegate.m; sourceTree = "<group>"; };
53F0E92B299B002300491D49 /* VLCInputNodePathControlItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCInputNodePathControlItem.h; sourceTree = "<group>"; };
53F0E92C299B002300491D49 /* VLCInputNodePathControlItem.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCInputNodePathControlItem.m; sourceTree = "<group>"; };
53F0E92E299B17DF00491D49 /* VLCInputNodePathControl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCInputNodePathControl.h; sourceTree = "<group>"; };
@@ -1174,8 +1190,11 @@
7D22A8F322BC14F80063ECD2 /* VLCLibrarySortingMenuController.m */,
7DE2F0452282D5D10040DD0A /* VLCLibraryTableCellView.h */,
7DE2F0462282D5D10040DD0A /* VLCLibraryTableCellView.m */,
+ 53ED473729CAF67F00795DB1 /* VLCLibraryTableCellViewProtocol.h */,
536283E0291146BC00640C15 /* VLCLibraryTableView.h */,
536283DE291146BC00640C15 /* VLCLibraryTableView.m */,
+ 53ED473429CA4F3400795DB1 /* VLCLibraryTableViewDelegate.h */,
+ 53ED473529CA4F3400795DB1 /* VLCLibraryTableViewDelegate.m */,
7D713D302201AE350042BEB7 /* VLCLibraryWindow.h */,
7D713D312201AE350042BEB7 /* VLCLibraryWindow.m */,
5362550B293FD639005D64FA /* VLCLibraryWindowController.h */,
@@ -1319,10 +1338,16 @@
7DE82E7822843781002D341A /* VLCLibraryAlbumTableCellView.m */,
536283DC291146BC00640C15 /* VLCLibraryAlbumTracksDataSource.h */,
536283DF291146BC00640C15 /* VLCLibraryAlbumTracksDataSource.m */,
+ 53ED472929C8FF9D00795DB1 /* VLCLibraryAlbumTracksTableViewDelegate.h */,
+ 53ED472A29C8FF9D00795DB1 /* VLCLibraryAlbumTracksTableViewDelegate.m */,
7DE2F0422282C84A0040DD0A /* VLCLibraryAudioDataSource.h */,
7DE2F0432282C84A0040DD0A /* VLCLibraryAudioDataSource.m */,
53903D3829576ED500D0B308 /* VLCLibraryAudioGroupDataSource.h */,
53903D3929576ED500D0B308 /* VLCLibraryAudioGroupDataSource.m */,
+ 53ED472429C78FE700795DB1 /* VLCLibraryAudioGroupTableViewDelegate.h */,
+ 53ED472529C78FE700795DB1 /* VLCLibraryAudioGroupTableViewDelegate.m */,
+ 53ED472129C74D1F00795DB1 /* VLCLibraryAudioTableViewDelegate.h */,
+ 53ED472229C74D1F00795DB1 /* VLCLibraryAudioTableViewDelegate.m */,
536283E8291146BC00640C15 /* VLCLibraryCollectionViewAlbumSupplementaryDetailView.h */,
536283E1291146BC00640C15 /* VLCLibraryCollectionViewAlbumSupplementaryDetailView.m */,
536283E7291146BC00640C15 /* VLCLibraryCollectionViewAudioGroupSupplementaryDetailView.h */,
@@ -1350,6 +1375,8 @@
53B447F4293BB47A00857588 /* VLCLibraryVideoGroupDescriptor.m */,
53B447EE293BB47A00857588 /* VLCLibraryVideoTableViewDataSource.h */,
53B447F3293BB47A00857588 /* VLCLibraryVideoTableViewDataSource.m */,
+ 53ED472C29C907C200795DB1 /* VLCLibraryVideoTableViewDelegate.h */,
+ 53ED472D29C907C200795DB1 /* VLCLibraryVideoTableViewDelegate.m */,
);
path = "video-library";
sourceTree = "<group>";
@@ -1878,6 +1905,7 @@
1CCC89002078A3D500E5626F /* PopupPanel.xib in Sources */,
5317FE04294E3DD3001702F0 /* VLCLibraryCollectionViewDelegate.m in Sources */,
536EFC39295E521600F4CB13 /* VLCLibraryVideoViewController.m in Sources */,
+ 53ED472B29C8FF9D00795DB1 /* VLCLibraryAlbumTracksTableViewDelegate.m in Sources */,
53628402291147C500640C15 /* VLCBasicView.m in Sources */,
7DFBDCAB2269E77F00B700A5 /* VLCLibraryModel.m in Sources */,
1CCC89012078A3D500E5626F /* Preferences.xib in Sources */,
@@ -1900,6 +1928,7 @@
1CCC89062078A3D500E5626F /* TimeSelectionPanel.xib in Sources */,
5307A6F82969904D001E0C6A /* VLCLibraryMediaSourceViewController.m in Sources */,
6B81662C1EBFC38100C26F1B /* VLCUIWidgets.m in Sources */,
+ 53ED472329C74D1F00795DB1 /* VLCLibraryAudioTableViewDelegate.m in Sources */,
6B0AB0F11F1AC8B3003A1B4E /* VLCSliderCell.m in Sources */,
6B8166291EBFC34300C26F1B /* VLCDefaultValueSlider.m in Sources */,
6B81662A1EBFC34300C26F1B /* VLCDefaultValueSliderCell.m in Sources */,
@@ -1912,6 +1941,7 @@
1C3113EF1E508C7600D4DD76 /* VLCRendererDiscovery.m in Sources */,
1C3113F11E508C7600D4DD76 /* VLCRendererItem.m in Sources */,
1C3113F31E508C7600D4DD76 /* VLCRendererMenuController.m in Sources */,
+ 53ED473629CA4F3400795DB1 /* VLCLibraryTableViewDelegate.m in Sources */,
6B4D50931E7979CB004479B5 /* VLCSimplePrefsWindow.m in Sources */,
6B397C4F216C8EB200403ED0 /* NSString+Helpers.m in Sources */,
1C31138E1E508C6900D4DD76 /* VLCAboutWindowController.m in Sources */,
@@ -1931,6 +1961,7 @@
1C3113961E508C6900D4DD76 /* applescript.m in Sources */,
5325C57D29302E6800B2B63A /* VLCLibraryAudioViewController.m in Sources */,
1C3113981E508C6900D4DD76 /* VLCAudioEffectsWindowController.m in Sources */,
+ 53ED472629C78FE700795DB1 /* VLCLibraryAudioGroupTableViewDelegate.m in Sources */,
536283F9291146BC00640C15 /* VLCLibraryCollectionViewFlowLayout.m in Sources */,
6BBBF9851F7B257100B404CD /* VLCLogMessage.m in Sources */,
7D445D8E2203375100263D34 /* VLCPlaylistMenuController.m in Sources */,
@@ -2014,6 +2045,7 @@
1C3113E51E508C6900D4DD76 /* VLCInformationWindowController.m in Sources */,
6B7F1FDF1F07DA920002BDD8 /* VLCHexNumberFormatter.m in Sources */,
7DB40D2A20CBCEB500F63173 /* VLCMainMenu.m in Sources */,
+ 53ED472E29C907C200795DB1 /* VLCLibraryVideoTableViewDelegate.m in Sources */,
1C3113E91E508C6900D4DD76 /* VLCScrollingClipView.m in Sources */,
7DB40D2D20CBCEC200F63173 /* VLCStatusBarIcon.m in Sources */,
1C3113ED1E508C6900D4DD76 /* VLCTimeSelectionPanelController.m in Sources */,
=====================================
modules/gui/macosx/Makefile.am
=====================================
@@ -122,8 +122,11 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/library/VLCLibrarySortingMenuController.m \
gui/macosx/library/VLCLibraryTableView.h \
gui/macosx/library/VLCLibraryTableView.m \
+ gui/macosx/library/VLCLibraryTableViewDelegate.h \
+ gui/macosx/library/VLCLibraryTableViewDelegate.m \
gui/macosx/library/VLCLibraryTableCellView.h \
gui/macosx/library/VLCLibraryTableCellView.m \
+ gui/macosx/library/VLCLibraryTableCellViewProtocol.h \
gui/macosx/library/VLCLibraryUIUnits.h \
gui/macosx/library/VLCLibraryUIUnits.m \
gui/macosx/library/VLCLibraryWindow.h \
@@ -142,14 +145,22 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/library/video-library/VLCLibraryVideoGroupDescriptor.m \
gui/macosx/library/video-library/VLCLibraryVideoTableViewDataSource.h \
gui/macosx/library/video-library/VLCLibraryVideoTableViewDataSource.m \
+ gui/macosx/library/video-library/VLCLibraryVideoTableViewDelegate.h \
+ gui/macosx/library/video-library/VLCLibraryVideoTableViewDelegate.m \
gui/macosx/library/audio-library/VLCLibraryAlbumTableCellView.h \
gui/macosx/library/audio-library/VLCLibraryAlbumTableCellView.m \
gui/macosx/library/audio-library/VLCLibraryAlbumTracksDataSource.h \
gui/macosx/library/audio-library/VLCLibraryAlbumTracksDataSource.m \
+ gui/macosx/library/audio-library/VLCLibraryAlbumTracksTableViewDelegate.h \
+ gui/macosx/library/audio-library/VLCLibraryAlbumTracksTableViewDelegate.m \
gui/macosx/library/audio-library/VLCLibraryAudioDataSource.h \
gui/macosx/library/audio-library/VLCLibraryAudioDataSource.m \
gui/macosx/library/audio-library/VLCLibraryAudioGroupDataSource.h \
gui/macosx/library/audio-library/VLCLibraryAudioGroupDataSource.m \
+ gui/macosx/library/audio-library/VLCLibraryAudioGroupTableViewDelegate.h \
+ gui/macosx/library/audio-library/VLCLibraryAudioGroupTableViewDelegate.m \
+ gui/macosx/library/audio-library/VLCLibraryAudioTableViewDelegate.h \
+ gui/macosx/library/audio-library/VLCLibraryAudioTableViewDelegate.m \
gui/macosx/library/audio-library/VLCLibraryAudioViewController.h \
gui/macosx/library/audio-library/VLCLibraryAudioViewController.m \
gui/macosx/library/audio-library/VLCLibraryCollectionViewAlbumSupplementaryDetailView.h \
=====================================
modules/gui/macosx/library/VLCLibraryTableCellView.h
=====================================
@@ -22,6 +22,8 @@
#import <Cocoa/Cocoa.h>
+#import "library/VLCLibraryTableCellViewProtocol.h"
+
NS_ASSUME_NONNULL_BEGIN
@class VLCImageView;
@@ -29,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol VLCMediaLibraryItemProtocol;
@class VLCInputItem;
- at interface VLCLibraryTableCellView : NSTableCellView
+ at interface VLCLibraryTableCellView : NSTableCellView<VLCLibraryTableCellViewProtocol>
+ (instancetype)fromNibWithOwner:(id)owner;
=====================================
modules/gui/macosx/library/VLCLibraryTableCellViewProtocol.h
=====================================
@@ -0,0 +1,31 @@
+/*****************************************************************************
+ * VLCLibraryTableCellViewProtocol.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import "VLCLibraryTableCellViewProtocol.h"
+
+ at protocol VLCMediaLibraryItemProtocol;
+
+ at protocol VLCLibraryTableCellViewProtocol<NSObject>
+
+- (void)setRepresentedItem:(id<VLCMediaLibraryItemProtocol>)libraryItem;
+
+ at end
=====================================
modules/gui/macosx/library/VLCLibraryTableViewDelegate.h
=====================================
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * VLCLibraryTableViewDelegate.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+ at interface VLCLibraryTableViewDelegate : NSObject <NSTableViewDelegate>
+
+ at property (readwrite, assign) NSString *cellViewIdentifier;
+ at property (readwrite, assign) Class cellViewClass;
+
+ at end
+
+NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/VLCLibraryTableViewDelegate.m
=====================================
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * VLCLibraryTableViewDelegate.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import "VLCLibraryTableViewDelegate.h"
+
+#import "library/VLCLibraryTableCellView.h"
+#import "library/VLCLibraryTableCellViewProtocol.h"
+#import "library/VLCLibraryTableView.h"
+#import "library/VLCLibraryDataTypes.h"
+
+ at implementation VLCLibraryTableViewDelegate
+
+- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
+{
+ if (![tableView.dataSource conformsToProtocol:@protocol(VLCLibraryTableViewDataSource)]) {
+ return nil;
+ }
+
+ NSObject<VLCLibraryTableViewDataSource> * const vlcDataSource = (NSObject<VLCLibraryTableViewDataSource>*)tableView.dataSource;
+ NSAssert(vlcDataSource != nil, @"Should be a valid data source");
+
+ NSView<VLCLibraryTableCellViewProtocol> * cellView = (NSView<VLCLibraryTableCellViewProtocol> *)[tableView makeViewWithIdentifier:self.cellViewIdentifier owner:self];
+
+ if (cellView == nil && [self.cellViewClass respondsToSelector:@selector(fromNibWithOwner:)]) {
+ cellView = [self.cellViewClass fromNibWithOwner:self];
+ cellView.identifier = self.cellViewIdentifier;
+ }
+
+ [cellView setRepresentedItem:[vlcDataSource libraryItemAtRow:row forTableView:tableView]];
+ return cellView;
+}
+
+ at end
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAlbumTableCellView.h
=====================================
@@ -22,13 +22,15 @@
#import <Cocoa/Cocoa.h>
+#import "library/VLCLibraryTableCellViewProtocol.h"
+
NS_ASSUME_NONNULL_BEGIN
@class VLCImageView;
@class VLCTrackingView;
@class VLCMediaLibraryAlbum;
- at interface VLCLibraryAlbumTableCellView : NSTableCellView
+ at interface VLCLibraryAlbumTableCellView : NSTableCellView<VLCLibraryTableCellViewProtocol>
extern NSString *VLCAudioLibraryCellIdentifier;
extern NSString *VLCLibraryAlbumTableCellTableViewColumnIdentifier;
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAlbumTableCellView.m
=====================================
@@ -39,6 +39,7 @@
#import "library/VLCLibraryUIUnits.h"
#import "library/audio-library/VLCLibraryAlbumTracksDataSource.h"
+#import "library/audio-library/VLCLibraryAlbumTracksTableViewDelegate.h"
NSString *VLCAudioLibraryCellIdentifier = @"VLCAudioLibraryCellIdentifier";
NSString *VLCLibraryAlbumTableCellTableViewColumnIdentifier = @"VLCLibraryAlbumTableCellTableViewColumnIdentifier";
@@ -48,6 +49,7 @@ const CGFloat VLCLibraryAlbumTableCellViewDefaultHeight = 168.;
{
VLCLibraryController *_libraryController;
VLCLibraryAlbumTracksDataSource *_tracksDataSource;
+ VLCLibraryAlbumTracksTableViewDelegate *_tracksTableViewDelegate;
VLCLibraryTableView *_tracksTableView;
NSTableColumn *_column;
}
@@ -141,8 +143,9 @@ const CGFloat VLCLibraryAlbumTableCellViewDefaultHeight = 168.;
_tracksTableView.backgroundColor = [NSColor clearColor];
_tracksDataSource = [[VLCLibraryAlbumTracksDataSource alloc] init];
+ _tracksTableViewDelegate = [[VLCLibraryAlbumTracksTableViewDelegate alloc] init];
_tracksTableView.dataSource = _tracksDataSource;
- _tracksTableView.delegate = _tracksDataSource;
+ _tracksTableView.delegate = _tracksTableViewDelegate;
_tracksTableView.doubleAction = @selector(tracksTableViewDoubleClickAction:);
_tracksTableView.target = self;
@@ -232,6 +235,14 @@ const CGFloat VLCLibraryAlbumTableCellViewDefaultHeight = 168.;
[_tracksTableView reloadData];
}
+- (void)setRepresentedItem:(id<VLCMediaLibraryItemProtocol>)libraryItem
+{
+ VLCMediaLibraryAlbum * const album = (VLCMediaLibraryAlbum *)libraryItem;
+ if (album != nil) {
+ [self setRepresentedAlbum:album];
+ }
+}
+
- (void)tracksTableViewDoubleClickAction:(id)sender
{
if (!_libraryController) {
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAlbumTracksDataSource.h
=====================================
@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
@class VLCMediaLibraryAlbum;
- at interface VLCLibraryAlbumTracksDataSource : NSObject <VLCLibraryTableViewDataSource, NSTableViewDelegate>
+ at interface VLCLibraryAlbumTracksDataSource : NSObject <VLCLibraryTableViewDataSource>
extern const CGFloat VLCLibraryTracksRowHeight;
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAlbumTracksDataSource.m
=====================================
@@ -22,17 +22,7 @@
#import "VLCLibraryAlbumTracksDataSource.h"
-#import "extensions/NSFont+VLCAdditions.h"
-#import "extensions/NSString+Helpers.h"
-#import "views/VLCImageView.h"
-#import "views/VLCTrackingView.h"
-#import "main/VLCMain.h"
-#import "library/VLCLibraryController.h"
#import "library/VLCLibraryDataTypes.h"
-#import "library/VLCLibraryTableCellView.h"
-#import "library/VLCLibraryTableView.h"
-#import "library/audio-library/VLCLibraryAlbumTracksDataSource.h"
-#import "library/audio-library/VLCLibrarySongTableCellView.h"
const CGFloat VLCLibraryTracksRowHeight = 40.;
@@ -59,20 +49,6 @@ const CGFloat VLCLibraryTracksRowHeight = 40.;
return 0;
}
-- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
-{
- VLCLibrarySongTableCellView *cellView = [tableView makeViewWithIdentifier:VLCAudioLibrarySongCellIdentifier owner:self];
-
- if (cellView == nil) {
- cellView = [VLCLibrarySongTableCellView fromNibWithOwner:self];
- cellView.identifier = VLCAudioLibrarySongCellIdentifier;
- }
-
- cellView.representedMediaItem = (VLCMediaLibraryMediaItem *)[self libraryItemAtRow:row
- forTableView:tableView];
- return cellView;
-}
-
- (id<VLCMediaLibraryItemProtocol>)libraryItemAtRow:(NSInteger)row
forTableView:(NSTableView *)tableView
{
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAlbumTracksTableViewDelegate.h
=====================================
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * VLCLibraryAlbumTracksTableViewDelegate.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+#import "library/VLCLibraryTableViewDelegate.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+ at interface VLCLibraryAlbumTracksTableViewDelegate : VLCLibraryTableViewDelegate
+
+ at end
+
+NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAlbumTracksTableViewDelegate.m
=====================================
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * VLCLibraryAlbumTracksTableViewDelegate.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import "VLCLibraryAlbumTracksTableViewDelegate.h"
+
+#import "library/audio-library/VLCLibrarySongTableCellView.h"
+
+ at implementation VLCLibraryAlbumTracksTableViewDelegate
+
+- (instancetype)init
+{
+ self = [super init];
+ if (self) {
+ self.cellViewIdentifier = VLCAudioLibrarySongCellIdentifier;
+ self.cellViewClass = [VLCLibrarySongTableCellView class];
+ }
+ return self;
+}
+
+
+ at end
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.h
=====================================
@@ -38,7 +38,23 @@ typedef NS_ENUM(NSUInteger, VLCAudioLibrarySegment) {
VLCAudioLibraryGenresSegment
};
- at interface VLCLibraryAudioDataSource : NSObject <VLCLibraryTableViewDataSource, NSTableViewDelegate, VLCLibraryCollectionViewDataSource>
+extern NSString * const VLCLibrarySongsTableViewSongPlayingColumnIdentifier;
+extern NSString * const VLCLibrarySongsTableViewTitleColumnIdentifier;
+extern NSString * const VLCLibrarySongsTableViewDurationColumnIdentifier;
+extern NSString * const VLCLibrarySongsTableViewArtistColumnIdentifier;
+extern NSString * const VLCLibrarySongsTableViewAlbumColumnIdentifier;
+extern NSString * const VLCLibrarySongsTableViewGenreColumnIdentifier;
+extern NSString * const VLCLibrarySongsTableViewPlayCountColumnIdentifier;
+extern NSString * const VLCLibrarySongsTableViewYearColumnIdentifier;
+
+extern NSString * const VLCLibraryTitleSortDescriptorKey;
+extern NSString * const VLCLibraryDurationSortDescriptorKey;
+extern NSString * const VLCLibraryArtistSortDescriptorKey;
+extern NSString * const VLCLibraryAlbumSortDescriptorKey;
+extern NSString * const VLCLibraryPlayCountSortDescriptorKey;
+extern NSString * const VLCLibraryYearSortDescriptorKey;
+
+ at interface VLCLibraryAudioDataSource : NSObject <VLCLibraryTableViewDataSource, VLCLibraryCollectionViewDataSource>
@property (readwrite, assign) VLCLibraryModel *libraryModel;
@property (readwrite, assign) VLCLibraryAudioGroupDataSource *audioGroupDataSource;
@@ -53,7 +69,10 @@ typedef NS_ENUM(NSUInteger, VLCAudioLibrarySegment) {
- (void)setup;
- (void)setupCollectionView:(NSCollectionView *)collectionView;
+
- (void)reloadData;
+- (void)tableView:(NSTableView * const)tableView selectRow:(NSInteger)row;
+
@end
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.m
=====================================
@@ -50,21 +50,21 @@
#import "views/VLCImageView.h"
#import "views/VLCSubScrollView.h"
-static NSString *VLCLibrarySongsTableViewSongPlayingColumnIdentifier = @"VLCLibrarySongsTableViewSongPlayingColumnIdentifier";
-static NSString *VLCLibrarySongsTableViewTitleColumnIdentifier = @"VLCLibrarySongsTableViewTitleColumnIdentifier";
-static NSString *VLCLibrarySongsTableViewDurationColumnIdentifier = @"VLCLibrarySongsTableViewDurationColumnIdentifier";
-static NSString *VLCLibrarySongsTableViewArtistColumnIdentifier = @"VLCLibrarySongsTableViewArtistColumnIdentifier";
-static NSString *VLCLibrarySongsTableViewAlbumColumnIdentifier = @"VLCLibrarySongsTableViewAlbumColumnIdentifier";
-static NSString *VLCLibrarySongsTableViewGenreColumnIdentifier = @"VLCLibrarySongsTableViewGenreColumnIdentifier";
-static NSString *VLCLibrarySongsTableViewPlayCountColumnIdentifier = @"VLCLibrarySongsTableViewPlayCountColumnIdentifier";
-static NSString *VLCLibrarySongsTableViewYearColumnIdentifier = @"VLCLibrarySongsTableViewYearColumnIdentifier";
-
-static NSString *VLCLibraryTitleSortDescriptorKey = @"VLCLibraryTitleSortDescriptorKey";
-static NSString *VLCLibraryDurationSortDescriptorKey = @"VLCLibraryDurationSortDescriptorKey";
-static NSString *VLCLibraryArtistSortDescriptorKey = @"VLCLibraryArtistSortDescriptorKey";
-static NSString *VLCLibraryAlbumSortDescriptorKey = @"VLCLibraryAlbumSortDescriptorKey";
-static NSString *VLCLibraryPlayCountSortDescriptorKey = @"VLCLibraryPlayCountSortDescriptorKey";
-static NSString *VLCLibraryYearSortDescriptorKey = @"VLCLibraryYearSortDescriptorKey";
+NSString * const VLCLibrarySongsTableViewSongPlayingColumnIdentifier = @"VLCLibrarySongsTableViewSongPlayingColumnIdentifier";
+NSString * const VLCLibrarySongsTableViewTitleColumnIdentifier = @"VLCLibrarySongsTableViewTitleColumnIdentifier";
+NSString * const VLCLibrarySongsTableViewDurationColumnIdentifier = @"VLCLibrarySongsTableViewDurationColumnIdentifier";
+NSString * const VLCLibrarySongsTableViewArtistColumnIdentifier = @"VLCLibrarySongsTableViewArtistColumnIdentifier";
+NSString * const VLCLibrarySongsTableViewAlbumColumnIdentifier = @"VLCLibrarySongsTableViewAlbumColumnIdentifier";
+NSString * const VLCLibrarySongsTableViewGenreColumnIdentifier = @"VLCLibrarySongsTableViewGenreColumnIdentifier";
+NSString * const VLCLibrarySongsTableViewPlayCountColumnIdentifier = @"VLCLibrarySongsTableViewPlayCountColumnIdentifier";
+NSString * const VLCLibrarySongsTableViewYearColumnIdentifier = @"VLCLibrarySongsTableViewYearColumnIdentifier";
+
+NSString * const VLCLibraryTitleSortDescriptorKey = @"VLCLibraryTitleSortDescriptorKey";
+NSString * const VLCLibraryDurationSortDescriptorKey = @"VLCLibraryDurationSortDescriptorKey";
+NSString * const VLCLibraryArtistSortDescriptorKey = @"VLCLibraryArtistSortDescriptorKey";
+NSString * const VLCLibraryAlbumSortDescriptorKey = @"VLCLibraryAlbumSortDescriptorKey";
+NSString * const VLCLibraryPlayCountSortDescriptorKey = @"VLCLibraryPlayCountSortDescriptorKey";
+NSString * const VLCLibraryYearSortDescriptorKey = @"VLCLibraryYearSortDescriptorKey";
// TODO: Add sorting by genre
@interface VLCLibraryAudioDataSource ()
@@ -495,73 +495,6 @@ static NSString *VLCLibraryYearSortDescriptorKey = @"VLCLibraryYearSortDescripto
return [self displayAllArtistsGenresTableEntry] ? numItems + 1 : numItems;
}
-- (NSView *)tableView:(NSTableView *)tableView
- viewForTableColumn:(NSTableColumn *)tableColumn
- row:(NSInteger)row
-{
- // The table view for songs in the list view mode of the audio library is different from the other audio groupings
- // and we use a vanilla NSTableView created in the VLCLibraryWindow XIB for it
- if ([tableView.identifier isEqualToString:@"VLCLibrarySongsTableViewIdentifier"] &&
- _currentParentType == VLC_ML_PARENT_UNKNOWN) {
- const NSString * const columnIdentifier = tableColumn.identifier;
- const VLCMediaLibraryMediaItem * const mediaItem = [self libraryItemAtRow:row forTableView:tableView];
-
- if (!mediaItem) {
- return nil;
- }
-
- const VLCMediaLibraryAlbum * const album = [VLCMediaLibraryAlbum albumWithID:mediaItem.albumID];
- const VLCMediaLibraryGenre * const genre = [VLCMediaLibraryGenre genreWithID:mediaItem.genreID];
-
- NSString *cellText = @"";
- NSString *cellIdentifier = @"";
-
- if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewSongPlayingColumnIdentifier]) {
- VLCLibrarySongsTableViewSongPlayingTableCellView *cellView = (VLCLibrarySongsTableViewSongPlayingTableCellView*)[tableView makeViewWithIdentifier:@"VLCLibrarySongsTableViewSongPlayingTableCellViewIdentifier" owner:self];
- NSAssert(cellView, @"Unexpectedly received null cellview");
- cellView.representedMediaItem = (VLCMediaLibraryMediaItem *)mediaItem;
- return cellView;
- } else if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewTitleColumnIdentifier]) {
- cellIdentifier = @"VLCLibrarySongsTableViewTitleTableCellViewIdentifier";
- cellText = mediaItem.title;
- } else if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewDurationColumnIdentifier]) {
- cellIdentifier = @"VLCLibrarySongsTableViewDurationTableCellViewIdentifier";
- cellText = mediaItem.durationString;
- } else if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewArtistColumnIdentifier]) {
- cellIdentifier = @"VLCLibrarySongsTableViewArtistTableCellViewIdentifier";
- cellText = album.artistName.length == 0 ? @"" : album.artistName;
- } else if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewAlbumColumnIdentifier]) {
- cellIdentifier = @"VLCLibrarySongsTableViewAlbumTableCellViewIdentifier";
- cellText = album.title.length == 0 ? @"" : album.title;
- } else if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewGenreColumnIdentifier]) {
- cellIdentifier = @"VLCLibrarySongsTableViewGenreTableCellViewIdentifier";
- cellText = genre.name.length == 0 ? @"" : genre.name;
- } else if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewPlayCountColumnIdentifier]) {
- cellIdentifier = @"VLCLibrarySongsTableViewPlayCountTableCellViewIdentifier";
- cellText = [@(mediaItem.playCount) stringValue];
- } else if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewYearColumnIdentifier]) {
- cellIdentifier = @"VLCLibrarySongsTableViewYearTableCellViewIdentifier";
- cellText = [@(mediaItem.year) stringValue];
- } else {
- NSAssert(true, @"Received unknown column identifier %@", columnIdentifier);
- }
-
- NSTableCellView *cellView = [tableView makeViewWithIdentifier:cellIdentifier owner:self];
- cellView.textField.stringValue = cellText;
- return cellView;
- }
-
- VLCLibraryTableCellView *cellView = [tableView makeViewWithIdentifier:VLCAudioLibraryCellIdentifier owner:self];
-
- if (cellView == nil) {
- cellView = [VLCLibraryTableCellView fromNibWithOwner:self];
- cellView.identifier = VLCAudioLibraryCellIdentifier;
- }
-
- [cellView setRepresentedItem:[self libraryItemAtRow:row forTableView:tableView]];
- return cellView;
-}
-
- (id<VLCMediaLibraryItemProtocol>)libraryItemAtRow:(NSInteger)row
forTableView:(NSTableView *)tableView
{
@@ -581,14 +514,21 @@ static NSString *VLCLibraryYearSortDescriptorKey = @"VLCLibraryYearSortDescripto
return _displayedCollection[row];
}
-- (void)tableViewSelectionDidChange:(NSNotification *)notification
+- (void)tableView:(NSTableView * const)tableView selectRow:(NSInteger)row
{
- NSParameterAssert(notification);
- NSTableView *tableView = (NSTableView *)notification.object;
- NSAssert(tableView, @"Must be a valid table view");
- NSInteger selectedRow = tableView.selectedRow;
- BOOL showingAllItemsEntry = [self displayAllArtistsGenresTableEntry];
- NSInteger libraryItemIndex = showingAllItemsEntry ? selectedRow - 1 : selectedRow;
+ NSParameterAssert(tableView);
+
+ if (tableView != _collectionSelectionTableView && tableView != _groupSelectionTableView && tableView != _gridModeListTableView) {
+ return;
+ }
+
+ if (tableView.selectedRow != row) {
+ [tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
+ }
+
+ const NSInteger selectedRow = tableView.selectedRow;
+ const BOOL showingAllItemsEntry = [self displayAllArtistsGenresTableEntry];
+ const NSInteger libraryItemIndex = showingAllItemsEntry ? selectedRow - 1 : selectedRow;
if (libraryItemIndex < 0 && showingAllItemsEntry) {
_audioGroupDataSource.representedListOfAlbums = _libraryModel.listOfAlbums;
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupDataSource.h
=====================================
@@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
@class VLCLibraryAudioGroupDataSource;
@class VLCMediaLibraryAlbum;
- at interface VLCLibraryAudioGroupDataSource : NSObject <VLCLibraryTableViewDataSource, NSTableViewDelegate, VLCLibraryCollectionViewDataSource>
+ at interface VLCLibraryAudioGroupDataSource : NSObject <VLCLibraryTableViewDataSource, VLCLibraryCollectionViewDataSource>
@property (readwrite, retain, nullable) NSArray <VLCMediaLibraryAlbum *> *representedListOfAlbums;
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupDataSource.m
=====================================
@@ -45,38 +45,12 @@
return 0;
}
-- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
-{
- VLCLibraryAlbumTableCellView *cellView = [tableView makeViewWithIdentifier:VLCAudioLibraryCellIdentifier owner:self];
-
- if (cellView == nil) {
- cellView = [VLCLibraryAlbumTableCellView fromNibWithOwner:self];
- cellView.identifier = VLCAudioLibraryCellIdentifier;
- }
-
- cellView.representedAlbum = (VLCMediaLibraryAlbum *)[self libraryItemAtRow:row forTableView:tableView];
- return cellView;
-}
-
- (id<VLCMediaLibraryItemProtocol>)libraryItemAtRow:(NSInteger)row
forTableView:(NSTableView *)tableView
{
return _representedListOfAlbums[row];
}
-- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row
-{
- VLCLibraryAlbumTableCellView *cellView = (VLCLibraryAlbumTableCellView *)[self tableView:tableView viewForTableColumn:[[NSTableColumn alloc] initWithIdentifier:VLCLibraryAlbumTableCellTableViewColumnIdentifier] row:row];
- return cellView == nil ? -1 : cellView.height;
-}
-
-- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)rowIndex
-{
- // We use this with nested table views, since the table view cell is the VLCLibraryAlbumTableCellView.
- // We don't want to select the outer cell, only the inner cells in the album view's table.
- return NO;
-}
-
- (NSInteger)collectionView:(NSCollectionView *)collectionView
numberOfItemsInSection:(NSInteger)section
{
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupTableViewDelegate.h
=====================================
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * VLCLibraryAudioGroupTableViewDelegate.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+#import "library/VLCLibraryTableViewDelegate.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+ at interface VLCLibraryAudioGroupTableViewDelegate : VLCLibraryTableViewDelegate
+
+ at end
+
+NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupTableViewDelegate.m
=====================================
@@ -0,0 +1,58 @@
+/*****************************************************************************
+ * VLCLibraryAudioGroupTableViewDelegate.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import "VLCLibraryAudioGroupTableViewDelegate.h"
+
+#import "VLCLibraryAlbumTableCellView.h"
+#import "VLCLibraryAudioDataSource.h"
+
+#import "library/VLCLibraryTableCellView.h"
+
+ at implementation VLCLibraryAudioGroupTableViewDelegate
+
+- (instancetype)init
+{
+ self = [super init];
+ if (self) {
+ self.cellViewIdentifier = VLCAudioLibraryCellIdentifier;
+ self.cellViewClass = [VLCLibraryAlbumTableCellView class];
+ }
+ return self;
+}
+
+- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)rowIndex
+{
+ // We use this with nested table views, since the table view cell is the VLCLibraryAlbumTableCellView.
+ // We don't want to select the outer cell, only the inner cells in the album view's table.
+ return NO;
+}
+
+- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row
+{
+ NSTableColumn *column = [[NSTableColumn alloc] initWithIdentifier:VLCLibraryAlbumTableCellTableViewColumnIdentifier];
+ VLCLibraryAlbumTableCellView *cellView = (VLCLibraryAlbumTableCellView *)[self tableView:tableView
+ viewForTableColumn:column
+ row:row];
+ return cellView == nil ? -1 : cellView.height;
+}
+
+ at end
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioTableViewDelegate.h
=====================================
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * VLCLibraryAudioTableViewDelegate.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+#import "library/VLCLibraryTableViewDelegate.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+ at interface VLCLibraryAudioTableViewDelegate : VLCLibraryTableViewDelegate
+
+ at end
+
+NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioTableViewDelegate.m
=====================================
@@ -0,0 +1,136 @@
+/*****************************************************************************
+ * VLCLibraryAudioTableViewDelegate.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import "VLCLibraryAudioTableViewDelegate.h"
+
+#import "VLCLibraryAlbumTableCellView.h"
+#import "VLCLibraryAudioDataSource.h"
+#import "VLCLibrarySongTableCellView.h"
+#import "VLCLibrarySongsTableViewSongPlayingTableCellView.h"
+
+#import "library/VLCLibraryDataTypes.h"
+#import "library/VLCLibraryTableCellView.h"
+
+ at implementation VLCLibraryAudioTableViewDelegate
+
+- (instancetype)init
+{
+ self = [super init];
+ if (self) {
+ self.cellViewIdentifier = VLCAudioLibraryCellIdentifier;
+ self.cellViewClass = [VLCLibraryTableCellView class];
+ }
+ return self;
+}
+
+- (NSView *)tableView:(NSTableView *)tableView
+ viewForTableColumn:(NSTableColumn *)tableColumn
+ row:(NSInteger)row
+{
+ if (![tableView.dataSource conformsToProtocol:@protocol(VLCLibraryTableViewDataSource)]) {
+ return nil;
+ }
+
+ NSObject<VLCLibraryTableViewDataSource> * const vlcDataSource = (NSObject<VLCLibraryTableViewDataSource>*)tableView.dataSource;
+ NSAssert(vlcDataSource != nil, @"Should be a valid data source");
+
+ const id<VLCMediaLibraryItemProtocol> libraryItem = [vlcDataSource libraryItemAtRow:row forTableView:tableView];
+
+ // The table view for songs in the list view mode of the audio library is different from the other audio groupings
+ // and we use a vanilla NSTableView created in the VLCLibraryWindow XIB for it
+ if ([tableView.identifier isEqualToString:@"VLCLibrarySongsTableViewIdentifier"]) {
+ const NSString * const columnIdentifier = tableColumn.identifier;
+
+ if (![libraryItem isKindOfClass:[VLCMediaLibraryMediaItem class]]) {
+ return nil;
+ }
+
+ const VLCMediaLibraryMediaItem * const mediaItem = (VLCMediaLibraryMediaItem *)libraryItem;
+
+ if (!mediaItem) {
+ return nil;
+ }
+
+ const VLCMediaLibraryAlbum * const album = [VLCMediaLibraryAlbum albumWithID:mediaItem.albumID];
+ const VLCMediaLibraryGenre * const genre = [VLCMediaLibraryGenre genreWithID:mediaItem.genreID];
+
+ NSString *cellText = @"";
+ NSString *cellIdentifier = @"";
+
+ if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewSongPlayingColumnIdentifier]) {
+ VLCLibrarySongsTableViewSongPlayingTableCellView *cellView = (VLCLibrarySongsTableViewSongPlayingTableCellView*)[tableView makeViewWithIdentifier:@"VLCLibrarySongsTableViewSongPlayingTableCellViewIdentifier" owner:self];
+ NSAssert(cellView, @"Unexpectedly received null cellview");
+ cellView.representedMediaItem = (VLCMediaLibraryMediaItem *)mediaItem;
+ return cellView;
+ } else if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewTitleColumnIdentifier]) {
+ cellIdentifier = @"VLCLibrarySongsTableViewTitleTableCellViewIdentifier";
+ cellText = mediaItem.title;
+ } else if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewDurationColumnIdentifier]) {
+ cellIdentifier = @"VLCLibrarySongsTableViewDurationTableCellViewIdentifier";
+ cellText = mediaItem.durationString;
+ } else if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewArtistColumnIdentifier]) {
+ cellIdentifier = @"VLCLibrarySongsTableViewArtistTableCellViewIdentifier";
+ cellText = album.artistName.length == 0 ? @"" : album.artistName;
+ } else if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewAlbumColumnIdentifier]) {
+ cellIdentifier = @"VLCLibrarySongsTableViewAlbumTableCellViewIdentifier";
+ cellText = album.title.length == 0 ? @"" : album.title;
+ } else if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewGenreColumnIdentifier]) {
+ cellIdentifier = @"VLCLibrarySongsTableViewGenreTableCellViewIdentifier";
+ cellText = genre.name.length == 0 ? @"" : genre.name;
+ } else if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewPlayCountColumnIdentifier]) {
+ cellIdentifier = @"VLCLibrarySongsTableViewPlayCountTableCellViewIdentifier";
+ cellText = [@(mediaItem.playCount) stringValue];
+ } else if ([columnIdentifier isEqualToString:VLCLibrarySongsTableViewYearColumnIdentifier]) {
+ cellIdentifier = @"VLCLibrarySongsTableViewYearTableCellViewIdentifier";
+ cellText = [@(mediaItem.year) stringValue];
+ } else {
+ NSAssert(true, @"Received unknown column identifier %@", columnIdentifier);
+ }
+
+ NSTableCellView *cellView = [tableView makeViewWithIdentifier:cellIdentifier owner:self];
+ cellView.textField.stringValue = cellText;
+ return cellView;
+ }
+
+ return [super tableView:tableView viewForTableColumn:tableColumn row:row];
+}
+
+- (void)tableViewSelectionDidChange:(NSNotification *)notification
+{
+ NSParameterAssert(notification);
+ NSTableView *tableView = (NSTableView *)notification.object;
+ NSAssert(tableView, @"Must be a valid table view");
+ NSInteger selectedRow = tableView.selectedRow;
+
+ if (![tableView.dataSource conformsToProtocol:@protocol(VLCLibraryTableViewDataSource)]) {
+ return;
+ }
+
+ NSObject<VLCLibraryTableViewDataSource> * const vlcDataSource = (NSObject<VLCLibraryTableViewDataSource>*)tableView.dataSource;
+ NSAssert(vlcDataSource != nil, @"Should be a valid data source");
+
+ if ([vlcDataSource isKindOfClass:[VLCLibraryAudioDataSource class]]) {
+ [(VLCLibraryAudioDataSource*)vlcDataSource tableView:tableView selectRow:selectedRow];
+ }
+}
+
+ at end
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
=====================================
@@ -34,6 +34,8 @@
#import "library/audio-library/VLCLibraryAlbumTableCellView.h"
#import "library/audio-library/VLCLibraryAudioDataSource.h"
#import "library/audio-library/VLCLibraryAudioGroupDataSource.h"
+#import "library/audio-library/VLCLibraryAudioGroupTableViewDelegate.h"
+#import "library/audio-library/VLCLibraryAudioTableViewDelegate.h"
#import "library/video-library/VLCLibraryVideoViewController.h"
@@ -50,6 +52,8 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
NSArray<NSString *> *_placeholderLabelStrings;
VLCLibraryCollectionViewDelegate *_audioLibraryCollectionViewDelegate;
+ VLCLibraryAudioTableViewDelegate *_audioLibraryTableViewDelegate;
+ VLCLibraryAudioGroupTableViewDelegate *_audioGroupLibraryTableViewDelegate;
}
@end
@@ -66,6 +70,8 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
[self setupAudioDataSource];
_audioLibraryCollectionViewDelegate = [[VLCLibraryCollectionViewDelegate alloc] init];
+ _audioLibraryTableViewDelegate = [[VLCLibraryAudioTableViewDelegate alloc] init];
+ _audioGroupLibraryTableViewDelegate = [[VLCLibraryAudioGroupTableViewDelegate alloc] init];
[self setupAudioCollectionView];
[self setupGridModeSplitView];
@@ -152,23 +158,23 @@ NSString *VLCLibraryPlaceholderAudioViewIdentifier = @"VLCLibraryPlaceholderAudi
- (void)setupAudioTableViews
{
_audioCollectionSelectionTableView.dataSource = _audioDataSource;
- _audioCollectionSelectionTableView.delegate = _audioDataSource;
+ _audioCollectionSelectionTableView.delegate = _audioLibraryTableViewDelegate;
_audioGroupSelectionTableView.dataSource = _audioGroupDataSource;
- _audioGroupSelectionTableView.delegate = _audioGroupDataSource;
+ _audioGroupSelectionTableView.delegate = _audioGroupLibraryTableViewDelegate;
if(@available(macOS 11.0, *)) {
_audioGroupSelectionTableView.style = NSTableViewStyleFullWidth;
}
_audioSongTableView.dataSource = _audioDataSource;
- _audioSongTableView.delegate = _audioDataSource;
+ _audioSongTableView.delegate = _audioLibraryTableViewDelegate;
}
- (void)setupGridModeSplitView
{
_audioLibraryGridModeSplitViewListTableView.dataSource = _audioDataSource;
- _audioLibraryGridModeSplitViewListTableView.delegate = _audioDataSource;
+ _audioLibraryGridModeSplitViewListTableView.delegate = _audioLibraryTableViewDelegate;
_audioLibraryGridModeSplitViewListSelectionCollectionView.dataSource = _audioGroupDataSource;
_audioLibraryGridModeSplitViewListSelectionCollectionView.delegate = _audioLibraryCollectionViewDelegate;
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryCollectionViewAlbumSupplementaryDetailView.m
=====================================
@@ -35,6 +35,7 @@
#import "extensions/NSView+VLCAdditions.h"
#import "library/audio-library/VLCLibraryAlbumTracksDataSource.h"
+#import "library/audio-library/VLCLibraryAlbumTracksTableViewDelegate.h"
#import "library/audio-library/VLCLibraryAlbumTableCellView.h"
NSString *const VLCLibraryCollectionViewAlbumSupplementaryDetailViewIdentifier = @"VLCLibraryCollectionViewAlbumSupplementaryDetailViewIdentifier";
@@ -43,6 +44,7 @@ NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewAlbumSupp
@interface VLCLibraryCollectionViewAlbumSupplementaryDetailView ()
{
VLCLibraryAlbumTracksDataSource *_tracksDataSource;
+ VLCLibraryAlbumTracksTableViewDelegate *_tracksTableViewDelegate;
VLCLibraryController *_libraryController;
}
@@ -59,8 +61,10 @@ NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewAlbumSupp
- (void)awakeFromNib
{
_tracksDataSource = [[VLCLibraryAlbumTracksDataSource alloc] init];
+ _tracksTableViewDelegate = [[VLCLibraryAlbumTracksTableViewDelegate alloc] init];
+
_albumTracksTableView.dataSource = _tracksDataSource;
- _albumTracksTableView.delegate = _tracksDataSource;
+ _albumTracksTableView.delegate = _tracksTableViewDelegate;
_albumTracksTableView.rowHeight = VLCLibraryTracksRowHeight;
_albumTitleTextField.font = [NSFont VLCLibrarySupplementaryDetailViewTitleFont];
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryCollectionViewAudioGroupSupplementaryDetailView.m
=====================================
@@ -26,6 +26,7 @@
#import "extensions/NSFont+VLCAdditions.h"
#import "library/audio-library/VLCLibraryAudioGroupDataSource.h"
+#import "library/audio-library/VLCLibraryAudioGroupTableViewDelegate.h"
NSString *const VLCLibraryCollectionViewAudioGroupSupplementaryDetailViewIdentifier = @"VLCLibraryCollectionViewAudioGroupSupplementaryDetailViewIdentifier";
NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewAudioGroupSupplementaryDetailViewKind = @"VLCLibraryCollectionViewAudioGroupSupplementaryDetailViewIdentifier";
@@ -33,6 +34,7 @@ NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewAudioGrou
@interface VLCLibraryCollectionViewAudioGroupSupplementaryDetailView ()
{
VLCLibraryAudioGroupDataSource *_audioGroupAlbumsDataSource;
+ VLCLibraryAudioGroupTableViewDelegate *_audioGroupAlbumsTableViewDelegate;
}
@end
@@ -42,8 +44,10 @@ NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewAudioGrou
- (void)awakeFromNib
{
_audioGroupAlbumsDataSource = [[VLCLibraryAudioGroupDataSource alloc] init];
+ _audioGroupAlbumsTableViewDelegate = [[VLCLibraryAudioGroupTableViewDelegate alloc] init];
+
_audioGroupAlbumsTableView.dataSource = _audioGroupAlbumsDataSource;
- _audioGroupAlbumsTableView.delegate = _audioGroupAlbumsDataSource;
+ _audioGroupAlbumsTableView.delegate = _audioGroupAlbumsTableViewDelegate;
_audioGroupNameTextField.font = [NSFont VLCLibrarySupplementaryDetailViewTitleFont];
}
=====================================
modules/gui/macosx/library/audio-library/VLCLibrarySongTableCellView.h
=====================================
@@ -22,12 +22,14 @@
#import <Cocoa/Cocoa.h>
+#import "library/VLCLibraryTableCellViewProtocol.h"
+
NS_ASSUME_NONNULL_BEGIN
@class VLCTrackingView;
@class VLCMediaLibraryMediaItem;
- at interface VLCLibrarySongTableCellView : NSTableCellView
+ at interface VLCLibrarySongTableCellView : NSTableCellView<VLCLibraryTableCellViewProtocol>
extern NSString *VLCAudioLibrarySongCellIdentifier;
=====================================
modules/gui/macosx/library/audio-library/VLCLibrarySongTableCellView.m
=====================================
@@ -98,4 +98,12 @@ NSString *VLCAudioLibrarySongCellIdentifier = @"VLCAudioLibrarySongCellIdentifie
}
+- (void)setRepresentedItem:(id<VLCMediaLibraryItemProtocol>)libraryItem
+{
+ VLCMediaLibraryMediaItem * const mediaItem = (VLCMediaLibraryMediaItem *)libraryItem;
+ if (mediaItem != nil) {
+ [self setRepresentedMediaItem:mediaItem];
+ }
+}
+
@end
=====================================
modules/gui/macosx/library/video-library/VLCLibraryVideoTableViewDataSource.h
=====================================
@@ -28,13 +28,12 @@ NS_ASSUME_NONNULL_BEGIN
@class VLCLibraryModel;
- at interface VLCLibraryVideoTableViewDataSource : NSObject <VLCLibraryTableViewDataSource, NSTableViewDelegate>
+ at interface VLCLibraryVideoTableViewDataSource : NSObject <VLCLibraryTableViewDataSource>
@property (readwrite, assign) VLCLibraryModel *libraryModel;
@property (readwrite, assign) NSTableView *groupsTableView;
@property (readwrite, assign) NSTableView *groupSelectionTableView;
-- (void)setup;
- (void)reloadData;
@end
=====================================
modules/gui/macosx/library/video-library/VLCLibraryVideoTableViewDataSource.m
=====================================
@@ -84,22 +84,6 @@
});
}
-- (void)setup
-{
- [self setupTableViews];
-}
-
-- (void)setupTableViews
-{
- _groupsTableView.dataSource = self;
- _groupsTableView.delegate = self;
- _groupsTableView.target = self;
-
- _groupSelectionTableView.dataSource = self;
- _groupSelectionTableView.delegate = self;
- _groupSelectionTableView.target = self;
-}
-
#pragma mark - table view data source and delegation
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
@@ -121,41 +105,6 @@
return 0;
}
-- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
-{
- VLCLibraryTableCellView *cellView = [tableView makeViewWithIdentifier:@"VLCVideoLibraryTableViewCellIdentifier" owner:self];
-
- if (!cellView) {
- cellView = [VLCLibraryTableCellView fromNibWithOwner:self];
- cellView.identifier = @"VLCVideoLibraryTableViewCellIdentifier";
- }
-
- if (tableView == _groupsTableView) {
- cellView.representedVideoLibrarySection = row;
- } else if (tableView == _groupSelectionTableView && _groupsTableView.selectedRow > -1) {
- switch(_groupsTableView.selectedRow + 1) { // Group 0 is invalid so add one
- case VLCLibraryVideoRecentsGroup:
- cellView.representedItem = _recentsArray[row];
- break;
- case VLCLibraryVideoLibraryGroup:
- cellView.representedItem = _libraryArray[row];
- break;
- default:
- NSAssert(1, @"Reached unreachable case for video library section");
- break;
- }
- }
-
- return cellView;
-}
-
-- (void)tableViewSelectionDidChange:(NSNotification *)notification
-{
- if(notification.object == _groupsTableView) {
- [_groupSelectionTableView reloadData];
- }
-}
-
- (id<VLCMediaLibraryItemProtocol>)libraryItemAtRow:(NSInteger)row
forTableView:(NSTableView *)tableView
{
=====================================
modules/gui/macosx/library/video-library/VLCLibraryVideoTableViewDelegate.h
=====================================
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * VLCLibraryVideoTableViewDelegate.h MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import <Cocoa/Cocoa.h>
+
+#import "library/VLCLibraryTableViewDelegate.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+ at interface VLCLibraryVideoTableViewDelegate : VLCLibraryTableViewDelegate
+
+ at end
+
+NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/video-library/VLCLibraryVideoTableViewDelegate.m
=====================================
@@ -0,0 +1,100 @@
+/*****************************************************************************
+ * VLCLibraryVideoTableViewDelegate.m MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2023 VLC authors and VideoLAN
+ *
+ * Authors: Claudio Cambra <developer at claudiocambra.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#import "VLCLibraryVideoTableViewDelegate.h"
+
+#import "VLCLibraryVideoTableViewDataSource.h"
+
+#import "library/VLCLibraryDataTypes.h"
+#import "library/VLCLibraryTableCellView.h"
+#import "library/VLCLibraryTableView.h"
+
+ at implementation VLCLibraryVideoTableViewDelegate
+
+- (instancetype)init
+{
+ self = [super init];
+ if (self) {
+ self.cellViewIdentifier = @"VLCVideoLibraryTableViewCellIdentifier";
+ self.cellViewClass = [VLCLibraryTableCellView class];
+ }
+ return self;
+}
+
+- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
+{
+ if (![tableView.dataSource conformsToProtocol:@protocol(VLCLibraryTableViewDataSource)]) {
+ return nil;
+ }
+
+ NSObject<VLCLibraryTableViewDataSource> * const vlcDataSource = (NSObject<VLCLibraryTableViewDataSource>*)tableView.dataSource;
+ NSAssert(vlcDataSource != nil, @"Should be a valid data source");
+
+ const id<VLCMediaLibraryItemProtocol> mediaItem = [vlcDataSource libraryItemAtRow:row forTableView:tableView];
+ if (mediaItem != nil) {
+ return [super tableView:tableView viewForTableColumn:tableColumn row:row];
+ }
+
+ VLCLibraryTableCellView *cellView = [tableView makeViewWithIdentifier:self.cellViewIdentifier owner:self];
+
+ if (!cellView) {
+ cellView = [VLCLibraryTableCellView fromNibWithOwner:self];
+ cellView.identifier = @"VLCVideoLibraryTableViewCellIdentifier";
+ }
+
+ if ([vlcDataSource isKindOfClass:[VLCLibraryVideoTableViewDataSource class]]) {
+ VLCLibraryVideoTableViewDataSource * const videoTableViewDataSource = (VLCLibraryVideoTableViewDataSource *)vlcDataSource;
+ NSTableView * const groupsTableView = videoTableViewDataSource.groupsTableView;
+
+ if (tableView == groupsTableView) {
+ cellView.representedVideoLibrarySection = row;
+ }
+ }
+
+ return cellView;
+}
+
+- (void)tableViewSelectionDidChange:(NSNotification *)notification
+{
+ NSParameterAssert(notification);
+ NSTableView *tableView = (NSTableView *)notification.object;
+ NSAssert(tableView, @"Must be a valid table view");
+ NSInteger selectedRow = tableView.selectedRow;
+
+ if (![tableView.dataSource conformsToProtocol:@protocol(VLCLibraryTableViewDataSource)]) {
+ return;
+ }
+
+ NSObject<VLCLibraryTableViewDataSource> * const vlcDataSource = (NSObject<VLCLibraryTableViewDataSource>*)tableView.dataSource;
+ NSAssert(vlcDataSource != nil, @"Should be a valid data source");
+
+ if ([vlcDataSource isKindOfClass:[VLCLibraryVideoTableViewDataSource class]]) {
+ VLCLibraryVideoTableViewDataSource * const videoTableViewDataSource = (VLCLibraryVideoTableViewDataSource *)vlcDataSource;
+ NSTableView * const groupsTableView = videoTableViewDataSource.groupsTableView;
+
+ if (tableView == videoTableViewDataSource.groupsTableView) {
+ [videoTableViewDataSource.groupSelectionTableView reloadData];
+ }
+ }
+}
+
+ at end
=====================================
modules/gui/macosx/library/video-library/VLCLibraryVideoViewController.m
=====================================
@@ -33,12 +33,19 @@
#import "library/video-library/VLCLibraryVideoCollectionViewsStackViewController.h"
#import "library/video-library/VLCLibraryVideoTableViewDataSource.h"
+#import "library/video-library/VLCLibraryVideoTableViewDelegate.h"
#import "main/VLCMain.h"
#import "windows/video/VLCVoutView.h"
#import "windows/video/VLCMainVideoViewController.h"
+ at interface VLCLibraryVideoViewController ()
+{
+ VLCLibraryVideoTableViewDelegate *_videoLibraryTableViewDelegate;
+}
+ at end
+
@implementation VLCLibraryVideoViewController
- (instancetype)initWithLibraryWindow:(VLCLibraryWindow *)libraryWindow
@@ -46,8 +53,11 @@
self = [super init];
if(self) {
+ _videoLibraryTableViewDelegate = [[VLCLibraryVideoTableViewDelegate alloc] init];
+
[self setupPropertiesFromLibraryWindow:libraryWindow];
[self setupTableViewDataSource];
+ [self setupTableViews];
[self setupGridViewController];
[self setupVideoPlaceholderView];
[self setupVideoLibraryViews];
@@ -89,8 +99,17 @@
_libraryVideoTableViewDataSource.libraryModel = VLCMain.sharedInstance.libraryController.libraryModel;
_libraryVideoTableViewDataSource.groupsTableView = _videoLibraryGroupsTableView;
_libraryVideoTableViewDataSource.groupSelectionTableView = _videoLibraryGroupSelectionTableView;
+}
+
+- (void)setupTableViews
+{
+ _videoLibraryGroupsTableView.dataSource = _libraryVideoTableViewDataSource;
+ _videoLibraryGroupsTableView.target = _libraryVideoTableViewDataSource;
+ _videoLibraryGroupsTableView.delegate = _videoLibraryTableViewDelegate;
- [_libraryVideoTableViewDataSource setup];
+ _videoLibraryGroupSelectionTableView.dataSource = _libraryVideoTableViewDataSource;
+ _videoLibraryGroupSelectionTableView.target = _libraryVideoTableViewDataSource;
+ _videoLibraryGroupSelectionTableView.delegate = _videoLibraryTableViewDelegate;
}
- (void)setupGridViewController
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d26d428d805dce4ef372bbc6368b2e12f223f572...3faaa1e109a543e17c0c378a2d7dd2769d695e28
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d26d428d805dce4ef372bbc6368b2e12f223f572...3faaa1e109a543e17c0c378a2d7dd2769d695e28
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