[vlc-commits] [Git][videolan/vlc][master] 6 commits: macosx: Set VLCPlaylistTableCellView artist text field to also contain album text if possible

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue May 23 11:43:30 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
ab804ef0 by Claudio Cambra at 2023-05-23T11:26:16+00:00
macosx: Set VLCPlaylistTableCellView artist text field to also contain album text if possible

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

- - - - -
5bb58f2d by Claudio Cambra at 2023-05-23T11:26:16+00:00
macosx: Make artist text field in VLCPlaylistTableCellView use system small font

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

- - - - -
22fa1c01 by Claudio Cambra at 2023-05-23T11:26:16+00:00
macosx: Also bolden duration text field when current playlist table cell view is currently played

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

- - - - -
ba691baf by Claudio Cambra at 2023-05-23T11:26:16+00:00
macosx: Colour the audio indicator green when is currently played track VLCPlaylistTableCellView

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

- - - - -
ce7c7638 by Claudio Cambra at 2023-05-23T11:26:16+00:00
macosx: Split font and colour updating into own methods in VLCPlaylistTableCellView

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

- - - - -
3516d420 by Claudio Cambra at 2023-05-23T11:26:16+00:00
macosx: Replace note image with simpler textfield containing note unicode in VLCPlaylistTableCellView

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

- - - - -


3 changed files:

- modules/gui/macosx/UI/VLCPlaylistTableCellView.xib
- modules/gui/macosx/playlist/VLCPlaylistTableCellView.h
- modules/gui/macosx/playlist/VLCPlaylistTableCellView.m


Changes:

=====================================
modules/gui/macosx/UI/VLCPlaylistTableCellView.xib
=====================================
@@ -8,15 +8,15 @@
         <customObject id="-2" userLabel="File's Owner" customClass="VLCPlaylistTableCellView"/>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <customView id="c22-O7-iKe" customClass="VLCPlaylistTableCellView">
+        <customView wantsLayer="YES" id="c22-O7-iKe" customClass="VLCPlaylistTableCellView">
             <rect key="frame" x="0.0" y="0.0" width="398" height="58"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <stackView distribution="fill" orientation="vertical" alignment="leading" spacing="5" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0Ge-7z-bq6">
-                    <rect key="frame" x="97" y="0.0" width="245" height="58"/>
+                    <rect key="frame" x="97" y="1" width="245" height="56"/>
                     <subviews>
                         <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ohB-P0-nCv">
-                            <rect key="frame" x="-2" y="42" width="249" height="16"/>
+                            <rect key="frame" x="-2" y="40" width="249" height="16"/>
                             <textFieldCell key="cell" lineBreakMode="truncatingTail" title="Label" id="ZPw-XO-XD1">
                                 <font key="font" usesAppearanceFont="YES"/>
                                 <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -24,7 +24,7 @@
                             </textFieldCell>
                         </textField>
                         <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xJW-ps-ycn">
-                            <rect key="frame" x="-2" y="21" width="249" height="16"/>
+                            <rect key="frame" x="-2" y="19" width="249" height="16"/>
                             <textFieldCell key="cell" lineBreakMode="truncatingTail" title="Label" id="aCe-ia-0Ww">
                                 <font key="font" usesAppearanceFont="YES"/>
                                 <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -32,9 +32,9 @@
                             </textFieldCell>
                         </textField>
                         <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TPv-k2-6XS">
-                            <rect key="frame" x="-2" y="0.0" width="249" height="16"/>
+                            <rect key="frame" x="-2" y="0.0" width="249" height="14"/>
                             <textFieldCell key="cell" lineBreakMode="truncatingTail" title="Label" id="jZ4-pa-K3T">
-                                <font key="font" usesAppearanceFont="YES"/>
+                                <font key="font" metaFont="smallSystem"/>
                                 <color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
                                 <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                             </textFieldCell>
@@ -62,10 +62,14 @@
                         <constraint firstAttribute="width" secondItem="Ydb-7n-5Cd" secondAttribute="height" multiplier="16:10" id="4aB-rs-m22"/>
                     </constraints>
                 </customView>
