[vlc-commits] [Git][videolan/vlc][master] 5 commits: macosx: Match XIB appearance with final appearance set in obj-c

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun May 14 18:24:53 UTC 2023



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
8a0b0f8d by Claudio Cambra at 2023-05-14T18:04:06+00:00
macosx: Match XIB appearance with final appearance set in obj-c

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
5b1cb845 by Claudio Cambra at 2023-05-14T18:04:06+00:00
macosx: Truncate with elide for secondary label of VLCLibraryCollectionViewItem rather than clip

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
c2d0b025 by Claudio Cambra at 2023-05-14T18:04:06+00:00
macosx: Add layout constraint for trailing edge of secondary label to superview edge in VLCLibraryCollectionViewItem

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
dc774d9c by Claudio Cambra at 2023-05-14T18:04:06+00:00
macosx: Add outlets for secondary label-related trailing constraints

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -
c772bf60 by Claudio Cambra at 2023-05-14T18:04:06+00:00
macosx: When hiding unplayed indicator in VLCLibraryCollectionViewItem, also adjust trailing constraints of secondary info label

Signed-off-by: Claudio Cambra <developer at claudiocambra.com>

- - - - -


3 changed files:

- modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib
- modules/gui/macosx/library/VLCLibraryCollectionViewItem.h
- modules/gui/macosx/library/VLCLibraryCollectionViewItem.m


Changes:

=====================================
modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib
=====================================
@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
+        <capability name="Named colors" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -16,6 +17,8 @@
                 <outlet property="playInstantlyButton" destination="S3I-5Z-qgS" id="JlC-bE-i5Y"/>
                 <outlet property="progressIndicator" destination="dFt-oZ-h9P" id="JC6-gk-Mid"/>
                 <outlet property="secondaryInfoTextField" destination="VAn-gF-QiZ" id="U8T-Cs-HaL"/>
+                <outlet property="trailingSecondaryTextToLeadingAnnotationConstraint" destination="IXL-bv-5zP" id="V4J-bi-UQB"/>
+                <outlet property="trailingSecondaryTextToTrailingSuperviewConstraint" destination="Zci-25-m59" id="czo-El-QT8"/>
                 <outlet property="unplayedIndicatorTextField" destination="u2r-zy-XEW" id="56s-K4-Kxr"/>
                 <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
             </connections>
@@ -80,10 +83,10 @@
                     </textFieldCell>
                 </textField>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="u2r-zy-XEW">
-                    <rect key="frame" x="180" y="11" width="34" height="16"/>
+                    <rect key="frame" x="179" y="10" width="35" 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"/>
+                        <font key="font" metaFont="systemBold"/>
+                        <color key="textColor" name="VLCAccentColor"/>
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                 </textField>
@@ -102,10 +105,10 @@
                     </connections>
                 </button>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VAn-gF-QiZ">
-                    <rect key="frame" x="-2" y="11" width="37" height="16"/>
-                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="LSS-jh-llZ">
+                    <rect key="frame" x="-2" y="10" width="180" height="16"/>
+                    <textFieldCell key="cell" lineBreakMode="truncatingTail" title="Label" id="LSS-jh-llZ">
                         <font key="font" metaFont="system"/>
-                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                        <color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
                         <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                 </textField>
@@ -114,15 +117,16 @@
                 <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="4" id="ALi-0z-Mza"/>
+                <constraint firstItem="VAn-gF-QiZ" firstAttribute="top" secondItem="OBS-Eh-1mT" secondAttribute="bottom" constant="5" 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 firstItem="u2r-zy-XEW" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="VAn-gF-QiZ" secondAttribute="trailing" constant="4" id="IXL-bv-5zP"/>
+                <constraint firstItem="u2r-zy-XEW" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="VAn-gF-QiZ" secondAttribute="trailing" constant="5" id="IXL-bv-5zP"/>
                 <constraint firstAttribute="bottom" relation="greaterThanOrEqual" 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="Vwd-1n-Sbd" firstAttribute="top" secondItem="2aB-sB-hfY" secondAttribute="top" id="Qpt-yS-z2k"/>
                 <constraint firstItem="Vwd-1n-Sbd" firstAttribute="leading" secondItem="2aB-sB-hfY" secondAttribute="leading" id="Yqz-VL-Ul7"/>
                 <constraint firstAttribute="trailing" secondItem="Ubz-8I-W2F" secondAttribute="trailing" constant="14" id="ZVz-SL-rxZ"/>
