[vlc-commits] [Git][videolan/vlc][master] 10 commits: macosx: Add split view for genre/artist collection views in XIB
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Wed Jan 4 07:55:43 UTC 2023
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
1f8baf2e by Claudio Cambra at 2023-01-03T20:01:22+01:00
macosx: Add split view for genre/artist collection views in XIB
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
029f324a by Claudio Cambra at 2023-01-03T20:01:32+01:00
macosx: Hook up new split view outlets to VLCLibraryWindow
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
101b58af by Claudio Cambra at 2023-01-03T20:01:32+01:00
macosx: Refactor setupCollectionView in VLCLibraryAudioDataSource to work with more then one collection view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
fda674ed by Claudio Cambra at 2023-01-03T20:01:32+01:00
macosx: Make VLCLibraryGroupDataSource also a NSCollectionView data source and delegate
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
722dffea by Claudio Cambra at 2023-01-03T20:01:32+01:00
macosx: Make VLCLibraryAudioDataSource tableViewSelectionDidChange client agnostic
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
3ebc08ad by Claudio Cambra at 2023-01-03T20:01:32+01:00
macosx: Set up new split view in audio view controller and data source
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
5e0514a7 by Claudio Cambra at 2023-01-03T20:03:28+01:00
macosx: Fix visual layout for the new collection view split view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
f4b9dd88 by Claudio Cambra at 2023-01-03T20:03:29+01:00
macosx: Reimplement supplementary detail view for selected artist/genre in split view collection view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
154647b8 by Claudio Cambra at 2023-01-03T20:10:48+01:00
macosx: Move VLCLibraryGroupDataSource to own file, rename to VLCLibraryAudioGroupDataSource
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
87baf648 by Claudio Cambra at 2023-01-03T20:10:51+01:00
macosx: Reset VLCLibraryCollectionViewFlowLayout for split view collection view when reloading views in VLCAudioDataSource
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
13 changed files:
- extras/package/macosx/VLC.xcodeproj/project.pbxproj
- modules/gui/macosx/Makefile.am
- modules/gui/macosx/UI/VLCLibraryWindow.xib
- modules/gui/macosx/library/VLCLibraryCollectionViewFlowLayout.m
- modules/gui/macosx/library/VLCLibraryWindow.h
- modules/gui/macosx/library/VLCLibraryWindow.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/VLCLibraryAudioViewController.h
- modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
- modules/gui/macosx/library/audio-library/VLCLibraryCollectionViewAudioGroupSupplementaryDetailView.m
Changes:
=====================================
extras/package/macosx/VLC.xcodeproj/project.pbxproj
=====================================
@@ -94,6 +94,7 @@
53628403291147C500640C15 /* VLCSubScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 53628400291147C500640C15 /* VLCSubScrollView.m */; };
536EFBF5295BCB8300F4CB13 /* VLCLibraryUIUnits.m in Sources */ = {isa = PBXBuildFile; fileRef = 536EFBF4295BCB8300F4CB13 /* VLCLibraryUIUnits.m */; };
536EFC39295E521600F4CB13 /* VLCLibraryVideoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 536EFC38295E521600F4CB13 /* VLCLibraryVideoViewController.m */; };
+ 53903D3A29576ED500D0B308 /* VLCLibraryAudioGroupDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 53903D3929576ED500D0B308 /* VLCLibraryAudioGroupDataSource.m */; };
53B447CA2939823E00857588 /* VLCLibrarySongsTableViewSongPlayingTableCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B447C92939823E00857588 /* VLCLibrarySongsTableViewSongPlayingTableCellView.m */; };
53B447F6293BB47B00857588 /* VLCLibraryVideoCollectionViewContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B447EC293BB47A00857588 /* VLCLibraryVideoCollectionViewContainerView.m */; };
53B447F7293BB47B00857588 /* VLCLibraryVideoCollectionViewContainerViewDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B447ED293BB47A00857588 /* VLCLibraryVideoCollectionViewContainerViewDataSource.m */; };
@@ -277,6 +278,8 @@
536EFBF4295BCB8300F4CB13 /* VLCLibraryUIUnits.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryUIUnits.m; sourceTree = "<group>"; };
536EFC37295E521600F4CB13 /* VLCLibraryVideoViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryVideoViewController.h; sourceTree = "<group>"; };
536EFC38295E521600F4CB13 /* VLCLibraryVideoViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryVideoViewController.m; sourceTree = "<group>"; };
+ 53903D3829576ED500D0B308 /* VLCLibraryAudioGroupDataSource.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryAudioGroupDataSource.h; sourceTree = "<group>"; };
+ 53903D3929576ED500D0B308 /* VLCLibraryAudioGroupDataSource.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryAudioGroupDataSource.m; sourceTree = "<group>"; };
53B447C82939823E00857588 /* VLCLibrarySongsTableViewSongPlayingTableCellView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibrarySongsTableViewSongPlayingTableCellView.h; sourceTree = "<group>"; };
53B447C92939823E00857588 /* VLCLibrarySongsTableViewSongPlayingTableCellView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibrarySongsTableViewSongPlayingTableCellView.m; sourceTree = "<group>"; };
53B447EC293BB47A00857588 /* VLCLibraryVideoCollectionViewContainerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryVideoCollectionViewContainerView.m; sourceTree = "<group>"; };
@@ -1299,6 +1302,8 @@
536283DF291146BC00640C15 /* VLCLibraryAlbumTracksDataSource.m */,
7DE2F0422282C84A0040DD0A /* VLCLibraryAudioDataSource.h */,
7DE2F0432282C84A0040DD0A /* VLCLibraryAudioDataSource.m */,
+ 53903D3829576ED500D0B308 /* VLCLibraryAudioGroupDataSource.h */,
+ 53903D3929576ED500D0B308 /* VLCLibraryAudioGroupDataSource.m */,
536283E8291146BC00640C15 /* VLCLibraryCollectionViewAlbumSupplementaryDetailView.h */,
536283E1291146BC00640C15 /* VLCLibraryCollectionViewAlbumSupplementaryDetailView.m */,
536283E7291146BC00640C15 /* VLCLibraryCollectionViewAudioGroupSupplementaryDetailView.h */,
@@ -1906,6 +1911,7 @@
536283F9291146BC00640C15 /* VLCLibraryCollectionViewFlowLayout.m in Sources */,
6BBBF9851F7B257100B404CD /* VLCLogMessage.m in Sources */,
7D445D8E2203375100263D34 /* VLCPlaylistMenuController.m in Sources */,
+ 53903D3A29576ED500D0B308 /* VLCLibraryAudioGroupDataSource.m in Sources */,
1C31139A1E508C6900D4DD76 /* VLCBookmarksWindowController.m in Sources */,
6B0AB0F01F1AC8B3003A1B4E /* VLCSlider.m in Sources */,
7D28E6362275B4820098D30E /* NSColor+VLCAdditions.m in Sources */,
=====================================
modules/gui/macosx/Makefile.am
=====================================
@@ -117,6 +117,8 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/library/audio-library/VLCLibraryAlbumTracksDataSource.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/VLCLibraryAudioViewController.h \
gui/macosx/library/audio-library/VLCLibraryAudioViewController.m \
gui/macosx/library/audio-library/VLCLibraryCollectionViewAlbumSupplementaryDetailView.h \
=====================================
modules/gui/macosx/UI/VLCLibraryWindow.xib
=====================================
@@ -685,6 +685,11 @@
<outlet property="audioGroupSelectionTableView" destination="4ll-T2-J16" id="m18-cT-5BQ"/>
<outlet property="audioGroupSelectionTableViewScrollView" destination="Jmx-bp-HDp" id="m81-p1-e5Q"/>
<outlet property="audioLibraryCollectionView" destination="QAt-jP-zE7" id="Lda-FY-5gD"/>
+ <outlet property="audioLibraryGridModeSplitView" destination="YHF-re-hif" id="S71-li-TGr"/>
+ <outlet property="audioLibraryGridModeSplitViewListSelectionCollectionView" destination="ZGR-PZ-7h5" id="098-89-gh5"/>
+ <outlet property="audioLibraryGridModeSplitViewListSelectionCollectionViewScrollView" destination="6NL-vK-li1" id="nO1-98-8th"/>
+ <outlet property="audioLibraryGridModeSplitViewListTableView" destination="hvV-yD-5Kd" id="AEf-7K-98h"/>
+ <outlet property="audioLibraryGridModeSplitViewListTableViewScrollView" destination="KW4-fp-jy1" id="sug-6s-b9Y"/>
<outlet property="audioLibrarySongsTableView" destination="Xck-iv-pH4" id="Sp4-iv-pH4"/>
<outlet property="audioLibrarySongsTableViewScrollView" destination="QqV-hX-sZw" id="1t5-D3-CeM"/>
<outlet property="audioLibrarySplitView" destination="llh-BF-BEJ" id="gvt-K1-cGw"/>
@@ -1066,6 +1071,100 @@
<rect key="frame" x="0.0" y="0.0" width="714" height="390"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
+ <splitView arrangesAllSubviews="NO" dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="YHF-re-hif">
+ <rect key="frame" x="0.0" y="0.0" width="714" height="390"/>
+ <subviews>
+ <scrollView fixedFrame="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="24" horizontalPageScroll="10" verticalLineScroll="24" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="KW4-fp-jy1">
+ <rect key="frame" x="0.0" y="0.0" width="298" height="390"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <clipView key="contentView" id="4uw-9H-2bN">
+ <rect key="frame" x="0.0" y="0.0" width="298" height="390"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" rowHeight="24" rowSizeStyle="automatic" viewBased="YES" id="hvV-yD-5Kd" customClass="VLCLibraryTableView">
+ <rect key="frame" x="0.0" y="0.0" width="298" height="390"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <size key="intercellSpacing" width="17" height="0.0"/>
+ <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+ <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
+ <tableColumns>
+ <tableColumn editable="NO" width="266" minWidth="40" maxWidth="9.2233720368547758e+18" id="5fQ-TS-Dqm">
+ <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
+ <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
+ </tableHeaderCell>
+ <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="16A-B6-bD5">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ <tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
+ <prototypeCellViews>
+ <tableCellView id="FPm-wv-pPO">
+ <rect key="frame" x="18" y="0.0" width="261" height="24"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jsn-kJ-CVZ">
+ <rect key="frame" x="0.0" y="4" width="261" height="16"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
+ <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="UD3-mZ-qPY">
+ <font key="font" usesAppearanceFont="YES"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ </subviews>
+ <connections>
+ <outlet property="textField" destination="jsn-kJ-CVZ" id="ATj-Yw-GxN"/>
+ </connections>
+ </tableCellView>
+ </prototypeCellViews>
+ </tableColumn>
+ </tableColumns>
+ </tableView>
+ </subviews>
+ </clipView>
+ <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="vEM-HC-DF5">
+ <rect key="frame" x="1" y="374" width="144" height="15"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </scroller>
+ <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="lbB-d5-MIr">
+ <rect key="frame" x="224" y="17" width="15" height="102"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </scroller>
+ </scrollView>
+ <scrollView wantsLayer="YES" fixedFrame="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" id="6NL-vK-li1">
+ <rect key="frame" x="299" y="0.0" width="415" height="390"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <clipView key="contentView" id="Zmo-lc-CDL">
+ <rect key="frame" x="0.0" y="0.0" width="415" height="390"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <collectionView id="ZGR-PZ-7h5">
+ <rect key="frame" x="0.0" y="0.0" width="415" height="390"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
+ <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" id="od3-Iu-ch8">
+ <size key="itemSize" width="50" height="50"/>
+ </collectionViewFlowLayout>
+ <color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </collectionView>
+ </subviews>
+ </clipView>
+ <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="CDD-UB-kQh">
+ <rect key="frame" x="-100" y="-100" width="233" height="15"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </scroller>
+ <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="Qfe-rP-ogK">
+ <rect key="frame" x="234" y="1" width="15" height="143"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </scroller>
+ </scrollView>
+ </subviews>
+ <holdingPriorities>
+ <real value="250"/>
+ <real value="250"/>
+ </holdingPriorities>
+ </splitView>
<splitView dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="llh-BF-BEJ">
<rect key="frame" x="0.0" y="0.0" width="714" height="390"/>
<subviews>
@@ -1512,10 +1611,14 @@
<constraint firstItem="QqV-hX-sZw" firstAttribute="top" secondItem="lpg-UW-pTq" secondAttribute="top" constant="32" id="KRh-EG-H6U"/>
<constraint firstItem="QqV-hX-sZw" firstAttribute="leading" secondItem="lpg-UW-pTq" secondAttribute="leading" id="PjK-If-LKN"/>
<constraint firstItem="llh-BF-BEJ" firstAttribute="leading" secondItem="lpg-UW-pTq" secondAttribute="leading" id="R2e-oG-oCH"/>
+ <constraint firstItem="YHF-re-hif" firstAttribute="top" secondItem="lpg-UW-pTq" secondAttribute="top" id="S4k-pz-JVq"/>
<constraint firstAttribute="bottom" secondItem="QqV-hX-sZw" secondAttribute="bottom" id="X3K-4y-6ru"/>
<constraint firstAttribute="bottom" secondItem="AYf-gS-P66" secondAttribute="bottom" id="aTn-9G-2TE"/>
<constraint firstAttribute="trailing" secondItem="QqV-hX-sZw" secondAttribute="trailing" id="boZ-8i-Aa4"/>
<constraint firstAttribute="bottom" secondItem="llh-BF-BEJ" secondAttribute="bottom" id="buL-6V-txw"/>
+ <constraint firstAttribute="bottom" secondItem="YHF-re-hif" secondAttribute="bottom" id="clr-fd-z6x"/>
+ <constraint firstAttribute="trailing" secondItem="YHF-re-hif" secondAttribute="trailing" id="hWr-P2-tT1"/>
+ <constraint firstItem="YHF-re-hif" firstAttribute="leading" secondItem="lpg-UW-pTq" secondAttribute="leading" id="mnH-nS-FUy"/>
<constraint firstAttribute="trailing" secondItem="AYf-gS-P66" secondAttribute="trailing" id="riC-72-Ldb"/>
</constraints>
<point key="canvasLocation" x="237" y="661"/>
=====================================
modules/gui/macosx/library/VLCLibraryCollectionViewFlowLayout.m
=====================================
@@ -26,6 +26,7 @@
#import "library/VLCLibraryUIUnits.h"
#import "library/audio-library/VLCLibraryAudioDataSource.h"
+#import "library/audio-library/VLCLibraryAudioGroupDataSource.h"
#import "library/audio-library/VLCLibraryCollectionViewAlbumSupplementaryDetailView.h"
#import "library/audio-library/VLCLibraryCollectionViewAudioGroupSupplementaryDetailView.h"
@@ -222,7 +223,7 @@ static CVReturn detailViewAnimationCallback(CVDisplayLinkRef displayLink,
layoutAttributesArray[i] = attributes;
}
- if([self.collectionView.dataSource isKindOfClass:[VLCLibraryAudioDataSource class]]) {
+ if ([self.collectionView.dataSource isKindOfClass:[VLCLibraryAudioDataSource class]]) {
VLCLibraryAudioDataSource *audioDataSource = (VLCLibraryAudioDataSource *)self.collectionView.dataSource;
// Add detail view to the attributes set -- detail view about to be shown
@@ -239,7 +240,11 @@ static CVReturn detailViewAnimationCallback(CVDisplayLinkRef displayLink,
[layoutAttributesArray addObject:[self layoutAttributesForSupplementaryViewOfKind:VLCLibraryCollectionViewMediaItemSupplementaryDetailViewKind atIndexPath:self.selectedIndexPath]];
break;
}
- } else if([self.collectionView.dataSource isKindOfClass:[VLCLibraryVideoCollectionViewContainerViewDataSource class]]) {
+
+ } else if ([self.collectionView.dataSource isKindOfClass:[VLCLibraryAudioGroupDataSource class]]) {
+ [layoutAttributesArray addObject:[self layoutAttributesForSupplementaryViewOfKind:VLCLibraryCollectionViewAlbumSupplementaryDetailViewKind atIndexPath:self.selectedIndexPath]];
+
+ } else if ([self.collectionView.dataSource isKindOfClass:[VLCLibraryVideoCollectionViewContainerViewDataSource class]]) {
VLCLibraryVideoCollectionViewContainerViewDataSource *videoDataSource = (VLCLibraryVideoCollectionViewContainerViewDataSource *)self.collectionView.dataSource;
[layoutAttributesArray addObject:[self layoutAttributesForSupplementaryViewOfKind:VLCLibraryCollectionViewMediaItemSupplementaryDetailViewKind atIndexPath:self.selectedIndexPath]];
}
=====================================
modules/gui/macosx/library/VLCLibraryWindow.h
=====================================
@@ -79,6 +79,11 @@ extern const NSUserInterfaceItemIdentifier VLCLibraryWindowIdentifier;
@property (readwrite, weak) IBOutlet NSTableView *audioLibrarySongsTableView;
@property (readwrite, weak) IBOutlet NSScrollView *audioCollectionViewScrollView;
@property (readwrite, weak) IBOutlet NSCollectionView *audioLibraryCollectionView;
+ at property (readwrite, weak) IBOutlet NSSplitView *audioLibraryGridModeSplitView;
+ at property (readwrite, weak) IBOutlet NSScrollView *audioLibraryGridModeSplitViewListTableViewScrollView;
+ at property (readwrite, weak) IBOutlet NSTableView *audioLibraryGridModeSplitViewListTableView;
+ at property (readwrite, weak) IBOutlet NSScrollView *audioLibraryGridModeSplitViewListSelectionCollectionViewScrollView;
+ at property (readwrite, weak) IBOutlet NSCollectionView *audioLibraryGridModeSplitViewListSelectionCollectionView;
@property (readwrite, weak) IBOutlet NSVisualEffectView *optionBarView;
@property (readwrite, weak) IBOutlet NSSegmentedControl *audioSegmentedControl;
@property (readwrite, weak) IBOutlet NSView *mediaSourceView;
=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -230,6 +230,7 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
_libraryAudioViewController = [[VLCLibraryAudioViewController alloc] initWithLibraryWindow:self];
_audioCollectionSelectionTableView.rowHeight = [VLCLibraryUIUnits mediumTableViewRowHeight];
+ _audioLibraryGridModeSplitViewListTableView.rowHeight = [VLCLibraryUIUnits mediumTableViewRowHeight];
_audioGroupSelectionTableView.rowHeight = [VLCLibraryAlbumTableCellView defaultHeight];
_mediaSourceDataSource = [[VLCMediaSourceBaseDataSource alloc] init];
@@ -291,7 +292,14 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
_audioGroupSelectionTableViewScrollView.automaticallyAdjustsContentInsets = NO;
_audioGroupSelectionTableViewScrollView.contentInsets = audioScrollViewInsets;
_audioGroupSelectionTableViewScrollView.scrollerInsets = scrollerInsets;
-
+
+ _audioLibraryGridModeSplitViewListTableViewScrollView.automaticallyAdjustsContentInsets = NO;
+ _audioLibraryGridModeSplitViewListTableViewScrollView.contentInsets = audioScrollViewInsets;
+ _audioLibraryGridModeSplitViewListTableViewScrollView.scrollerInsets = scrollerInsets;
+ _audioLibraryGridModeSplitViewListSelectionCollectionViewScrollView.automaticallyAdjustsContentInsets = NO;
+ _audioLibraryGridModeSplitViewListSelectionCollectionViewScrollView.contentInsets = audioScrollViewInsets;
+ _audioLibraryGridModeSplitViewListSelectionCollectionViewScrollView.scrollerInsets = scrollerInsets;
+
_videoLibraryCollectionViewsStackViewScrollView.automaticallyAdjustsContentInsets = NO;
_videoLibraryCollectionViewsStackViewScrollView.contentInsets = defaultInsets;
_videoLibraryCollectionViewsStackViewScrollView.scrollerInsets = scrollerInsets;
@@ -322,6 +330,11 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
audioLibraryCollectionViewLayout.minimumInteritemSpacing = collectionItemSpacing;
audioLibraryCollectionViewLayout.sectionInset = collectionViewSectionInset;
+ NSCollectionViewFlowLayout *audioLibraryGridModeListSelectionCollectionViewLayout = _audioLibraryGridModeSplitViewListSelectionCollectionView.collectionViewLayout;
+ audioLibraryGridModeListSelectionCollectionViewLayout.itemSize = [VLCLibraryCollectionViewItem defaultSize];
+ audioLibraryGridModeListSelectionCollectionViewLayout.minimumLineSpacing = collectionItemSpacing;
+ audioLibraryGridModeListSelectionCollectionViewLayout.minimumInteritemSpacing = collectionItemSpacing;
+
VLCLibraryVideoCollectionViewsStackViewController *videoLibraryStackViewController = _libraryVideoViewController.libraryVideoCollectionViewsStackViewController;
videoLibraryStackViewController.collectionViewItemSize = [VLCLibraryCollectionViewItem defaultSize];
videoLibraryStackViewController.collectionViewMinimumLineSpacing = collectionItemSpacing;
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.h
=====================================
@@ -28,7 +28,7 @@
NS_ASSUME_NONNULL_BEGIN
@class VLCLibraryModel;
- at class VLCLibraryGroupDataSource;
+ at class VLCLibraryAudioGroupDataSource;
@class VLCMediaLibraryAlbum;
typedef NS_ENUM(NSUInteger, VLCAudioLibrarySegment) {
@@ -41,23 +41,20 @@ typedef NS_ENUM(NSUInteger, VLCAudioLibrarySegment) {
@interface VLCLibraryAudioDataSource : NSObject <VLCLibraryTableViewDataSource, NSTableViewDelegate, VLCLibraryCollectionViewDataSource>
@property (readwrite, assign) VLCLibraryModel *libraryModel;
- at property (readwrite, assign) VLCLibraryGroupDataSource *groupDataSource;
+ at property (readwrite, assign) VLCLibraryAudioGroupDataSource *audioGroupDataSource;
@property (readwrite, assign) NSTableView *collectionSelectionTableView;
@property (readwrite, assign) NSTableView *groupSelectionTableView;
@property (readwrite, assign) NSTableView *songsTableView;
@property (readwrite, assign) NSCollectionView *collectionView;
+ at property (readwrite, assign) NSTableView *gridModeListTableView;
+ at property (readwrite, assign) NSCollectionView *gridModeListSelectionCollectionView;
@property (nonatomic, readwrite, assign) VLCAudioLibrarySegment audioLibrarySegment;
- (void)setup;
+- (void)setupCollectionView:(NSCollectionView *)collectionView;
- (void)reloadData;
@end
- at interface VLCLibraryGroupDataSource : NSObject <VLCLibraryTableViewDataSource, NSTableViewDelegate>
-
- at property (readwrite, retain, nullable) NSArray <VLCMediaLibraryAlbum *> *representedListOfAlbums;
-
- at end
-
NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioDataSource.m
=====================================
@@ -37,6 +37,7 @@
#import "library/VLCLibraryCollectionViewMediaItemSupplementaryDetailView.h"
#import "library/audio-library/VLCLibraryAlbumTableCellView.h"
+#import "library/audio-library/VLCLibraryAudioGroupDataSource.h"
#import "library/audio-library/VLCLibraryCollectionViewAlbumSupplementaryDetailView.h"
#import "library/audio-library/VLCLibraryCollectionViewAudioGroupSupplementaryDetailView.h"
#import "library/audio-library/VLCLibrarySongsTableViewSongPlayingTableCellView.h"
@@ -296,30 +297,29 @@ static NSString *VLCLibraryYearSortDescriptorKey = @"VLCLibraryYearSortDescripto
- (void)setup
{
- [self setupCollectionView];
+ [self setupCollectionView:_collectionView];
+ [self setupCollectionView:_gridModeListSelectionCollectionView];
[self setupTableViews];
_audioLibrarySegment = -1; // Force setAudioLibrarySegment to do something always on first try
}
-- (void)setupCollectionView
+- (void)setupCollectionView:(NSCollectionView *)collectionView
{
- _collectionView.dataSource = self;
-
- [_collectionView registerClass:[VLCLibraryCollectionViewItem class] forItemWithIdentifier:VLCLibraryCellIdentifier];
+ [collectionView registerClass:[VLCLibraryCollectionViewItem class] forItemWithIdentifier:VLCLibraryCellIdentifier];
NSNib *albumSupplementaryDetailView = [[NSNib alloc] initWithNibNamed:@"VLCLibraryCollectionViewAlbumSupplementaryDetailView" bundle:nil];
- [_collectionView registerNib:albumSupplementaryDetailView
+ [collectionView registerNib:albumSupplementaryDetailView
forSupplementaryViewOfKind:VLCLibraryCollectionViewAlbumSupplementaryDetailViewKind
withIdentifier:VLCLibraryCollectionViewAlbumSupplementaryDetailViewIdentifier];
NSNib *audioGroupSupplementaryDetailView = [[NSNib alloc] initWithNibNamed:@"VLCLibraryCollectionViewAudioGroupSupplementaryDetailView" bundle:nil];
- [_collectionView registerNib:audioGroupSupplementaryDetailView
+ [collectionView registerNib:audioGroupSupplementaryDetailView
forSupplementaryViewOfKind:VLCLibraryCollectionViewAudioGroupSupplementaryDetailViewKind
withIdentifier:VLCLibraryCollectionViewAudioGroupSupplementaryDetailViewIdentifier];
NSNib *mediaItemSupplementaryDetailView = [[NSNib alloc] initWithNibNamed:@"VLCLibraryCollectionViewMediaItemSupplementaryDetailView" bundle:nil];
- [_collectionView registerNib:mediaItemSupplementaryDetailView
+ [collectionView registerNib:mediaItemSupplementaryDetailView
forSupplementaryViewOfKind:VLCLibraryCollectionViewMediaItemSupplementaryDetailViewKind
withIdentifier:VLCLibraryCollectionViewMediaItemSupplementaryDetailViewIdentifier];
}
@@ -332,6 +332,9 @@ static NSString *VLCLibraryYearSortDescriptorKey = @"VLCLibraryYearSortDescripto
_collectionSelectionTableView.target = self;
_collectionSelectionTableView.doubleAction = @selector(collectionSelectionDoubleClickAction:);
+ _gridModeListTableView.target = self;
+ _gridModeListTableView.doubleAction = @selector(groubSelectionDoubleClickAction:);
+
[self setupSongsTableView];
}
@@ -430,8 +433,15 @@ static NSString *VLCLibraryYearSortDescriptorKey = @"VLCLibraryYearSortDescripto
if (collectionViewFlowLayout) {
[collectionViewFlowLayout resetLayout];
}
-
+
+ VLCLibraryCollectionViewFlowLayout *gridModeListSelectionCollectionViewFlowLayout = (VLCLibraryCollectionViewFlowLayout *)_gridModeListSelectionCollectionView.collectionViewLayout;
+ if (gridModeListSelectionCollectionViewFlowLayout) {
+ [gridModeListSelectionCollectionViewFlowLayout resetLayout];
+ }
+
[self.collectionView reloadData];
+ [self.gridModeListTableView reloadData];
+ [self.gridModeListSelectionCollectionView reloadData];
[self.collectionSelectionTableView reloadData];
[self.groupSelectionTableView reloadData];
[self.songsTableView reloadData];
@@ -468,7 +478,7 @@ static NSString *VLCLibraryYearSortDescriptorKey = @"VLCLibraryYearSortDescripto
break;
}
- _groupDataSource.representedListOfAlbums = nil; // Clear whatever was being shown before
+ _audioGroupDataSource.representedListOfAlbums = nil; // Clear whatever was being shown before
[self reloadData];
}
@@ -492,9 +502,15 @@ static NSString *VLCLibraryYearSortDescriptorKey = @"VLCLibraryYearSortDescripto
{
// 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"]) {
+ 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];
@@ -570,25 +586,27 @@ static NSString *VLCLibraryYearSortDescriptorKey = @"VLCLibraryYearSortDescripto
{
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;
if (libraryItemIndex < 0 && showingAllItemsEntry) {
- _groupDataSource.representedListOfAlbums = _libraryModel.listOfAlbums;
+ _audioGroupDataSource.representedListOfAlbums = _libraryModel.listOfAlbums;
} else {
id<VLCMediaLibraryItemProtocol> libraryItem = _displayedCollection[libraryItemIndex];
if (_currentParentType == VLC_ML_PARENT_ALBUM) {
- _groupDataSource.representedListOfAlbums = @[(VLCMediaLibraryAlbum *)libraryItem];
+ _audioGroupDataSource.representedListOfAlbums = @[(VLCMediaLibraryAlbum *)libraryItem];
} else if(_currentParentType != VLC_ML_PARENT_UNKNOWN) {
- _groupDataSource.representedListOfAlbums = [_libraryModel listAlbumsOfParentType:_currentParentType forID:libraryItem.libraryID];
+ _audioGroupDataSource.representedListOfAlbums = [_libraryModel listAlbumsOfParentType:_currentParentType forID:libraryItem.libraryID];
} else { // FIXME: we have nothing to show here
- _groupDataSource.representedListOfAlbums = nil;
+ _audioGroupDataSource.representedListOfAlbums = nil;
}
}
[self.groupSelectionTableView reloadData];
+ [self.gridModeListSelectionCollectionView reloadData];
}
- (void)tableView:(NSTableView *)tableView sortDescriptorsDidChange:(NSArray<NSSortDescriptor *> *)oldDescriptors
@@ -629,7 +647,7 @@ static NSString *VLCLibraryYearSortDescriptorKey = @"VLCLibraryYearSortDescripto
- (void)groubSelectionDoubleClickAction:(id)sender
{
- NSArray *listOfAlbums = _groupDataSource.representedListOfAlbums;
+ NSArray *listOfAlbums = _audioGroupDataSource.representedListOfAlbums;
NSUInteger albumCount = listOfAlbums.count;
NSInteger clickedRow = _groupSelectionTableView.clickedRow;
@@ -727,48 +745,3 @@ viewForSupplementaryElementOfKind:(NSCollectionViewSupplementaryElementKind)kind
}
@end
-
- at implementation VLCLibraryGroupDataSource
-
-- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
-{
- if (_representedListOfAlbums != nil) {
- return _representedListOfAlbums.count;
- }
-
- 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;
-}
-
- at end
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupDataSource.h
=====================================
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * VLCLibraryAudioGroupDataSource.h: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2022 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/VLCLibraryTableView.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+ at class VLCLibraryModel;
+ at class VLCLibraryAudioGroupDataSource;
+ at class VLCMediaLibraryAlbum;
+
+ at interface VLCLibraryAudioGroupDataSource : NSObject <VLCLibraryTableViewDataSource, NSTableViewDelegate, NSCollectionViewDataSource>
+
+ at property (readwrite, retain, nullable) NSArray <VLCMediaLibraryAlbum *> *representedListOfAlbums;
+
+ at end
+
+NS_ASSUME_NONNULL_END
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupDataSource.m
=====================================
@@ -0,0 +1,120 @@
+/*****************************************************************************
+ * VLCLibraryAudioGroupDataSource.m: MacOS X interface module
+ *****************************************************************************
+ * Copyright (C) 2022 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 "VLCLibraryAudioGroupDataSource.h"
+
+#import "main/VLCMain.h"
+
+#import "library/VLCLibraryDataTypes.h"
+#import "library/VLCLibraryCollectionViewItem.h"
+#import "library/VLCLibraryCollectionViewFlowLayout.h"
+#import "library/VLCLibraryWindow.h"
+
+#import "library/audio-library/VLCLibraryAlbumTableCellView.h"
+#import "library/audio-library/VLCLibraryCollectionViewAlbumSupplementaryDetailView.h"
+
+#import "views/VLCSubScrollView.h"
+
+ at implementation VLCLibraryAudioGroupDataSource
+
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
+{
+ if (_representedListOfAlbums != nil) {
+ return _representedListOfAlbums.count;
+ }
+
+ 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
+{
+ return _representedListOfAlbums.count;
+}
+
+- (NSInteger)numberOfSectionsInCollectionView:(NSCollectionView *)collectionView
+{
+ return 1;
+}
+
+- (NSCollectionViewItem *)collectionView:(NSCollectionView *)collectionView
+ itemForRepresentedObjectAtIndexPath:(NSIndexPath *)indexPath
+{
+ VLCLibraryCollectionViewItem *viewItem = [collectionView makeItemWithIdentifier:VLCLibraryCellIdentifier forIndexPath:indexPath];
+ viewItem.representedItem = _representedListOfAlbums[indexPath.item];
+ return viewItem;
+}
+
+- (NSView *)collectionView:(NSCollectionView *)collectionView
+viewForSupplementaryElementOfKind:(NSCollectionViewSupplementaryElementKind)kind
+ atIndexPath:(NSIndexPath *)indexPath
+{
+ if ([kind isEqualToString:VLCLibraryCollectionViewAlbumSupplementaryDetailViewKind]) {
+
+ VLCLibraryCollectionViewAlbumSupplementaryDetailView* albumSupplementaryDetailView = [collectionView makeSupplementaryViewOfKind:kind withIdentifier:VLCLibraryCollectionViewAlbumSupplementaryDetailViewKind forIndexPath:indexPath];
+
+ VLCMediaLibraryAlbum *album = _representedListOfAlbums[indexPath.item];
+ albumSupplementaryDetailView.representedAlbum = album;
+ albumSupplementaryDetailView.selectedItem = [collectionView itemAtIndex:indexPath.item];
+ albumSupplementaryDetailView.parentScrollView = [VLCMain sharedInstance].libraryWindow.audioCollectionViewScrollView;
+ albumSupplementaryDetailView.internalScrollView.scrollParentY = YES;
+
+ return albumSupplementaryDetailView;
+
+ }
+
+ return nil;
+}
+
+ at end
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.h
=====================================
@@ -23,7 +23,7 @@
#import <Cocoa/Cocoa.h>
@class VLCLibraryAudioDataSource;
- at class VLCLibraryGroupDataSource;
+ at class VLCLibraryAudioGroupDataSource;
@class VLCLibraryWindow;
NS_ASSUME_NONNULL_BEGIN
@@ -42,6 +42,11 @@ NS_ASSUME_NONNULL_BEGIN
@property (readonly) NSTableView *audioSongTableView;
@property (readonly) NSScrollView *audioCollectionViewScrollView;
@property (readonly) NSCollectionView *audioLibraryCollectionView;
+ at property (readonly) NSSplitView *audioLibraryGridModeSplitView;
+ at property (readonly) NSScrollView *audioLibraryGridModeSplitViewListTableViewScrollView;
+ at property (readonly) NSTableView *audioLibraryGridModeSplitViewListTableView;
+ at property (readonly) NSScrollView *audioLibraryGridModeSplitViewListSelectionCollectionViewScrollView;
+ at property (readonly) NSCollectionView *audioLibraryGridModeSplitViewListSelectionCollectionView;
@property (readonly) NSSegmentedControl *audioSegmentedControl;
@property (readonly) NSSegmentedControl *gridVsListSegmentedControl;
@property (readonly) NSButton *librarySortButton;
@@ -52,7 +57,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (readonly) NSView *emptyLibraryView;
@property (readonly) VLCLibraryAudioDataSource *audioDataSource;
- at property (readonly) VLCLibraryGroupDataSource *audioGroupDataSource;
+ at property (readonly) VLCLibraryAudioGroupDataSource *audioGroupDataSource;
@property (readonly) NSArray<NSLayoutConstraint *> *audioPlaceholderImageViewSizeConstraints;
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryAudioViewController.m
=====================================
@@ -32,6 +32,7 @@
#import "library/VLCLibraryWindow.h"
#import "library/audio-library/VLCLibraryAudioDataSource.h"
+#import "library/audio-library/VLCLibraryAudioGroupDataSource.h"
#import "library/video-library/VLCLibraryVideoViewController.h"
@@ -57,7 +58,11 @@
if(self) {
[self setupPropertiesFromLibraryWindow:libraryWindow];
[self setupAudioDataSource];
+
+ _audioLibraryCollectionViewDelegate = [[VLCLibraryCollectionViewDelegate alloc] init];
+
[self setupAudioCollectionView];
+ [self setupGridModeSplitView];
[self setupAudioTableViews];
[self setupAudioSegmentedControl];
}
@@ -81,6 +86,12 @@
_audioSongTableView = libraryWindow.audioLibrarySongsTableView;
_audioCollectionViewScrollView = libraryWindow.audioCollectionViewScrollView;
_audioLibraryCollectionView = libraryWindow.audioLibraryCollectionView;
+ _audioLibraryGridModeSplitView = libraryWindow.audioLibraryGridModeSplitView;
+ _audioLibraryGridModeSplitViewListTableViewScrollView = libraryWindow.audioLibraryGridModeSplitViewListTableViewScrollView;
+ _audioLibraryGridModeSplitViewListTableView = libraryWindow.audioLibraryGridModeSplitViewListTableView;
+ _audioLibraryGridModeSplitViewListSelectionCollectionViewScrollView = libraryWindow.audioLibraryGridModeSplitViewListSelectionCollectionViewScrollView;
+ _audioLibraryGridModeSplitViewListSelectionCollectionView = libraryWindow.audioLibraryGridModeSplitViewListSelectionCollectionView;
+
_audioSegmentedControl = libraryWindow.audioSegmentedControl;
_gridVsListSegmentedControl = libraryWindow.gridVsListSegmentedControl;
_optionBarView = libraryWindow.optionBarView;
@@ -99,21 +110,23 @@
_audioDataSource.groupSelectionTableView = _audioGroupSelectionTableView;
_audioDataSource.songsTableView = _audioSongTableView;
_audioDataSource.collectionView = _audioLibraryCollectionView;
+ _audioDataSource.gridModeListTableView = _audioLibraryGridModeSplitViewListTableView;
+ _audioDataSource.gridModeListSelectionCollectionView = _audioLibraryGridModeSplitViewListSelectionCollectionView;
[_audioDataSource setup];
- _audioGroupDataSource = [[VLCLibraryGroupDataSource alloc] init];
- _audioDataSource.groupDataSource = _audioGroupDataSource;
+ _audioGroupDataSource = [[VLCLibraryAudioGroupDataSource alloc] init];
+ _audioDataSource.audioGroupDataSource = _audioGroupDataSource;
}
- (void)setupAudioCollectionView
{
+ _audioLibraryCollectionView.dataSource = _audioDataSource;
+ _audioLibraryCollectionView.delegate = _audioLibraryCollectionViewDelegate;
+
_audioLibraryCollectionView.selectable = YES;
_audioLibraryCollectionView.allowsMultipleSelection = NO;
_audioLibraryCollectionView.allowsEmptySelection = YES;
- _audioLibraryCollectionViewDelegate = [[VLCLibraryCollectionViewDelegate alloc] init];
- _audioLibraryCollectionView.delegate = _audioLibraryCollectionViewDelegate;
-
_audioLibraryCollectionView.collectionViewLayout = [[VLCLibraryCollectionViewFlowLayout alloc] init];
}
@@ -133,6 +146,21 @@
_audioSongTableView.delegate = _audioDataSource;
}
+- (void)setupGridModeSplitView
+{
+ _audioLibraryGridModeSplitViewListTableView.dataSource = _audioDataSource;
+ _audioLibraryGridModeSplitViewListTableView.delegate = _audioDataSource;
+
+ _audioLibraryGridModeSplitViewListSelectionCollectionView.dataSource = _audioGroupDataSource;
+ _audioLibraryGridModeSplitViewListSelectionCollectionView.delegate = _audioLibraryCollectionViewDelegate;
+
+ _audioLibraryGridModeSplitViewListSelectionCollectionView.selectable = YES;
+ _audioLibraryGridModeSplitViewListSelectionCollectionView.allowsMultipleSelection = NO;
+ _audioLibraryGridModeSplitViewListSelectionCollectionView.allowsEmptySelection = YES;
+
+ _audioLibraryGridModeSplitViewListSelectionCollectionView.collectionViewLayout = [[VLCLibraryCollectionViewFlowLayout alloc] init];
+}
+
- (void)setupAudioPlaceholderView
{
_audioPlaceholderImageViewSizeConstraints = @[
@@ -232,20 +260,37 @@
[_libraryTargetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_audioLibraryView(>=444.)]|" options:0 metrics:0 views:dict]];
if (self.gridVsListSegmentedControl.selectedSegment == VLCGridViewModeSegment) {
- _audioLibrarySplitView.hidden = YES;
- _audioSongTableViewScrollView.hidden = YES;
- _audioCollectionViewScrollView.hidden = NO;
+ [self presentAudioGridModeView];
} else {
[self presentAudioTableView];
- _audioCollectionViewScrollView.hidden = YES;
}
[self configureAudioSegmentedControl];
[self segmentedControlAction:VLCMain.sharedInstance.libraryWindow.navigationStack];
}
+- (void)presentAudioGridModeView
+{
+ _audioLibrarySplitView.hidden = YES;
+ _audioSongTableViewScrollView.hidden = YES;
+
+ if (_audioSegmentedControl.selectedSegment == VLCAudioLibrarySongsSegment ||
+ _audioSegmentedControl.selectedSegment == VLCAudioLibraryAlbumsSegment) {
+
+ _audioCollectionViewScrollView.hidden = NO;
+ _audioLibraryGridModeSplitView.hidden = YES;
+ return;
+ }
+
+ _audioCollectionViewScrollView.hidden = YES;
+ _audioLibraryGridModeSplitView.hidden = NO;
+}
+
- (void)presentAudioTableView
{
+ _audioCollectionViewScrollView.hidden = YES;
+ _audioLibraryGridModeSplitView.hidden = YES;
+
if (_audioSegmentedControl.selectedSegment == VLCAudioLibrarySongsSegment) {
_audioLibrarySplitView.hidden = YES;
_audioSongTableViewScrollView.hidden = NO;
@@ -265,6 +310,8 @@
if (self.gridVsListSegmentedControl.selectedSegment == VLCListViewModeSegment) {
[self presentAudioTableView];
+ } else if (self.gridVsListSegmentedControl.selectedSegment == VLCGridViewModeSegment) {
+ [self presentAudioGridModeView];
}
VLCLibraryNavigationStack *globalNavStack = VLCMain.sharedInstance.libraryWindow.navigationStack;
=====================================
modules/gui/macosx/library/audio-library/VLCLibraryCollectionViewAudioGroupSupplementaryDetailView.m
=====================================
@@ -25,14 +25,14 @@
#import "library/VLCLibraryDataTypes.h"
#import "extensions/NSFont+VLCAdditions.h"
-#import "library/audio-library/VLCLibraryAudioDataSource.h"
+#import "library/audio-library/VLCLibraryAudioGroupDataSource.h"
NSString *const VLCLibraryCollectionViewAudioGroupSupplementaryDetailViewIdentifier = @"VLCLibraryCollectionViewAudioGroupSupplementaryDetailViewIdentifier";
NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewAudioGroupSupplementaryDetailViewKind = @"VLCLibraryCollectionViewAudioGroupSupplementaryDetailViewIdentifier";
@interface VLCLibraryCollectionViewAudioGroupSupplementaryDetailView ()
{
- VLCLibraryGroupDataSource *_audioGroupAlbumsDataSource;
+ VLCLibraryAudioGroupDataSource *_audioGroupAlbumsDataSource;
}
@end
@@ -41,7 +41,7 @@ NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewAudioGrou
- (void)awakeFromNib
{
- _audioGroupAlbumsDataSource = [[VLCLibraryGroupDataSource alloc] init];
+ _audioGroupAlbumsDataSource = [[VLCLibraryAudioGroupDataSource alloc] init];
_audioGroupAlbumsTableView.dataSource = _audioGroupAlbumsDataSource;
_audioGroupAlbumsTableView.delegate = _audioGroupAlbumsDataSource;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cbdb999cb7140d2bb85b884848b67ec6592e49e8...87baf648530c9bfbb51a9a3ec169826c1db26cb3
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cbdb999cb7140d2bb85b884848b67ec6592e49e8...87baf648530c9bfbb51a9a3ec169826c1db26cb3
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