[vlc-commits] macosx/library: move recent media to its on collection view

Felix Paul Kühne git at videolan.org
Mon May 6 11:03:31 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Mon May  6 11:02:21 2019 +0200| [30fc2fd4be67f70f0e7a892504fd64beeee3776f] | committer: Felix Paul Kühne

macosx/library: move recent media to its on collection view

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=30fc2fd4be67f70f0e7a892504fd64beeee3776f
---

 .../gui/macosx/UI/VLCLibraryCollectionViewItem.xib |   4 +-
 modules/gui/macosx/UI/VLCLibraryWindow.xib         | 158 ++++++++++++++-------
 modules/gui/macosx/library/VLCLibraryDataSource.h  |   2 +
 modules/gui/macosx/library/VLCLibraryDataSource.m  |   8 +-
 modules/gui/macosx/library/VLCLibraryModel.m       |   5 +-
 modules/gui/macosx/library/VLCLibraryWindow.h      |   4 +-
 modules/gui/macosx/library/VLCLibraryWindow.m      |  30 ++--
 7 files changed, 140 insertions(+), 71 deletions(-)

diff --git a/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib b/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib
index 4639a95f6f..7747707f6a 100644
--- a/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib
+++ b/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib
@@ -55,7 +55,6 @@
                     <constraints>
                         <constraint firstAttribute="bottom" secondItem="dFt-oZ-h9P" secondAttribute="bottom" id="4q3-3S-7PA"/>
                         <constraint firstItem="S3I-5Z-qgS" firstAttribute="centerX" secondItem="2aB-sB-hfY" secondAttribute="centerX" id="Seo-tS-piW"/>
-                        <constraint firstAttribute="height" constant="168" id="Vrp-AD-scC"/>
                         <constraint firstItem="S3I-5Z-qgS" firstAttribute="centerY" secondItem="2aB-sB-hfY" secondAttribute="centerY" id="ZWU-oW-OVa"/>
                         <constraint firstItem="dFt-oZ-h9P" firstAttribute="leading" secondItem="2aB-sB-hfY" secondAttribute="leading" id="gTe-sx-hdP"/>
                         <constraint firstAttribute="trailing" secondItem="dFt-oZ-h9P" secondAttribute="trailing" id="kBI-UU-vnc"/>
@@ -101,13 +100,14 @@
                 </textField>
             </subviews>
             <constraints>
+                <constraint firstItem="2aB-sB-hfY" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="3Ah-0T-rA9"/>
                 <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="OBS-Eh-1mT" secondAttribute="trailing" id="457-oy-EbD"/>
                 <constraint firstItem="Ubz-8I-W2F" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="7" id="8Qf-Un-Gdl"/>
+                <constraint firstItem="VAn-gF-QiZ" firstAttribute="top" secondItem="OBS-Eh-1mT" secondAttribute="bottom" constant="-1" id="ALi-0z-Mza"/>
                 <constraint firstAttribute="trailing" secondItem="u2r-zy-XEW" secondAttribute="trailing" id="Dd7-va-0UJ"/>
                 <constraint firstItem="u2r-zy-XEW" firstAttribute="centerY" secondItem="VAn-gF-QiZ" secondAttribute="centerY" id="H5N-j9-THf"/>
                 <constraint firstAttribute="bottom" secondItem="VAn-gF-QiZ" secondAttribute="bottom" id="Kp0-Hx-3Ek"/>
                 <constraint firstItem="VAn-gF-QiZ" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="QUW-dn-Fbc"/>
-                <constraint firstItem="2aB-sB-hfY" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="YP6-lv-ECe"/>
                 <constraint firstAttribute="trailing" secondItem="Ubz-8I-W2F" secondAttribute="trailing" constant="20" id="ZVz-SL-rxZ"/>
                 <constraint firstItem="tm2-NW-WsZ" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="7" id="cvk-A5-enS"/>
                 <constraint firstItem="tm2-NW-WsZ" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="12" id="fH0-Om-7gV"/>
