vlc | branch: master | Felix Paul Kühne <fe...@feepk.net> | Mon May 6 12:12:21 2019 +0200| [fdd3c157a21ba65d014f75819c4de1c95bf29ff1] | committer: Felix Paul Kühne
macosx/library: clean view display and object interaction Data views are now removed from/added to the superview instead of hidden/unhidden Additionally, the media lookup was cleaned and generalized beyond video. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fdd3c157a21ba65d014f75819c4de1c95bf29ff1 --- modules/gui/macosx/UI/VLCLibraryWindow.xib | 251 ++++++++++----------- .../macosx/library/VLCLibraryCollectionViewItem.m | 34 ++- modules/gui/macosx/library/VLCLibraryController.h | 4 +- modules/gui/macosx/library/VLCLibraryController.m | 6 +- .../gui/macosx/library/VLCLibraryMenuController.h | 4 +- .../gui/macosx/library/VLCLibraryMenuController.m | 10 +- modules/gui/macosx/library/VLCLibraryModel.h | 2 - modules/gui/macosx/library/VLCLibraryModel.m | 13 -- modules/gui/macosx/library/VLCLibraryWindow.h | 6 +- modules/gui/macosx/library/VLCLibraryWindow.m | 70 +++--- 10 files changed, 193 insertions(+), 207 deletions(-) diff --git a/modules/gui/macosx/UI/VLCLibraryWindow.xib b/modules/gui/macosx/UI/VLCLibraryWindow.xib index af383765c6..e7ff43b58c 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" misplaced="YES" id="EiT-Mj-1SZ"> - <rect key="frame" x="0.0" y="0.0" width="480" height="654"/> + <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" widthSizable="YES" heightSizable="YES"/> <subviews> <segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="W1M-0o-qYG"> - <rect key="frame" x="88" y="849" width="304" height="25"/> + <rect key="frame" x="88" y="332" width="304" height="25"/> <constraints> <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="300" id="Wg7-mn-ahw"/> </constraints> @@ -37,134 +37,18 @@ </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="808"/> + <rect key="frame" x="0.0" y="36" width="480" height="291"/> <subviews> - <customView misplaced="YES" id="iSp-bV-w6B"> - <rect key="frame" x="0.0" y="0.0" width="242" height="808"/> + <customView fixedFrame="YES" id="iSp-bV-w6B"> + <rect key="frame" x="0.0" y="0.0" width="242" height="291"/> <autoresizingMask key="autoresizingMask"/> - <subviews> - <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="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="808"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES"/> - <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" id="v0C-1b-7Ss"> - <size key="itemSize" width="210" height="150"/> - </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="WUt-1y-tQd"> - <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"> - <rect key="frame" x="234" y="1" width="15" height="143"/> - <autoresizingMask key="autoresizingMask"/> - </scroller> - </scrollView> - </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 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 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 misplaced="YES" id="dus-WQ-AmE"> - <rect key="frame" x="243" y="0.0" width="237" height="808"/> + <customView id="dus-WQ-AmE"> + <rect key="frame" x="243" y="0.0" width="237" height="291"/> <autoresizingMask key="autoresizingMask"/> <subviews> <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Vry-OZ-ySI"> - <rect key="frame" x="18" y="791" width="51" height="17"/> + <rect key="frame" x="18" y="274" 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"/> @@ -172,16 +56,16 @@ </textFieldCell> </textField> <box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="qmL-Ar-cj1"> - <rect key="frame" x="20" y="764" width="197" height="5"/> + <rect key="frame" x="20" y="247" 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="695"/> + <rect key="frame" x="20" y="63" width="217" height="178"/> <clipView key="contentView" drawsBackground="NO" copiesOnScroll="NO" id="Vdr-bg-tuS"> - <rect key="frame" x="0.0" y="0.0" width="217" height="695"/> + <rect key="frame" x="0.0" y="0.0" width="217" height="178"/> <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="695"/> + <rect key="frame" x="0.0" y="0.0" width="217" height="178"/> <autoresizingMask key="autoresizingMask"/> <size key="intercellSpacing" width="3" height="2"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> @@ -414,7 +298,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="808"/> + <rect key="frame" x="0.0" y="36" width="480" height="291"/> </customView> </subviews> <constraints> @@ -437,6 +321,7 @@ <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="libraryTargetView" destination="iSp-bV-w6B" id="a94-ux-wUc"/> <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"/> @@ -464,6 +349,112 @@ <outlet property="timeSlider" destination="9Hg-t2-K5z" id="sVe-s8-xW6"/> </connections> </customObject> + <stackView distribution="fill" orientation="vertical" alignment="leading" spacing="0.0" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" id="vak-Gp-ljo"> + <rect key="frame" x="0.0" y="0.0" width="242" height="808"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <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"> + <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" id="cFG-c9-cI9"> + <rect key="frame" x="0.0" y="0.0" width="242" height="291"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <clipView key="contentView" id="tI4-x3-55j"> + <rect key="frame" x="0.0" y="0.0" width="242" height="291"/> + <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="291"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES"/> + <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" id="v0C-1b-7Ss"> + <size key="itemSize" width="210" height="150"/> + </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="WUt-1y-tQd"> + <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"> + <rect key="frame" x="226" y="0.0" width="16" height="291"/> + <autoresizingMask key="autoresizingMask"/> + </scroller> + </scrollView> </objects> <resources> <image name="backward-3btns" width="29" height="23"/> diff --git a/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m b/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m index 89fbb30959..a11560555f 100644 --- a/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m +++ b/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m @@ -25,8 +25,9 @@ #import "main/VLCMain.h" #import "main/CompatibilityFixes.h" #import "library/VLCLibraryController.h" -#import "library/VLCLibraryModel.h" #import "library/VLCLibraryDataTypes.h" +#import "library/VLCLibraryModel.h" +#import "library/VLCLibraryMenuController.h" #import "views/VLCImageView.h" #import "views/VLCLinearProgressIndicator.h" #import "extensions/NSString+Helpers.h" @@ -38,6 +39,7 @@ NSString *VLCLibraryCellIdentifier = @"VLCLibraryCellIdentifier"; @interface VLCLibraryCollectionViewItem() { VLCLibraryController *_libraryController; + VLCLibraryMenuController *_menuController; } @end @@ -185,8 +187,7 @@ NSString *VLCLibraryCellIdentifier = @"VLCLibraryCellIdentifier"; _libraryController = [[VLCMain sharedInstance] libraryController]; } - NSIndexPath *indexPath = [[self collectionView] indexPathForItem:self]; - [_libraryController appendItemAtIndexPathToPlaylist:indexPath playImmediately:YES]; + [_libraryController appendItemToPlaylist:_representedMediaItem playImmediately:YES]; } - (IBAction)addToPlaylist:(id)sender @@ -195,8 +196,31 @@ NSString *VLCLibraryCellIdentifier = @"VLCLibraryCellIdentifier"; _libraryController = [[VLCMain sharedInstance] libraryController]; } - NSIndexPath *indexPath = [[self collectionView] indexPathForItem:self]; - [_libraryController appendItemAtIndexPathToPlaylist:indexPath playImmediately:NO]; + [_libraryController appendItemToPlaylist:_representedMediaItem playImmediately:NO]; +} + +-(void)mouseDown:(NSEvent *)theEvent +{ + if (theEvent.modifierFlags & NSControlKeyMask) { + if (!_menuController) { + _menuController = [[VLCLibraryMenuController alloc] init]; + } + _menuController.representedMediaItem = self.representedMediaItem; + [_menuController popupMenuWithEvent:theEvent forView:self.view]; + } + + [super mouseDown:theEvent]; +} + +- (void)rightMouseDown:(NSEvent *)theEvent +{ + if (!_menuController) { + _menuController = [[VLCLibraryMenuController alloc] init]; + } + _menuController.representedMediaItem = self.representedMediaItem; + [_menuController popupMenuWithEvent:theEvent forView:self.view]; + + [super rightMouseDown:theEvent]; } @end diff --git a/modules/gui/macosx/library/VLCLibraryController.h b/modules/gui/macosx/library/VLCLibraryController.h index 46635f84de..93e0371a7e 100644 --- a/modules/gui/macosx/library/VLCLibraryController.h +++ b/modules/gui/macosx/library/VLCLibraryController.h @@ -31,8 +31,8 @@ NS_ASSUME_NONNULL_BEGIN @property (readonly) VLCLibraryModel *libraryModel; -- (int)appendItemAtIndexPathToPlaylist:(NSIndexPath *)indexPath playImmediately:(BOOL)playImmediately; -- (void)showItemAtIndexPathInFinder:(NSIndexPath *)indexPath; +- (int)appendItemToPlaylist:(VLCMediaLibraryMediaItem *)mediaItem playImmediately:(BOOL)playImmediately; +- (void)showItemInFinder:(VLCMediaLibraryMediaItem *)mediaItem; - (int)attemptToGenerateThumbnailForMediaItem:(VLCMediaLibraryMediaItem *)mediaItem; - (int)addFolderWithFileURL:(NSURL *)fileURL; diff --git a/modules/gui/macosx/library/VLCLibraryController.m b/modules/gui/macosx/library/VLCLibraryController.m index d8e7851507..30f76131bb 100644 --- a/modules/gui/macosx/library/VLCLibraryController.m +++ b/modules/gui/macosx/library/VLCLibraryController.m @@ -96,9 +96,8 @@ } } -- (int)appendItemAtIndexPathToPlaylist:(NSIndexPath *)indexPath playImmediately:(BOOL)playImmediately +- (int)appendItemToPlaylist:(VLCMediaLibraryMediaItem *)mediaItem playImmediately:(BOOL)playImmediately { - VLCMediaLibraryMediaItem *mediaItem = [self.libraryModel mediaItemAtIndexPath:indexPath]; input_item_t *p_inputItem = vlc_ml_get_input_item(_p_libraryInstance, mediaItem.libraryID); int ret = [[[VLCMain sharedInstance] playlistController] addInputItem:p_inputItem atPosition:-1 startPlayback:playImmediately]; input_item_Release(p_inputItem); @@ -108,9 +107,8 @@ return ret; } -- (void)showItemAtIndexPathInFinder:(NSIndexPath *)indexPath +- (void)showItemInFinder:(VLCMediaLibraryMediaItem *)mediaItem; { - VLCMediaLibraryMediaItem *mediaItem = [self.libraryModel mediaItemAtIndexPath:indexPath]; if (mediaItem == nil) { return; } diff --git a/modules/gui/macosx/library/VLCLibraryMenuController.h b/modules/gui/macosx/library/VLCLibraryMenuController.h index 912eb8759c..9d9da17872 100644 --- a/modules/gui/macosx/library/VLCLibraryMenuController.h +++ b/modules/gui/macosx/library/VLCLibraryMenuController.h @@ -24,9 +24,11 @@ NS_ASSUME_NONNULL_BEGIN +@class VLCMediaLibraryMediaItem; + @interface VLCLibraryMenuController : NSObject -@property (readwrite, weak) NSCollectionView *libraryCollectionView; +@property (readwrite, weak) VLCMediaLibraryMediaItem *representedMediaItem; - (void)popupMenuWithEvent:(NSEvent *)theEvent forView:(NSView *)theView; diff --git a/modules/gui/macosx/library/VLCLibraryMenuController.m b/modules/gui/macosx/library/VLCLibraryMenuController.m index 3a944bbde4..e930e27bb2 100644 --- a/modules/gui/macosx/library/VLCLibraryMenuController.m +++ b/modules/gui/macosx/library/VLCLibraryMenuController.m @@ -24,13 +24,13 @@ #import "main/VLCMain.h" #import "library/VLCLibraryController.h" +#import "library/VLCLibraryDataTypes.h" #import "extensions/NSString+Helpers.h" @interface VLCLibraryMenuController () { NSMenu *_libraryMenu; - NSIndexPath *_actionIndexPath; } @end @@ -55,8 +55,6 @@ - (void)popupMenuWithEvent:(NSEvent *)theEvent forView:(NSView *)theView { - _actionIndexPath = [self.libraryCollectionView indexPathForItemAtPoint:[NSEvent mouseLocation]]; - [NSMenu popUpContextMenu:_libraryMenu withEvent:theEvent forView:theView]; } @@ -64,12 +62,12 @@ - (void)play:(id)sender { - [[[VLCMain sharedInstance] libraryController] appendItemAtIndexPathToPlaylist:_actionIndexPath playImmediately:YES]; + [[[VLCMain sharedInstance] libraryController] appendItemToPlaylist:self.representedMediaItem playImmediately:YES]; } - (void)appendToPlaylist:(id)sender { - [[[VLCMain sharedInstance] libraryController] appendItemAtIndexPathToPlaylist:_actionIndexPath playImmediately:NO]; + [[[VLCMain sharedInstance] libraryController] appendItemToPlaylist:self.representedMediaItem playImmediately:NO]; } - (void)addMedia:(id)sender @@ -79,7 +77,7 @@ - (void)revealInFinder:(id)sender { - [[[VLCMain sharedInstance] libraryController] showItemAtIndexPathInFinder:_actionIndexPath]; + [[[VLCMain sharedInstance] libraryController] showItemInFinder:self.representedMediaItem]; } @end diff --git a/modules/gui/macosx/library/VLCLibraryModel.h b/modules/gui/macosx/library/VLCLibraryModel.h index fabeb3bcb7..23369c9de7 100644 --- a/modules/gui/macosx/library/VLCLibraryModel.h +++ b/modules/gui/macosx/library/VLCLibraryModel.h @@ -54,8 +54,6 @@ extern NSString *VLCLibraryModelMediaItemUpdated; @property (readonly) size_t numberOfRecentMedia; @property (readonly) NSArray <VLCMediaLibraryMediaItem *> *listOfRecentMedia; -- (nullable VLCMediaLibraryMediaItem *)mediaItemAtIndexPath:(NSIndexPath *)index; - @property (readonly) NSArray <VLCMediaLibraryEntryPoint *> *listOfMonitoredFolders; @end diff --git a/modules/gui/macosx/library/VLCLibraryModel.m b/modules/gui/macosx/library/VLCLibraryModel.m index 23c302de8a..dcb74503b8 100644 --- a/modules/gui/macosx/library/VLCLibraryModel.m +++ b/modules/gui/macosx/library/VLCLibraryModel.m @@ -185,19 +185,6 @@ static void libraryCallback(void *p_data, const vlc_ml_event_t *p_event) [_defaultNotificationCenter postNotificationName:VLCLibraryModelVideoMediaListUpdated object:self]; } -- (nullable VLCMediaLibraryMediaItem *)mediaItemAtIndexPath:(NSIndexPath *)indexPath -{ - if (_cachedRecentMedia.count > 0 && indexPath.section == 0) { - return _cachedRecentMedia[indexPath.item]; - } - - // FIXME: the scope needs be larger than just the video list - if (!_cachedVideoMedia) { - return nil; - } - return _cachedVideoMedia[indexPath.item]; -} - - (NSArray<VLCMediaLibraryMediaItem *> *)listOfVideoMedia { if (!_cachedVideoMedia) { diff --git a/modules/gui/macosx/library/VLCLibraryWindow.h b/modules/gui/macosx/library/VLCLibraryWindow.h index df65de2363..0ff1edea0f 100644 --- a/modules/gui/macosx/library/VLCLibraryWindow.h +++ b/modules/gui/macosx/library/VLCLibraryWindow.h @@ -30,17 +30,15 @@ NS_ASSUME_NONNULL_BEGIN @end -@interface VLCLibraryCollectionView : NSCollectionView -@end - @interface VLCLibraryWindow : VLCVideoWindowCommon @property (readwrite, weak) IBOutlet NSSegmentedControl *segmentedTitleControl; @property (readwrite, weak) IBOutlet NSStackView *videoLibraryStackView; -@property (readwrite, weak) IBOutlet VLCLibraryCollectionView *videoLibraryCollectionView; +@property (readwrite, weak) IBOutlet NSCollectionView *videoLibraryCollectionView; @property (readwrite, weak) IBOutlet NSCollectionView *recentVideoLibraryCollectionView; @property (readwrite, weak) IBOutlet NSCollectionView *mediaSourceCollectionView; @property (readwrite, weak) IBOutlet NSScrollView *mediaSourceScrollView; +@property (readwrite, weak) IBOutlet NSView *libraryTargetView; @property (readwrite, weak) IBOutlet NSTableView *playlistTableView; @property (readwrite, weak) IBOutlet NSTextField *upNextLabel; @property (readwrite, weak) IBOutlet NSBox *upNextSeparator; diff --git a/modules/gui/macosx/library/VLCLibraryWindow.m b/modules/gui/macosx/library/VLCLibraryWindow.m index db3749bc38..c711bcb8ff 100644 --- a/modules/gui/macosx/library/VLCLibraryWindow.m +++ b/modules/gui/macosx/library/VLCLibraryWindow.m @@ -35,7 +35,6 @@ #import "library/VLCLibraryDataSource.h" #import "library/VLCLibraryCollectionViewItem.h" #import "library/VLCLibraryModel.h" -#import "library/VLCLibraryMenuController.h" #import "library/VLCLibraryCollectionViewSupplementaryElementView.h" #import "media-source/VLCMediaSourceCollectionViewItem.h" @@ -256,23 +255,47 @@ static const float f_playlist_row_height = 72.; switch (_segmentedTitleControl.selectedSegment) { case 0: _libraryDataSource.libraryModel.libraryMode = VLCLibraryModeVideo; - _mediaSourceScrollView.hidden = YES; - _videoLibraryStackView.hidden = NO; + if (_mediaSourceScrollView.superview != nil) { + [_mediaSourceScrollView removeFromSuperview]; + } + if (_videoLibraryStackView.superview == nil) { + _videoLibraryStackView.translatesAutoresizingMaskIntoConstraints = NO; + [_libraryTargetView addSubview:_videoLibraryStackView]; + NSDictionary *dict = NSDictionaryOfVariableBindings(_videoLibraryStackView); + [_libraryTargetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_videoLibraryStackView(>=572.)]|" options:0 metrics:0 views:dict]]; + [_libraryTargetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_videoLibraryStackView(>=444.)]|" options:0 metrics:0 views:dict]]; + } [_videoLibraryCollectionView reloadData]; [_recentVideoLibraryCollectionView reloadData]; break; case 1: _libraryDataSource.libraryModel.libraryMode = VLCLibraryModeAudio; - _mediaSourceScrollView.hidden = YES; - _videoLibraryStackView.hidden = NO; + if (_mediaSourceScrollView.superview != nil) { + [_mediaSourceScrollView removeFromSuperview]; + } + if (_videoLibraryStackView.superview == nil) { + _videoLibraryStackView.translatesAutoresizingMaskIntoConstraints = NO; + [_libraryTargetView addSubview:_videoLibraryStackView]; + NSDictionary *dict = NSDictionaryOfVariableBindings(_videoLibraryStackView); + [_libraryTargetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_videoLibraryStackView(>=572.)]|" options:0 metrics:0 views:dict]]; + [_libraryTargetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_videoLibraryStackView(>=444.)]|" options:0 metrics:0 views:dict]]; + } [_videoLibraryCollectionView reloadData]; [_recentVideoLibraryCollectionView reloadData]; break; default: - _mediaSourceScrollView.hidden = NO; - _videoLibraryStackView.hidden = YES; + if (_videoLibraryStackView.superview != nil) { + [_videoLibraryStackView removeFromSuperview]; + } + if (_mediaSourceScrollView.superview == nil) { + _mediaSourceScrollView.translatesAutoresizingMaskIntoConstraints = NO; + [_libraryTargetView addSubview:_mediaSourceScrollView]; + NSDictionary *dict = NSDictionaryOfVariableBindings(_mediaSourceScrollView); + [_libraryTargetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_mediaSourceScrollView(>=572.)]|" options:0 metrics:0 views:dict]]; + [_libraryTargetView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_mediaSourceScrollView(>=444.)]|" options:0 metrics:0 views:dict]]; + } [_mediaSourceDataSource loadMediaSources]; [_mediaSourceCollectionView reloadData]; break; @@ -389,36 +412,3 @@ static const float f_playlist_row_height = 72.; } @end - -@interface VLCLibraryCollectionView() -{ - VLCLibraryMenuController *_menuController; -} - -@end - -@implementation VLCLibraryCollectionView - --(void)mouseDown:(NSEvent *)theEvent -{ - if (theEvent.modifierFlags & NSControlKeyMask) { - if (!_menuController) { - _menuController = [[VLCLibraryMenuController alloc] init]; - } - [_menuController popupMenuWithEvent:theEvent forView:self]; - } - - [super mouseDown:theEvent]; -} - -- (void)rightMouseDown:(NSEvent *)theEvent -{ - if (!_menuController) { - _menuController = [[VLCLibraryMenuController alloc] init]; - } - [_menuController popupMenuWithEvent:theEvent forView:self]; - - [super rightMouseDown:theEvent]; -} - -@end _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits