[vlc-commits] [Git][videolan/vlc][master] macosx: Make collection view layouts consistent, unify setup
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Fri Jul 22 10:21:06 UTC 2022
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
ea25b03d by Claudio Cambra at 2022-07-22T09:55:54+00:00
macosx: Make collection view layouts consistent, unify setup
Signed-off-by: Claudio Cambra <claudio.cambra at gmail.com>
- - - - -
6 changed files:
- modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib
- modules/gui/macosx/UI/VLCMediaSourceCollectionViewItem.xib
- modules/gui/macosx/UI/VLCMediaSourceDeviceCollectionViewItem.xib
- modules/gui/macosx/library/VLCLibraryAudioDataSource.m
- modules/gui/macosx/library/VLCLibraryWindow.m
- modules/gui/macosx/media-source/VLCMediaSourceBaseDataSource.m
Changes:
=====================================
modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib
=====================================
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -21,20 +21,20 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY" customClass="VLCTrackingView">
- <rect key="frame" x="0.0" y="0.0" width="256" height="214"/>
+ <rect key="frame" x="0.0" y="0.0" width="214" height="263"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="2aB-sB-hfY" customClass="VLCImageView">
- <rect key="frame" x="0.0" y="49" width="256" height="165"/>
+ <rect key="frame" x="0.0" y="49" width="214" height="214"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="dFt-oZ-h9P" customClass="VLCLinearProgressIndicator">
- <rect key="frame" x="0.0" y="0.0" width="256" height="4"/>
+ <rect key="frame" x="0.0" y="0.0" width="214" height="4"/>
<constraints>
<constraint firstAttribute="height" constant="4" id="lyQ-kl-gVk"/>
</constraints>
</customView>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="S3I-5Z-qgS">
- <rect key="frame" x="96" y="51" width="64" height="64"/>
+ <rect key="frame" x="75" y="75" width="64" height="64"/>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="libraryPlay" imagePosition="only" alignment="center" inset="2" id="IHP-p1-d0R">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -44,7 +44,7 @@
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tm2-NW-WsZ" customClass="VLCRoundedCornerTextField">
- <rect key="frame" x="8" y="141" width="37" height="17"/>
+ <rect key="frame" x="8" y="191" width="37" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="tyb-Ur-7J9">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -56,6 +56,7 @@
<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 firstItem="S3I-5Z-qgS" firstAttribute="centerY" secondItem="2aB-sB-hfY" secondAttribute="centerY" id="ZWU-oW-OVa"/>
+ <constraint firstAttribute="width" secondItem="2aB-sB-hfY" secondAttribute="height" multiplier="1:1" id="f7c-vp-30m"/>
<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"/>
</constraints>
@@ -63,13 +64,13 @@
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="OBS-Eh-1mT">
<rect key="frame" x="-2" y="21" width="52" height="24"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" title="Label" usesSingleLineMode="YES" id="7Hy-o3-LvX">
- <font key="font" size="20" name=".AppleSystemUIFont"/>
+ <font key="font" metaFont="system" size="20"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="u2r-zy-XEW">
- <rect key="frame" x="224" y="1" width="34" height="17"/>
+ <rect key="frame" x="182" y="2" width="34" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="NEW" id="NeT-5U-eZn">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -77,7 +78,7 @@
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Ubz-8I-W2F">
- <rect key="frame" x="222" y="187" width="20" height="20"/>
+ <rect key="frame" x="180" y="236" width="20" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="XhX-7U-Nxj"/>
<constraint firstAttribute="height" constant="20" id="ZDT-YM-Cbr"/>
@@ -93,7 +94,7 @@
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VAn-gF-QiZ">
<rect key="frame" x="-2" y="0.0" width="42" height="19"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="LSS-jh-llZ">
- <font key="font" size="15" name=".AppleSystemUIFont"/>
+ <font key="font" metaFont="system" size="15"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
@@ -116,6 +117,7 @@
<constraint firstItem="OBS-Eh-1mT" firstAttribute="top" secondItem="2aB-sB-hfY" secondAttribute="bottom" constant="4" id="vJy-Kf-4Jh"/>
<constraint firstItem="OBS-Eh-1mT" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="yvp-xr-geN"/>
</constraints>
+ <point key="canvasLocation" x="118" y="135.5"/>
</customView>
</objects>
<resources>
=====================================
modules/gui/macosx/UI/VLCMediaSourceCollectionViewItem.xib
=====================================
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -18,14 +18,14 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY" customClass="VLCTrackingView">
- <rect key="frame" x="0.0" y="0.0" width="256" height="214"/>
+ <rect key="frame" x="0.0" y="0.0" width="214" height="246"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="2aB-sB-hfY" customClass="VLCImageView">
- <rect key="frame" x="0.0" y="32" width="256" height="182"/>
+ <rect key="frame" x="0.0" y="32" width="214" height="214"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="S3I-5Z-qgS">
- <rect key="frame" x="96" y="59" width="64" height="64"/>
+ <rect key="frame" x="75" y="75" width="64" height="64"/>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="libraryPlay" imagePosition="only" alignment="center" inset="2" id="IHP-p1-d0R">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -35,7 +35,7 @@
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kHQ-HZ-YIi" customClass="VLCRoundedCornerTextField">
- <rect key="frame" x="5" y="155" width="37" height="17"/>
+ <rect key="frame" x="5" y="188" width="37" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="F0j-LH-r6g">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -45,6 +45,7 @@
</subviews>
<constraints>
<constraint firstItem="kHQ-HZ-YIi" firstAttribute="top" secondItem="2aB-sB-hfY" secondAttribute="top" constant="10" id="1we-Fw-12H"/>
+ <constraint firstAttribute="width" secondItem="2aB-sB-hfY" secondAttribute="height" multiplier="1:1" id="Ae4-1P-sJe"/>
<constraint firstItem="S3I-5Z-qgS" firstAttribute="centerX" secondItem="2aB-sB-hfY" secondAttribute="centerX" id="Seo-tS-piW"/>
<constraint firstItem="S3I-5Z-qgS" firstAttribute="centerY" secondItem="2aB-sB-hfY" secondAttribute="centerY" id="ZWU-oW-OVa"/>
<constraint firstItem="kHQ-HZ-YIi" firstAttribute="leading" secondItem="2aB-sB-hfY" secondAttribute="leading" constant="7" id="s9g-G1-oCF"/>
@@ -56,13 +57,13 @@
<constraint firstAttribute="height" constant="24" id="wMC-00-Vuv"/>
</constraints>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" title="Label" usesSingleLineMode="YES" id="7Hy-o3-LvX">
- <font key="font" size="20" name=".AppleSystemUIFont"/>
+ <font key="font" metaFont="system" size="20"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Ubz-8I-W2F">
- <rect key="frame" x="222" y="187" width="20" height="20"/>
+ <rect key="frame" x="180" y="219" width="20" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="20" id="XhX-7U-Nxj"/>
<constraint firstAttribute="height" constant="20" id="ZDT-YM-Cbr"/>
@@ -87,6 +88,7 @@
<constraint firstItem="OBS-Eh-1mT" firstAttribute="top" secondItem="2aB-sB-hfY" secondAttribute="bottom" constant="4" id="vJy-Kf-4Jh"/>
<constraint firstItem="OBS-Eh-1mT" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="yvp-xr-geN"/>
</constraints>
+ <point key="canvasLocation" x="-52" y="65"/>
</customView>
</objects>
<resources>
=====================================
modules/gui/macosx/UI/VLCMediaSourceDeviceCollectionViewItem.xib
=====================================
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17701"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -15,32 +15,33 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
- <rect key="frame" x="0.0" y="0.0" width="169" height="176"/>
+ <rect key="frame" x="0.0" y="0.0" width="214" height="246"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="jJ3-BQ-y8F">
- <rect key="frame" x="-2" y="4" width="37" height="15"/>
- <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="Utm-F6-CKx">
- <font key="font" metaFont="systemBold" size="12"/>
+ <rect key="frame" x="-2" y="0.0" width="56" height="24"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" title="Label" usesSingleLineMode="YES" id="Utm-F6-CKx">
+ <font key="font" metaFont="systemBold" size="20"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="rko-Nc-j4c" customClass="VLCImageView">
- <rect key="frame" x="0.0" y="27" width="149" height="149"/>
+ <rect key="frame" x="0.0" y="32" width="214" height="214"/>
<constraints>
<constraint firstAttribute="width" secondItem="rko-Nc-j4c" secondAttribute="height" multiplier="1:1" id="tGe-gB-9im"/>
- <constraint firstAttribute="width" constant="149" id="wkF-ab-s15"/>
</constraints>
</customView>
</subviews>
<constraints>
<constraint firstItem="rko-Nc-j4c" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="4mg-zK-oCq"/>
<constraint firstItem="jJ3-BQ-y8F" firstAttribute="top" secondItem="rko-Nc-j4c" secondAttribute="bottom" constant="8" id="86t-IA-OYg"/>
+ <constraint firstAttribute="trailing" secondItem="rko-Nc-j4c" secondAttribute="trailing" id="QHi-3o-Z4u"/>
<constraint firstItem="rko-Nc-j4c" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="Va8-hk-LhR"/>
<constraint firstItem="jJ3-BQ-y8F" firstAttribute="leading" secondItem="rko-Nc-j4c" secondAttribute="leading" id="rFY-qw-fsf"/>
+ <constraint firstAttribute="bottom" secondItem="jJ3-BQ-y8F" secondAttribute="bottom" id="tms-ub-oAu"/>
</constraints>
- <point key="canvasLocation" x="-210.5" y="67"/>
+ <point key="canvasLocation" x="-211" y="66.5"/>
</customView>
</objects>
</document>
=====================================
modules/gui/macosx/library/VLCLibraryAudioDataSource.m
=====================================
@@ -77,11 +77,6 @@
_collectionViewFlowLayout = [[VLCLibraryCollectionViewFlowLayout alloc] init];
_collectionView.collectionViewLayout = _collectionViewFlowLayout;
- _collectionViewFlowLayout.itemSize = CGSizeMake(214., 260.);
- _collectionViewFlowLayout.sectionInset = NSEdgeInsetsMake(20., 20., 20., 20.);
- _collectionViewFlowLayout.minimumLineSpacing = 20.;
- _collectionViewFlowLayout.minimumInteritemSpacing = 20.;
-
_groupSelectionTableView.target = self;
_groupSelectionTableView.doubleAction = @selector(groubSelectionDoubleClickAction:);
_collectionSelectionTableView.target = self;
=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -350,13 +350,38 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
[self shuffleStateUpdated:nil];
// Need to account for the audio collection switcher at the top
- const NSEdgeInsets scrollViewEdgeInsets = NSEdgeInsetsMake(32., 16., 16., 0.);
+ const CGFloat audioCollectionScrollViewTopInset = 32.;
+ const CGFloat scrollViewTopInset = 16.;
+ const CGFloat scrollViewRightInset = 0.;
+ const CGFloat scrollViewBottomInset = 16.;
+ const CGFloat scrollViewLeftInset = 16.;
_audioCollectionViewScrollView.automaticallyAdjustsContentInsets = NO;
- _audioCollectionViewScrollView.contentInsets = scrollViewEdgeInsets;
+ _audioCollectionViewScrollView.contentInsets = NSEdgeInsetsMake(audioCollectionScrollViewTopInset,
+ scrollViewLeftInset,
+ scrollViewBottomInset,
+ scrollViewRightInset);
_mediaSourceCollectionViewScrollView.automaticallyAdjustsContentInsets = NO;
- _mediaSourceCollectionViewScrollView.contentInsets = scrollViewEdgeInsets;
+ _mediaSourceCollectionViewScrollView.contentInsets = NSEdgeInsetsMake(scrollViewTopInset,
+ scrollViewLeftInset,
+ scrollViewBottomInset,
+ scrollViewRightInset);
+
+ const CGFloat collectionItemSpacing = 20.;
+ const NSEdgeInsets collectionViewSectionInset = NSEdgeInsetsMake(20., 20., 20., 20.);
+
+ NSCollectionViewFlowLayout *audioLibraryCollectionViewLayout = _audioLibraryCollectionView.collectionViewLayout;
+ audioLibraryCollectionViewLayout.itemSize = CGSizeMake(214., 260.);
+ audioLibraryCollectionViewLayout.minimumLineSpacing = collectionItemSpacing;
+ audioLibraryCollectionViewLayout.minimumInteritemSpacing = collectionItemSpacing;
+ audioLibraryCollectionViewLayout.sectionInset = collectionViewSectionInset;
+
+ NSCollectionViewFlowLayout *mediaSourceCollectionViewLayout = _mediaSourceCollectionView.collectionViewLayout;
+ mediaSourceCollectionViewLayout.itemSize = CGSizeMake(214., 246.);
+ mediaSourceCollectionViewLayout.minimumLineSpacing = collectionItemSpacing;
+ mediaSourceCollectionViewLayout.minimumInteritemSpacing = collectionItemSpacing;
+ mediaSourceCollectionViewLayout.sectionInset = collectionViewSectionInset;
// HACK: The size of the segmented title buttons is not always correctly calculated
// especially when the text we are setting differs from what is set in the storyboard.
=====================================
modules/gui/macosx/media-source/VLCMediaSourceBaseDataSource.m
=====================================
@@ -90,11 +90,6 @@ NSString *VLCMediaSourceTableViewCellIdentifier = @"VLCMediaSourceTableViewCellI
[self.collectionView registerClass:[VLCLibraryCollectionViewSupplementaryElementView class]
forSupplementaryViewOfKind:NSCollectionElementKindSectionHeader
withIdentifier:VLCLibrarySupplementaryElementViewIdentifier];
- NSCollectionViewFlowLayout *flowLayout = (NSCollectionViewFlowLayout *)self.collectionView.collectionViewLayout;
- flowLayout.footerReferenceSize = NSZeroSize;
- flowLayout.headerReferenceSize = NSMakeSize(200, 50);
- flowLayout.itemSize = NSMakeSize(149, 176);
- flowLayout.minimumInteritemSpacing = 24.;
self.homeButton.action = @selector(homeButtonAction:);
self.homeButton.target = self;
@@ -284,19 +279,6 @@ referenceSizeForHeaderInSection:(NSInteger)section
return [VLCLibraryCollectionViewSupplementaryElementView defaultHeaderSize];
}
-- (NSEdgeInsets)collectionView:(NSCollectionView *)collectionView
- layout:(NSCollectionViewLayout *)collectionViewLayout
- insetForSectionAtIndex:(NSInteger)section
-{
- if (_mediaSourceMode == VLCMediaSourceModeLAN) {
- VLCMediaSource *mediaSource = _mediaSources[section];
- VLCInputNode *rootNode = mediaSource.rootNode;
-
- return rootNode.numberOfChildren == 0 ? NSEdgeInsetsZero : NSEdgeInsetsMake(16., 0., 48., 0.);
- }
-
- return NSEdgeInsetsMake(16., 0., 48.0, 0.);
-}
#pragma mark - table view data source and delegation
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ea25b03d3997027b75395eb397526b8a4681461e
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/ea25b03d3997027b75395eb397526b8a4681461e
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