diff --git a/modules/gui/macosx/UI/VLCLibraryWindow.xib b/modules/gui/macosx/UI/VLCLibraryWindow.xib
index f516b40197..af383765c6 100644
--- a/modules/gui/macosx/UI/VLCLibraryWindow.xib
+++ b/modules/gui/macosx/UI/VLCLibraryWindow.xib
@@ -18,12 +18,12 @@
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="196" y="240" width="480" height="363"/>
             <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/>
-            <view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
-                <rect key="frame" x="0.0" y="0.0" width="480" height="363"/>
-                <autoresizingMask key="autoresizingMask"/>
+            <view key="contentView" wantsLayer="YES" misplaced="YES" id="EiT-Mj-1SZ">
+                <rect key="frame" x="0.0" y="0.0" width="480" height="654"/>
+                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                 <subviews>
                     <segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="W1M-0o-qYG">
-                        <rect key="frame" x="88" y="332" width="304" height="25"/>
+                        <rect key="frame" x="88" y="849" width="304" height="25"/>
                         <constraints>
                             <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="300" id="Wg7-mn-ahw"/>
                         </constraints>
@@ -37,47 +37,99 @@
                         </segmentedCell>
                     </segmentedControl>
                     <splitView autosaveName="librarywindowsplitview" dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="u8g-jy-S4e">
-                        <rect key="frame" x="0.0" y="36" width="480" height="291"/>
+                        <rect key="frame" x="0.0" y="36" width="480" height="808"/>
                         <subviews>
-                            <customView id="iSp-bV-w6B">
-                                <rect key="frame" x="0.0" y="0.0" width="242" height="291"/>
+                            <customView misplaced="YES" id="iSp-bV-w6B">
+                                <rect key="frame" x="0.0" y="0.0" width="242" height="808"/>
                                 <autoresizingMask key="autoresizingMask"/>
                                 <subviews>