+                <constraint firstAttribute="trailing" secondItem="VAn-gF-QiZ" secondAttribute="trailing" priority="750" id="Zci-25-m59"/>
                 <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="10" id="fH0-Om-7gV"/>
                 <constraint firstItem="Vwd-1n-Sbd" firstAttribute="trailing" secondItem="2aB-sB-hfY" secondAttribute="trailing" id="fag-50-6qS"/>
@@ -138,5 +142,8 @@
     <resources>
         <image name="ellipsis" width="17" height="3"/>
         <image name="libraryPlay" width="64" height="64"/>
+        <namedColor name="VLCAccentColor">
+            <color red="1" green="0.37999999523162842" blue="0.039999999105930328" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+        </namedColor>
     </resources>
 </document>


=====================================
modules/gui/macosx/library/VLCLibraryCollectionViewItem.h
=====================================
@@ -49,6 +49,8 @@ extern NSString *VLCLibraryCellIdentifier;
 @property (readwrite, assign) IBOutlet VLCLinearProgressIndicator *progressIndicator;
 @property (readwrite, assign) IBOutlet NSBox *highlightBox;
 @property (readwrite, assign) IBOutlet NSLayoutConstraint *imageViewAspectRatioConstraint;
+ at property (readwrite, assign) IBOutlet NSLayoutConstraint *trailingSecondaryTextToLeadingUnplayedIndicatorConstraint;
+ at property (readwrite, assign) IBOutlet NSLayoutConstraint *trailingSecondaryTextToTrailingSuperviewConstraint;
 
 @property (readwrite, retain, nonatomic) id<VLCMediaLibraryItemProtocol> representedItem;
 


=====================================
modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
=====================================
@@ -53,6 +53,7 @@ const CGFloat VLCLibraryCollectionViewItemMaximumDisplayedProgress = 0.95;
 
     NSLayoutConstraint *_videoImageViewAspectRatioConstraint;
 }
+
 @end
 
 @implementation VLCLibraryCollectionViewItem
@@ -178,8 +179,9 @@ const CGFloat VLCLibraryCollectionViewItemMaximumDisplayedProgress = 0.95;
     _mediaImageView.image = nil;
     _annotationTextField.hidden = YES;
     _progressIndicator.hidden = YES;
-    _unplayedIndicatorTextField.hidden = YES;
     _highlightBox.hidden = YES;
+
+    [self setUnplayedIndicatorHidden:YES];
 }
 
 - (void)setRepresentedItem:(id<VLCMediaLibraryItemProtocol>)representedItem
@@ -245,7 +247,7 @@ const CGFloat VLCLibraryCollectionViewItemMaximumDisplayedProgress = 0.95;
         }
 
         if (mediaItem.playCount == 0) {
-            _unplayedIndicatorTextField.hidden = NO;
+            [self setUnplayedIndicatorHidden:NO];
         }
     }
 }
@@ -261,6 +263,18 @@ const CGFloat VLCLibraryCollectionViewItemMaximumDisplayedProgress = 0.95;
     }
 }
 
+- (void)setUnplayedIndicatorHidden:(BOOL)indicatorHidden
+{
+    _unplayedIndicatorTextField.hidden = indicatorHidden;
+
+    // Set priority of constraints for secondary info label, which is alongside unplayed indicator
+    const NSLayoutPriority superViewConstraintPriority = indicatorHidden ? NSLayoutPriorityRequired : NSLayoutPriorityDefaultLow;
+    const NSLayoutPriority unplayedIndicatorConstraintPriority = indicatorHidden ? NSLayoutPriorityDefaultLow : NSLayoutPriorityRequired;
+
+    _trailingSecondaryTextToTrailingSuperviewConstraint.priority = superViewConstraintPriority;
+    _trailingSecondaryTextToLeadingUnplayedIndicatorConstraint.priority = unplayedIndicatorConstraintPriority;
+}
+
 #pragma mark - actions
 
 - (IBAction)playInstantly:(id)sender



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/faaf92022979b62728f884fe80d3bcf73a232032...c772bf60bb31d64975cf956f1a3f311a02a17643

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/faaf92022979b62728f884fe80d3bcf73a232032...c772bf60bb31d64975cf956f1a3f311a02a17643
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