-                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="xnT-RR-pOf">
-                    <rect key="frame" x="10" y="17" width="24" height="24"/>
-                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="note" id="UzG-df-K2K"/>
-                </imageView>
+                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Mk2-5A-q4g">
+                    <rect key="frame" x="8" y="13" width="22" height="31"/>
+                    <textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="♪" id="mdz-SA-hCl">
+                        <font key="font" textStyle="largeTitle" name=".SFNS-Regular"/>
+                        <color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
+                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                    </textFieldCell>
+                </textField>
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="97z-d7-S3D" customClass="VLCImageView">
                     <rect key="frame" x="39" y="5" width="48" height="48"/>
                     <constraints>
@@ -85,33 +89,30 @@
                 </textField>
             </subviews>
             <constraints>
+                <constraint firstItem="Mk2-5A-q4g" firstAttribute="centerY" secondItem="Ydb-7n-5Cd" secondAttribute="centerY" id="7oz-36-KPx"/>
                 <constraint firstItem="Ydb-7n-5Cd" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" constant="10" id="8hv-Qt-uAI"/>
                 <constraint firstItem="0Ge-7z-bq6" firstAttribute="centerY" secondItem="3Ha-ZH-fa9" secondAttribute="centerY" id="DpI-8u-rFu"/>
                 <constraint firstItem="0Ge-7z-bq6" firstAttribute="centerY" secondItem="c22-O7-iKe" secondAttribute="centerY" id="EXo-Wn-Jh5"/>
                 <constraint firstItem="97z-d7-S3D" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" constant="5" id="FbP-R4-bAA"/>
-                <constraint firstItem="xnT-RR-pOf" firstAttribute="leading" secondItem="Ydb-7n-5Cd" secondAttribute="leading" id="O8E-35-EK3"/>
+                <constraint firstItem="Mk2-5A-q4g" firstAttribute="leading" secondItem="Ydb-7n-5Cd" secondAttribute="leading" id="S9m-bB-HBd"/>
                 <constraint firstAttribute="trailing" secondItem="3Ha-ZH-fa9" secondAttribute="trailing" constant="10" id="SVJ-UL-O5m"/>
                 <constraint firstAttribute="bottom" secondItem="97z-d7-S3D" secondAttribute="bottom" constant="5" id="XfR-Fd-n6o"/>
                 <constraint firstAttribute="bottom" secondItem="Ydb-7n-5Cd" secondAttribute="bottom" constant="5" id="aVd-Ld-lUH"/>
                 <constraint firstItem="0Ge-7z-bq6" firstAttribute="leading" secondItem="97z-d7-S3D" secondAttribute="trailing" constant="10" id="adC-9f-And"/>
                 <constraint firstItem="97z-d7-S3D" firstAttribute="trailing" secondItem="Ydb-7n-5Cd" secondAttribute="trailing" id="bzC-Km-KOo"/>
                 <constraint firstItem="0Ge-7z-bq6" firstAttribute="trailing" secondItem="3Ha-ZH-fa9" secondAttribute="leading" constant="-10" id="dSC-Pq-ml2"/>
-                <constraint firstItem="xnT-RR-pOf" firstAttribute="centerY" secondItem="97z-d7-S3D" secondAttribute="centerY" id="gLa-2C-g8X"/>
                 <constraint firstItem="Ydb-7n-5Cd" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" constant="5" id="iPZ-zR-jTv"/>
             </constraints>
             <connections>
                 <outlet property="artistTextField" destination="TPv-k2-6XS" id="jJV-4C-USY"/>
                 <outlet property="audioArtworkImageView" destination="97z-d7-S3D" id="ZDl-d6-j29"/>
-                <outlet property="audioMediaTypeIndicator" destination="xnT-RR-pOf" id="BTq-M6-aJm"/>
+                <outlet property="audioMediaTypeIndicator" destination="Mk2-5A-q4g" id="wal-6y-aRv"/>
                 <outlet property="durationTextField" destination="3Ha-ZH-fa9" id="vbh-oE-Afj"/>
                 <outlet property="mediaImageView" destination="Ydb-7n-5Cd" id="MlE-WQ-VB9"/>
                 <outlet property="mediaTitleTextField" destination="ohB-P0-nCv" id="iS6-q4-h8I"/>
                 <outlet property="secondaryMediaTitleTextField" destination="xJW-ps-ycn" id="KpP-ao-QlW"/>
             </connections>