-                                    <scrollView wantsLayer="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nXS-11-7iK">
-                                        <rect key="frame" x="0.0" y="0.0" width="242" height="291"/>
-                                        <clipView key="contentView" id="OKa-dt-1yY">
-                                            <rect key="frame" x="0.0" y="0.0" width="242" height="291"/>
-                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                                            <subviews>
-                                                <collectionView selectable="YES" id="B8x-e8-7zp" customClass="VLCLibraryCollectionView">
-                                                    <rect key="frame" x="0.0" y="0.0" width="242" height="291"/>
-                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
-                                                    <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="20" minimumLineSpacing="20" id="Rag-cM-k1g">
-                                                        <size key="itemSize" width="256" height="214"/>
-                                                        <edgeInsets key="sectionInset" left="20" right="20" top="20" bottom="20"/>
-                                                    </collectionViewFlowLayout>
-                                                    <color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
-                                                    <color key="secondaryBackgroundColor" name="controlAlternatingRowColor" catalog="System" colorSpace="catalog"/>
-                                                </collectionView>
-                                            </subviews>
-                                        </clipView>
-                                        <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="7ik-B8-JYg">
-                                            <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="rUh-Qg-gUL">
-                                            <rect key="frame" x="226" y="0.0" width="16" height="291"/>
-                                            <autoresizingMask key="autoresizingMask"/>
-                                        </scroller>
-                                    </scrollView>
-                                    <scrollView wantsLayer="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cFG-c9-cI9">
-                                        <rect key="frame" x="0.0" y="0.0" width="242" height="291"/>
+                                    <stackView distribution="fill" orientation="vertical" alignment="leading" spacing="0.0" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vak-Gp-ljo">
+                                        <rect key="frame" x="0.0" y="0.0" width="242" height="808"/>
+                                        <subviews>
+                                            <scrollView wantsLayer="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HmU-mL-Tjk">
+                                                <rect key="frame" x="0.0" y="364" width="242" height="444"/>
+                                                <clipView key="contentView" id="J5s-sy-il6">
+                                                    <rect key="frame" x="0.0" y="0.0" width="242" height="444"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <subviews>
+                                                        <collectionView selectable="YES" id="hnE-Hj-MZo">
+                                                            <rect key="frame" x="0.0" y="0.0" width="242" height="444"/>
+                                                            <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
+                                                            <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="20" minimumLineSpacing="20" scrollDirection="horizontal" id="N2a-bI-WQc">
+                                                                <size key="itemSize" width="532" height="404"/>
+                                                                <edgeInsets key="sectionInset" left="20" right="20" top="20" bottom="20"/>
+                                                            </collectionViewFlowLayout>
+                                                            <color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                            <color key="secondaryBackgroundColor" name="controlAlternatingRowColor" catalog="System" colorSpace="catalog"/>
+                                                        </collectionView>
+                                                    </subviews>
+                                                </clipView>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="444" id="Htb-Ql-chZ"/>
+                                                </constraints>
+                                                <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="f2z-AL-CFF">
+                                                    <rect key="frame" x="-100" y="-100" width="233" height="15"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                </scroller>
+                                                <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="psR-Xx-0YH">
+                                                    <rect key="frame" x="-100" y="-100" width="16" height="218"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                </scroller>
+                                            </scrollView>
+                                            <scrollView wantsLayer="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nXS-11-7iK">
+                                                <rect key="frame" x="0.0" y="0.0" width="242" height="364"/>
+                                                <clipView key="contentView" id="OKa-dt-1yY">
+                                                    <rect key="frame" x="0.0" y="0.0" width="242" height="364"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <subviews>
+                                                        <collectionView selectable="YES" id="B8x-e8-7zp" customClass="VLCLibraryCollectionView">
+                                                            <rect key="frame" x="0.0" y="0.0" width="242" height="364"/>
+                                                            <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
+                                                            <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="20" minimumLineSpacing="20" id="Rag-cM-k1g">
+                                                                <size key="itemSize" width="256" height="214"/>
+                                                                <edgeInsets key="sectionInset" left="20" right="20" top="20" bottom="20"/>
+                                                            </collectionViewFlowLayout>
+                                                            <color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                            <color key="secondaryBackgroundColor" name="controlAlternatingRowColor" catalog="System" colorSpace="catalog"/>
+                                                        </collectionView>
+                                                    </subviews>
+                                                </clipView>
+                                                <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="7ik-B8-JYg">
+                                                    <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="rUh-Qg-gUL">
+                                                    <rect key="frame" x="226" y="0.0" width="16" height="291"/>
+                                                    <autoresizingMask key="autoresizingMask"/>
+                                                </scroller>
+                                            </scrollView>
+                                        </subviews>
+                                        <constraints>
+                                            <constraint firstItem="HmU-mL-Tjk" firstAttribute="leading" secondItem="vak-Gp-ljo" secondAttribute="leading" id="5co-en-4Uf"/>
+                                            <constraint firstAttribute="trailing" secondItem="HmU-mL-Tjk" secondAttribute="trailing" id="9Wn-DC-CFC"/>
+                                            <constraint firstItem="nXS-11-7iK" firstAttribute="leading" secondItem="vak-Gp-ljo" secondAttribute="leading" id="LP8-Hf-WCx"/>
+                                            <constraint firstItem="HmU-mL-Tjk" firstAttribute="top" secondItem="vak-Gp-ljo" secondAttribute="top" id="XE0-gE-X8v"/>
+                                            <constraint firstAttribute="trailing" secondItem="nXS-11-7iK" secondAttribute="trailing" id="kmc-KU-iRY"/>
+                                            <constraint firstAttribute="bottom" secondItem="nXS-11-7iK" secondAttribute="bottom" id="tpH-Q7-TH4"/>
+                                            <constraint firstItem="nXS-11-7iK" firstAttribute="top" secondItem="HmU-mL-Tjk" secondAttribute="bottom" id="w6G-g6-ZtO"/>
+                                        </constraints>
+                                        <visibilityPriorities>
+                                            <integer value="1000"/>
+                                            <integer value="1000"/>
+                                        </visibilityPriorities>
+                                        <customSpacing>
+                                            <real value="3.4028234663852886e+38"/>
+                                            <real value="3.4028234663852886e+38"/>
+                                        </customSpacing>
+                                    </stackView>
+                                    <scrollView wantsLayer="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cFG-c9-cI9">
+                                        <rect key="frame" x="0.0" y="0.0" width="242" height="808"/>
                                         <clipView key="contentView" id="tI4-x3-55j">
-                                            <rect key="frame" x="0.0" y="0.0" width="242" height="291"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="242" height="808"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             <subviews>
                                                 <collectionView id="r7v-GI-W1U">
-                                                    <rect key="frame" x="0.0" y="0.0" width="242" height="158"/>
+                                                    <rect key="frame" x="0.0" y="0.0" width="242" height="808"/>
                                                     <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
                                                     <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" id="v0C-1b-7Ss">
                                                         <size key="itemSize" width="210" height="150"/>
@@ -87,7 +139,7 @@
                                             </subviews>
                                         </clipView>
                                         <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="WUt-1y-tQd">
-                                            <rect key="frame" x="1" y="143" width="240" height="16"/>
+                                            <rect key="frame" x="-100" y="-100" width="240" height="16"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                         </scroller>
                                         <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="247-FY-ZXk">
@@ -98,21 +150,21 @@
                                 </subviews>
                                 <constraints>
                                     <constraint firstAttribute="trailing" secondItem="cFG-c9-cI9" secondAttribute="trailing" id="0zl-H8-IAo"/>
+                                    <constraint firstItem="vak-Gp-ljo" firstAttribute="leading" secondItem="iSp-bV-w6B" secondAttribute="leading" id="7Kf-lr-a7P"/>
                                     <constraint firstItem="cFG-c9-cI9" firstAttribute="leading" secondItem="iSp-bV-w6B" secondAttribute="leading" id="8SS-VG-YAQ"/>
-                                    <constraint firstItem="nXS-11-7iK" firstAttribute="leading" secondItem="iSp-bV-w6B" secondAttribute="leading" id="SPv-yC-58y"/>
-                                    <constraint firstItem="nXS-11-7iK" firstAttribute="top" secondItem="iSp-bV-w6B" secondAttribute="top" id="Sje-VZ-Kcw"/>
-                                    <constraint firstAttribute="trailing" secondItem="nXS-11-7iK" secondAttribute="trailing" id="Tuh-vj-qaU"/>
+                                    <constraint firstAttribute="trailing" secondItem="vak-Gp-ljo" secondAttribute="trailing" id="JmX-Jh-gqa"/>
+                                    <constraint firstItem="vak-Gp-ljo" firstAttribute="top" secondItem="iSp-bV-w6B" secondAttribute="top" id="WPE-jF-WiQ"/>
                                     <constraint firstAttribute="bottom" secondItem="cFG-c9-cI9" secondAttribute="bottom" id="oAJ-yE-oGZ"/>
-                                    <constraint firstAttribute="bottom" secondItem="nXS-11-7iK" secondAttribute="bottom" id="piy-A4-FaO"/>
                                     <constraint firstItem="cFG-c9-cI9" firstAttribute="top" secondItem="iSp-bV-w6B" secondAttribute="top" id="wBq-BN-AMy"/>
+                                    <constraint firstAttribute="bottom" secondItem="vak-Gp-ljo" secondAttribute="bottom" id="x8Z-Ec-6sN"/>
                                 </constraints>
                             </customView>
-                            <customView id="dus-WQ-AmE">
-                                <rect key="frame" x="243" y="0.0" width="237" height="291"/>
+                            <customView misplaced="YES" id="dus-WQ-AmE">
+                                <rect key="frame" x="243" y="0.0" width="237" height="808"/>
                                 <autoresizingMask key="autoresizingMask"/>
                                 <subviews>
                                     <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Vry-OZ-ySI">
-                                        <rect key="frame" x="18" y="274" width="51" height="17"/>
+                                        <rect key="frame" x="18" y="791" width="51" height="17"/>
                                         <textFieldCell key="cell" lineBreakMode="clipping" title="Up next" id="7PB-pT-1Xp">
                                             <font key="font" usesAppearanceFont="YES"/>
                                             <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -120,16 +172,16 @@
                                         </textFieldCell>
                                     </textField>
                                     <box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="qmL-Ar-cj1">
-                                        <rect key="frame" x="20" y="247" width="197" height="5"/>
+                                        <rect key="frame" x="20" y="764" width="197" height="5"/>
                                     </box>
                                     <scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Z7y-D0-11Q">
-                                        <rect key="frame" x="20" y="63" width="217" height="178"/>
+                                        <rect key="frame" x="20" y="63" width="217" height="695"/>
                                         <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="Vdr-bg-tuS">