-            <point key="canvasLocation" x="98" y="50.5"/>
+            <point key="canvasLocation" x="98" y="50"/>
         </customView>
     </objects>
-    <resources>
-        <image name="note" width="24" height="24"/>
-    </resources>
 </document>


=====================================
modules/gui/macosx/playlist/VLCPlaylistTableCellView.h
=====================================
@@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
 @property (readwrite, assign) IBOutlet NSTextField *mediaTitleTextField;
 @property (readwrite, assign) IBOutlet NSTextField *durationTextField;
 @property (readwrite, assign) IBOutlet VLCImageView *mediaImageView;
- at property (readwrite, assign) IBOutlet NSImageView *audioMediaTypeIndicator;
+ at property (readwrite, assign) IBOutlet NSTextField *audioMediaTypeIndicator;
 @property (readwrite, assign) IBOutlet VLCImageView *audioArtworkImageView;
 
 @end


=====================================
modules/gui/macosx/playlist/VLCPlaylistTableCellView.m
=====================================
@@ -22,8 +22,10 @@
 
 #import "VLCPlaylistTableCellView.h"
 
-#import "extensions/NSString+Helpers.h"
+#import "extensions/NSColor+VLCAdditions.h"
 #import "extensions/NSFont+VLCAdditions.h"
+#import "extensions/NSImage+VLCAdditions.h"
+#import "extensions/NSString+Helpers.h"
 
 #import "library/VLCLibraryImageCache.h"
 
@@ -46,12 +48,32 @@
 {
     _representsCurrentPlaylistItem = representsCurrentPlaylistItem;
 
+    [self updateFonts];
+    [self updateColouredElements];
+}
+
+- (void)updateFonts
+{
     NSFont * const displayedFont = _representsCurrentPlaylistItem ?
         [NSFont boldSystemFontOfSize:NSFont.systemFontSize] :
         [NSFont systemFontOfSize:NSFont.systemFontSize];
 
+    NSFont * const sublineDisplayedFont = _representsCurrentPlaylistItem ?
+        [NSFont boldSystemFontOfSize:NSFont.smallSystemFontSize] :
+        [NSFont systemFontOfSize:NSFont.smallSystemFontSize];
+
     self.mediaTitleTextField.font = displayedFont;
     self.secondaryMediaTitleTextField.font = displayedFont;
+    self.durationTextField.font = displayedFont;
+    self.artistTextField.font = sublineDisplayedFont;
+}
+
+- (void)updateColouredElements
+{
+
+    self.audioMediaTypeIndicator.textColor = _representsCurrentPlaylistItem ?
+        NSColor.labelColor :
+        NSColor.secondaryLabelColor;
 }
 
 - (void)setRepresentedPlaylistItem:(VLCPlaylistItem *)item
@@ -61,13 +83,23 @@
         self.mediaImageView.image = thumbnail;
     }];
 
-    NSString *artist = item.artistName;
-    if (artist && artist.length > 0) {
+    const BOOL validArtistString = item.artistName && item.artistName.length > 0;
+    const BOOL validAlbumString = item.albumName && item.albumName > 0;
+
+    NSString *songDetailString;
+
+    if (validArtistString && validAlbumString) {
+        songDetailString = [NSString stringWithFormat:@"%@ · %@", item.artistName, item.albumName];
+    } else if (validArtistString) {
+        songDetailString = item.artistName;
+    }
+
+    if (songDetailString) {
         self.mediaTitleTextField.hidden = YES;
         self.secondaryMediaTitleTextField.hidden = NO;
         self.artistTextField.hidden = NO;
         self.secondaryMediaTitleTextField.stringValue = item.title;
-        self.artistTextField.stringValue = artist;
+        self.artistTextField.stringValue = songDetailString;
         self.audioMediaTypeIndicator.hidden = NO;
 
         self.audioArtworkImageView.hidden = NO;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/616c82286e1784be632731803e04f6251ec158d8...3516d420ebc1ceac4ee220b72b09b3a46b11757d

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/616c82286e1784be632731803e04f6251ec158d8...3516d420ebc1ceac4ee220b72b09b3a46b11757d
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