-                                            <rect key="frame" x="0.0" y="0.0" width="217" height="178"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="217" height="695"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             <subviews>
                                                 <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="Fr1-af-8gb" customClass="VLCPlaylistTableView">
-                                                    <rect key="frame" x="0.0" y="0.0" width="217" height="178"/>
+                                                    <rect key="frame" x="0.0" y="0.0" width="217" height="695"/>
                                                     <autoresizingMask key="autoresizingMask"/>
                                                     <size key="intercellSpacing" width="3" height="2"/>
                                                     <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
@@ -362,7 +414,7 @@
                         </constraints>
                     </customView>
                     <customView hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="12s-0J-Uvj" customClass="VLCVoutView">
-                        <rect key="frame" x="0.0" y="36" width="480" height="291"/>
+                        <rect key="frame" x="0.0" y="36" width="480" height="808"/>
                     </customView>
                 </subviews>
                 <constraints>
@@ -385,15 +437,17 @@
             <connections>
                 <outlet property="clearPlaylistButton" destination="cih-xp-HmY" id="PoU-co-0kn"/>
                 <outlet property="clearPlaylistSeparator" destination="nAW-KH-ipk" id="Af9-fg-u7m"/>
-                <outlet property="libraryCollectionView" destination="B8x-e8-7zp" id="djF-Lw-nXT"/>
                 <outlet property="mediaSourceCollectionView" destination="r7v-GI-W1U" id="3JJ-GU-o5o"/>
                 <outlet property="mediaSourceScrollView" destination="cFG-c9-cI9" id="gRO-Y7-kdb"/>
                 <outlet property="playlistTableView" destination="Fr1-af-8gb" id="yaB-Ab-jrx"/>
+                <outlet property="recentVideoLibraryCollectionView" destination="hnE-Hj-MZo" id="Fko-5v-1bC"/>
                 <outlet property="repeatPlaylistButton" destination="8zF-Wo-H79" id="6bH-HF-arx"/>
                 <outlet property="segmentedTitleControl" destination="W1M-0o-qYG" id="Gw1-T6-78k"/>
                 <outlet property="shufflePlaylistButton" destination="jg5-33-vH0" id="FV2-36-3lG"/>
                 <outlet property="upNextLabel" destination="Vry-OZ-ySI" id="KxM-oZ-tSg"/>
                 <outlet property="upNextSeparator" destination="qmL-Ar-cj1" id="GRX-ZE-2UG"/>
+                <outlet property="videoLibraryCollectionView" destination="B8x-e8-7zp" id="u1I-gn-IU1"/>
+                <outlet property="videoLibraryStackView" destination="vak-Gp-ljo" id="ulu-pc-ctF"/>
                 <outlet property="videoView" destination="12s-0J-Uvj" id="zTg-s0-qZ5"/>
             </connections>
             <point key="canvasLocation" x="139" y="204.5"/>
diff --git a/modules/gui/macosx/library/VLCLibraryDataSource.h b/modules/gui/macosx/library/VLCLibraryDataSource.h
index abb4daed9e..ab2dc75401 100644
--- a/modules/gui/macosx/library/VLCLibraryDataSource.h
+++ b/modules/gui/macosx/library/VLCLibraryDataSource.h
@@ -29,6 +29,8 @@ NS_ASSUME_NONNULL_BEGIN
 @interface VLCLibraryDataSource : NSObject <NSCollectionViewDataSource, NSCollectionViewDelegate>
 
 @property (readwrite, assign) VLCLibraryModel *libraryModel;
+ at property (readwrite, assign) NSCollectionView *recentMediaCollectionView;
+ at property (readwrite, assign) NSCollectionView *libraryMediaCollectionView;
 
 @end
 
diff --git a/modules/gui/macosx/library/VLCLibraryDataSource.m b/modules/gui/macosx/library/VLCLibraryDataSource.m
index 8f6d04726f..f57b19b374 100644
--- a/modules/gui/macosx/library/VLCLibraryDataSource.m
+++ b/modules/gui/macosx/library/VLCLibraryDataSource.m
@@ -34,7 +34,7 @@
 - (NSInteger)collectionView:(NSCollectionView *)collectionView
      numberOfItemsInSection:(NSInteger)section
 {
-    if (_libraryModel.numberOfRecentMedia && section == 0) {
+    if (collectionView == self.recentMediaCollectionView) {
         return [_libraryModel numberOfRecentMedia];
     }
 
@@ -55,7 +55,7 @@
 
 - (NSInteger)numberOfSectionsInCollectionView:(NSCollectionView *)collectionView
 {
-    return _libraryModel.numberOfRecentMedia > 0 ? 2 : 1;
+    return 1;
 }
 
 - (NSCollectionViewItem *)collectionView:(NSCollectionView *)collectionView
@@ -64,7 +64,7 @@
     VLCLibraryCollectionViewItem *viewItem = [collectionView makeItemWithIdentifier:VLCLibraryCellIdentifier forIndexPath:indexPath];
 
     NSArray *mediaArray;
-    if (indexPath.section == 0 && _libraryModel.numberOfRecentMedia > 0) {
+    if (collectionView == self.recentMediaCollectionView) {
         mediaArray = [_libraryModel listOfRecentMedia];
     } else {
         switch (_libraryModel.libraryMode) {
@@ -95,7 +95,7 @@ viewForSupplementaryElementOfKind:(NSCollectionViewSupplementaryElementKind)kind
     VLCLibraryCollectionViewSupplementaryElementView *view = [collectionView makeSupplementaryViewOfKind:kind
                                                                                           withIdentifier:VLCLibrarySupplementaryElementViewIdentifier
                                                                                             forIndexPath:indexPath];
-    if (indexPath.section == 0 && _libraryModel.numberOfRecentMedia > 0) {
+    if (collectionView == self.recentMediaCollectionView) {
         view.stringValue = _NS("Recent");
     } else {
         view.stringValue = _NS("Library");
diff --git a/modules/gui/macosx/library/VLCLibraryModel.m b/modules/gui/macosx/library/VLCLibraryModel.m
index e8bac59ba4..23c302de8a 100644
--- a/modules/gui/macosx/library/VLCLibraryModel.m
+++ b/modules/gui/macosx/library/VLCLibraryModel.m
@@ -211,7 +211,10 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event)
 
 - (void)updateCachedListOfRecentMedia
 {
-    vlc_ml_media_list_t *p_media_list = vlc_ml_list_history(_p_mediaLibrary, NULL);
+    vlc_ml_query_params_t queryParameters;
+    memset(&queryParameters, 0, sizeof(vlc_ml_query_params_t));
+    queryParameters.i_nbResults = 20;
+    vlc_ml_media_list_t *p_media_list = vlc_ml_list_history(_p_mediaLibrary, &queryParameters);
     if (p_media_list == NULL) {
         return;
     }
diff --git a/modules/gui/macosx/library/VLCLibraryWindow.h b/modules/gui/macosx/library/VLCLibraryWindow.h
index 18f5f7b7a3..df65de2363 100644
--- a/modules/gui/macosx/library/VLCLibraryWindow.h
+++ b/modules/gui/macosx/library/VLCLibraryWindow.h
@@ -36,7 +36,9 @@ NS_ASSUME_NONNULL_BEGIN
 @interface VLCLibraryWindow : VLCVideoWindowCommon
 
 @property (readwrite, weak) IBOutlet NSSegmentedControl *segmentedTitleControl;
- at property (readwrite, weak) IBOutlet VLCLibraryCollectionView *libraryCollectionView;
+ at property (readwrite, weak) IBOutlet NSStackView *videoLibraryStackView;
+ at property (readwrite, weak) IBOutlet VLCLibraryCollectionView *videoLibraryCollectionView;
+ at property (readwrite, weak) IBOutlet NSCollectionView *recentVideoLibraryCollectionView;
 @property (readwrite, weak) IBOutlet NSCollectionView *mediaSourceCollectionView;
 @property (readwrite, weak) IBOutlet NSScrollView *mediaSourceScrollView;
 @property (readwrite, weak) IBOutlet NSTableView *playlistTableView;
diff --git a/modules/gui/macosx/library/VLCLibraryWindow.m b/modules/gui/macosx/library/VLCLibraryWindow.m
index f3d754e024..db3749bc38 100644
--- a/modules/gui/macosx/library/VLCLibraryWindow.m
+++ b/modules/gui/macosx/library/VLCLibraryWindow.m
@@ -128,13 +128,18 @@ static const float f_playlist_row_height = 72.;
 
     _libraryDataSource = [[VLCLibraryDataSource alloc] init];
     _libraryDataSource.libraryModel = mainInstance.libraryController.libraryModel;
-    _libraryCollectionView.dataSource = _libraryDataSource;
-    _libraryCollectionView.delegate = _libraryDataSource;
-    [_libraryCollectionView registerClass:[VLCLibraryCollectionViewItem class] forItemWithIdentifier:VLCLibraryCellIdentifier];
-    [_libraryCollectionView registerClass:[VLCLibraryCollectionViewSupplementaryElementView class]
+    _libraryDataSource.recentMediaCollectionView = _recentVideoLibraryCollectionView;
+    _libraryDataSource.libraryMediaCollectionView = _videoLibraryCollectionView;
+    _videoLibraryCollectionView.dataSource = _libraryDataSource;
+    _videoLibraryCollectionView.delegate = _libraryDataSource;
+    [_videoLibraryCollectionView registerClass:[VLCLibraryCollectionViewItem class] forItemWithIdentifier:VLCLibraryCellIdentifier];
+    [_videoLibraryCollectionView registerClass:[VLCLibraryCollectionViewSupplementaryElementView class]
                forSupplementaryViewOfKind:NSCollectionElementKindSectionHeader
                            withIdentifier:VLCLibrarySupplementaryElementViewIdentifier];
-    [(NSCollectionViewFlowLayout *)_libraryCollectionView.collectionViewLayout setHeaderReferenceSize:[VLCLibraryCollectionViewSupplementaryElementView defaultHeaderSize]];
+    [(NSCollectionViewFlowLayout *)_videoLibraryCollectionView.collectionViewLayout setHeaderReferenceSize:[VLCLibraryCollectionViewSupplementaryElementView defaultHeaderSize]];
+    _recentVideoLibraryCollectionView.dataSource = _libraryDataSource;
+    _recentVideoLibraryCollectionView.delegate = _libraryDataSource;
+    [_recentVideoLibraryCollectionView registerClass:[VLCLibraryCollectionViewItem class] forItemWithIdentifier:VLCLibraryCellIdentifier];
 
     _mediaSourceDataSource = [[VLCMediaSourceDataSource alloc] init];
     _mediaSourceDataSource.collectionView = _mediaSourceCollectionView;
@@ -252,20 +257,22 @@ static const float f_playlist_row_height = 72.;
         case 0:
             _libraryDataSource.libraryModel.libraryMode = VLCLibraryModeVideo;
             _mediaSourceScrollView.hidden = YES;
-            _libraryCollectionView.hidden = NO;
-            [_libraryCollectionView reloadData];
+            _videoLibraryStackView.hidden = NO;
+            [_videoLibraryCollectionView reloadData];
+            [_recentVideoLibraryCollectionView reloadData];
             break;
 
         case 1:
             _libraryDataSource.libraryModel.libraryMode = VLCLibraryModeAudio;
             _mediaSourceScrollView.hidden = YES;
-            _libraryCollectionView.hidden = NO;
-            [_libraryCollectionView reloadData];
+            _videoLibraryStackView.hidden = NO;
+            [_videoLibraryCollectionView reloadData];
+            [_recentVideoLibraryCollectionView reloadData];
             break;
 
         default:
             _mediaSourceScrollView.hidden = NO;
-            _libraryCollectionView.hidden = YES;
+            _videoLibraryStackView.hidden = YES;
             [_mediaSourceDataSource loadMediaSources];
             [_mediaSourceCollectionView reloadData];
             break;
@@ -342,7 +349,8 @@ static const float f_playlist_row_height = 72.;
 #pragma mark - library representation and interaction
 - (void)updateLibraryRepresentation:(NSNotification *)aNotification
 {
-    [_libraryCollectionView reloadData];
+    [_videoLibraryCollectionView reloadData];
+    [_recentVideoLibraryCollectionView reloadData];
 }
 
 #pragma mark -



More information about the vlc-commits mailing list