[vlc-commits] macosx: iterate on playlist cell view

Felix Paul Kühne git at videolan.org
Wed May 29 19:45:19 CEST 2019


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Wed May 29 19:36:32 2019 +0200| [7d9948f3a86fd2cd9e6f5fdff9213109d84d7142] | committer: Felix Paul Kühne

macosx: iterate on playlist cell view

This introduces an indicator for media where we can be sure it is audio and privatices the cell content setting

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

 .../package/macosx/VLC.xcodeproj/project.pbxproj   |   4 +++
 modules/gui/macosx/Makefile.am                     |   2 ++
 .../gui/macosx/Resources/librarywindow/note.png    | Bin 0 -> 267 bytes
 .../gui/macosx/Resources/librarywindow/note at 2x.png | Bin 0 -> 400 bytes
 modules/gui/macosx/UI/VLCPlaylistTableCellView.xib |  34 ++++++++++++++++-----
 modules/gui/macosx/library/VLCLibraryWindow.m      |   2 +-
 .../gui/macosx/playlist/VLCPlaylistDataSource.m    |  19 +-----------
 .../gui/macosx/playlist/VLCPlaylistTableCellView.h |   5 +++
 .../gui/macosx/playlist/VLCPlaylistTableCellView.m |  30 ++++++++++++++++++
 9 files changed, 70 insertions(+), 26 deletions(-)

diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
index 21f1f6eab0..a1fadb9f6c 100644
--- a/extras/package/macosx/VLC.xcodeproj/project.pbxproj
+++ b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
@@ -500,6 +500,8 @@
 		7D713D302201AE350042BEB7 /* VLCLibraryWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLibraryWindow.h; sourceTree = "<group>"; };
 		7D713D312201AE350042BEB7 /* VLCLibraryWindow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLibraryWindow.m; sourceTree = "<group>"; };
 		7D713D332201BB130042BEB7 /* VLCLibraryWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = VLCLibraryWindow.xib; sourceTree = "<group>"; };
+		7D71B88C229EF61200D919E7 /* note.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = note.png; path = librarywindow/note.png; sourceTree = "<group>"; };
+		7D71B88D229EF61300D919E7 /* note at 2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "note at 2x.png"; path = "librarywindow/note at 2x.png"; sourceTree = "<group>"; };
 		7D871D371B5E6844000B56C0 /* VLCMain+OldPrefs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "VLCMain+OldPrefs.h"; sourceTree = "<group>"; };
 		7D871D381B5E6844000B56C0 /* VLCMain+OldPrefs.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "VLCMain+OldPrefs.m"; sourceTree = "<group>"; };
 		7D8BB0B318302AC000FAE9B7 /* VLCLogWindowController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLogWindowController.h; sourceTree = "<group>"; };
@@ -1353,6 +1355,8 @@
 				7D28E63E2275C8660098D30E /* ellipsis at 2x.png */,
 				7D28E6402275C9C70098D30E /* libraryPlay.png */,
 				7D28E63F2275C9C70098D30E /* libraryPlay at 2x.png */,
+				7D71B88C229EF61200D919E7 /* note.png */,
+				7D71B88D229EF61300D919E7 /* note at 2x.png */,
 				7D28E6462275F2850098D30E /* repeatOff.png */,
 				7D28E6442275F2840098D30E /* repeatOff at 2x.png */,
 				7D28E6482275F2850098D30E /* repeatOne.png */,
diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am
index 83c986b778..d9f2aa1c58 100644
--- a/modules/gui/macosx/Makefile.am
+++ b/modules/gui/macosx/Makefile.am
@@ -319,6 +319,8 @@ libmacosx_plugin_la_RES = \
 	gui/macosx/Resources/File-Icons/wmv.icns \
 	gui/macosx/Resources/librarywindow/ellipsis.png \
 	gui/macosx/Resources/librarywindow/ellipsis at 2x.png \
+	gui/macosx/Resources/librarywindow/note.png \
+	gui/macosx/Resources/librarywindow/note at 2x.png \
 	gui/macosx/Resources/librarywindow/libraryPlay.png \
 	gui/macosx/Resources/librarywindow/libraryPlay at 2x.png \
 	gui/macosx/Resources/librarywindow/repeatAll.png \
diff --git a/modules/gui/macosx/Resources/librarywindow/note.png b/modules/gui/macosx/Resources/librarywindow/note.png
new file mode 100644
index 0000000000..7714f2ba4b
Binary files /dev/null and b/modules/gui/macosx/Resources/librarywindow/note.png differ
diff --git a/modules/gui/macosx/Resources/librarywindow/note at 2x.png b/modules/gui/macosx/Resources/librarywindow/note at 2x.png
new file mode 100644
index 0000000000..4a14dabb3e
Binary files /dev/null and b/modules/gui/macosx/Resources/librarywindow/note at 2x.png differ
diff --git a/modules/gui/macosx/UI/VLCPlaylistTableCellView.xib b/modules/gui/macosx/UI/VLCPlaylistTableCellView.xib
index d35ecfa235..3deb69a965 100644
--- a/modules/gui/macosx/UI/VLCPlaylistTableCellView.xib
+++ b/modules/gui/macosx/UI/VLCPlaylistTableCellView.xib
@@ -9,11 +9,11 @@
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
         <customView id="c22-O7-iKe" customClass="VLCPlaylistTableCellView">
-            <rect key="frame" x="0.0" y="0.0" width="398" height="71"/>
+            <rect key="frame" x="0.0" y="0.0" width="398" height="81"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ohB-P0-nCv">
-                    <rect key="frame" x="112" y="27" width="37" height="17"/>
+                    <rect key="frame" x="131" y="32" width="37" height="17"/>
                     <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="ZPw-XO-XD1">
                         <font key="font" usesAppearanceFont="YES"/>
                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -21,7 +21,7 @@
                     </textFieldCell>
                 </textField>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xJW-ps-ycn">
-                    <rect key="frame" x="112" y="41" width="37" height="17"/>
+                    <rect key="frame" x="131" y="46" width="37" height="17"/>
                     <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="aCe-ia-0Ww">
                         <font key="font" usesAppearanceFont="YES"/>
                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -29,13 +29,23 @@
                     </textFieldCell>
                 </textField>
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="Ydb-7n-5Cd" customClass="VLCImageView">
-                    <rect key="frame" x="0.0" y="3" width="104" height="65"/>
+                    <rect key="frame" x="3" y="3" width="120" height="75"/>
                     <constraints>
                         <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="3" y="28" width="24" height="24"/>
+                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="note" id="UzG-df-K2K"/>
+                </imageView>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="97z-d7-S3D" customClass="VLCImageView">
+                    <rect key="frame" x="48" y="3" width="75" height="75"/>
+                    <constraints>
+                        <constraint firstAttribute="width" secondItem="97z-d7-S3D" secondAttribute="height" multiplier="1:1" id="YBL-j9-anm"/>
+                    </constraints>
+                </customView>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3Ha-ZH-fa9">
-                    <rect key="frame" x="349" y="27" width="37" height="17"/>
+                    <rect key="frame" x="349" y="32" width="37" height="17"/>
                     <constraints>
                         <constraint firstAttribute="width" constant="33" id="0cB-ga-0Uw"/>
                     </constraints>
@@ -46,7 +56,7 @@
                     </textFieldCell>
                 </textField>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TPv-k2-6XS">
-                    <rect key="frame" x="112" y="13" width="37" height="17"/>
+                    <rect key="frame" x="131" y="18" width="37" height="17"/>
                     <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="jZ4-pa-K3T">
                         <font key="font" usesAppearanceFont="YES"/>
                         <color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
@@ -57,14 +67,19 @@
             <constraints>
                 <constraint firstItem="ohB-P0-nCv" firstAttribute="leading" secondItem="Ydb-7n-5Cd" secondAttribute="trailing" constant="10" id="3wD-FP-vka"/>
                 <constraint firstItem="TPv-k2-6XS" firstAttribute="leading" secondItem="ohB-P0-nCv" secondAttribute="leading" id="4qb-9H-TVg"/>
-                <constraint firstItem="Ydb-7n-5Cd" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" id="8hv-Qt-uAI"/>
+                <constraint firstItem="Ydb-7n-5Cd" firstAttribute="leading" secondItem="c22-O7-iKe" secondAttribute="leading" constant="3" id="8hv-Qt-uAI"/>
                 <constraint firstItem="xJW-ps-ycn" firstAttribute="leading" secondItem="ohB-P0-nCv" secondAttribute="leading" id="DYk-9g-adD"/>
                 <constraint firstItem="ohB-P0-nCv" firstAttribute="top" secondItem="xJW-ps-ycn" secondAttribute="bottom" constant="-3" id="Epo-on-wpL"/>
+                <constraint firstItem="97z-d7-S3D" firstAttribute="top" secondItem="c22-O7-iKe" secondAttribute="top" constant="3" id="FbP-R4-bAA"/>
                 <constraint firstItem="3Ha-ZH-fa9" firstAttribute="centerY" secondItem="ohB-P0-nCv" secondAttribute="centerY" id="Flo-4k-Vaz"/>
                 <constraint firstItem="3Ha-ZH-fa9" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="xJW-ps-ycn" secondAttribute="trailing" constant="10" id="NxZ-be-5y0"/>
+                <constraint firstItem="xnT-RR-pOf" firstAttribute="leading" secondItem="Ydb-7n-5Cd" secondAttribute="leading" id="O8E-35-EK3"/>
                 <constraint firstAttribute="trailing" secondItem="3Ha-ZH-fa9" secondAttribute="trailing" constant="14" id="SVJ-UL-O5m"/>
+                <constraint firstAttribute="bottom" secondItem="97z-d7-S3D" secondAttribute="bottom" constant="3" id="XfR-Fd-n6o"/>
                 <constraint firstAttribute="bottom" secondItem="Ydb-7n-5Cd" secondAttribute="bottom" constant="3" id="aVd-Ld-lUH"/>
+                <constraint firstItem="97z-d7-S3D" firstAttribute="trailing" secondItem="Ydb-7n-5Cd" secondAttribute="trailing" id="bzC-Km-KOo"/>
                 <constraint firstItem="3Ha-ZH-fa9" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="TPv-k2-6XS" secondAttribute="trailing" constant="10" id="feB-7H-8HN"/>
+                <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="3" id="iPZ-zR-jTv"/>
                 <constraint firstItem="ohB-P0-nCv" firstAttribute="centerY" secondItem="c22-O7-iKe" secondAttribute="centerY" id="mGo-gc-dR6"/>
                 <constraint firstItem="TPv-k2-6XS" firstAttribute="top" secondItem="ohB-P0-nCv" secondAttribute="bottom" constant="-3" id="vSW-bd-8ac"/>
@@ -72,6 +87,8 @@
             </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="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"/>
@@ -80,4 +97,7 @@
             <point key="canvasLocation" x="98" y="50.5"/>
         </customView>
     </objects>
+    <resources>
+        <image name="note" width="24" height="24"/>
+    </resources>
 </document>
diff --git a/modules/gui/macosx/library/VLCLibraryWindow.m b/modules/gui/macosx/library/VLCLibraryWindow.m
index 681e024bd9..eb90a1fca7 100644
--- a/modules/gui/macosx/library/VLCLibraryWindow.m
+++ b/modules/gui/macosx/library/VLCLibraryWindow.m
@@ -190,7 +190,7 @@ const CGFloat VLCLibraryWindowLargeRowHeight = 50.;
     [_mediaSourceCollectionView registerClass:[VLCMediaSourceCollectionViewItem class] forItemWithIdentifier:VLCMediaSourceCellIdentifier];
 
     self.upNextLabel.font = [NSFont VLClibrarySectionHeaderFont];
-    self.upNextLabel.stringValue = _NS("Up next");
+    self.upNextLabel.stringValue = _NS("Playlist");
     NSAttributedString *attributedTitle = [[NSAttributedString alloc] initWithString:_NS("Clear queue")
                                                                           attributes:@{NSFontAttributeName : [NSFont VLClibraryButtonFont],
                                                                                        NSForegroundColorAttributeName : [NSColor VLClibraryHighlightColor]}];
diff --git a/modules/gui/macosx/playlist/VLCPlaylistDataSource.m b/modules/gui/macosx/playlist/VLCPlaylistDataSource.m
index 5f65f50328..bbbfdaf316 100644
--- a/modules/gui/macosx/playlist/VLCPlaylistDataSource.m
+++ b/modules/gui/macosx/playlist/VLCPlaylistDataSource.m
@@ -22,14 +22,12 @@
 
 #import "VLCPlaylistDataSource.h"
 
-#import "extensions/NSString+Helpers.h"
 #import "main/VLCMain.h"
 #import "playlist/VLCPlaylistController.h"
 #import "playlist/VLCPlaylistTableCellView.h"
 #import "playlist/VLCPlaylistItem.h"
 #import "playlist/VLCPlaylistModel.h"
 #import "views/VLCDragDropView.h"
-#import "views/VLCImageView.h"
 
 static NSString *VLCPlaylistCellIdentifier = @"VLCPlaylistCellIdentifier";
 
@@ -80,22 +78,7 @@ static NSString *VLCPlaylistCellIdentifier = @"VLCPlaylistCellIdentifier";
         return cellView;
     }
 
-    NSString *artist = item.artistName;
-    if (artist && artist.length > 0) {
-        cellView.mediaTitleTextField.hidden = YES;
-        cellView.secondaryMediaTitleTextField.hidden = NO;
-        cellView.artistTextField.hidden = NO;
-        cellView.secondaryMediaTitleTextField.stringValue = item.title;
-        cellView.artistTextField.stringValue = artist;
-    } else {
-        cellView.mediaTitleTextField.hidden = NO;
-        cellView.secondaryMediaTitleTextField.hidden = YES;
-        cellView.artistTextField.hidden = YES;
-        cellView.mediaTitleTextField.stringValue = item.title;
-    }
-
-    cellView.durationTextField.stringValue = [NSString stringWithTimeFromTicks:item.duration];
-    cellView.mediaImageView.image = item.artworkImage;
+    cellView.representedPlaylistItem = item;
     cellView.representsCurrentPlaylistItem = _playlistController.currentPlaylistIndex == row;
 
     return cellView;
diff --git a/modules/gui/macosx/playlist/VLCPlaylistTableCellView.h b/modules/gui/macosx/playlist/VLCPlaylistTableCellView.h
index 48db8cd4c7..7c0881a18a 100644
--- a/modules/gui/macosx/playlist/VLCPlaylistTableCellView.h
+++ b/modules/gui/macosx/playlist/VLCPlaylistTableCellView.h
@@ -23,17 +23,22 @@
 #import <Cocoa/Cocoa.h>
 
 @class VLCImageView;
+ at class VLCPlaylistItem;
 
 NS_ASSUME_NONNULL_BEGIN
 
 @interface VLCPlaylistTableCellView : NSTableCellView
 
+ at property (readwrite, assign, nonatomic) VLCPlaylistItem *representedPlaylistItem;
 @property (readwrite, nonatomic) BOOL representsCurrentPlaylistItem;
+
 @property (readwrite, assign) IBOutlet NSTextField *artistTextField;
 @property (readwrite, assign) IBOutlet NSTextField *secondaryMediaTitleTextField;
 @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 VLCImageView *audioArtworkImageView;
 
 @end
 
diff --git a/modules/gui/macosx/playlist/VLCPlaylistTableCellView.m b/modules/gui/macosx/playlist/VLCPlaylistTableCellView.m
index 3c980c0371..7e4e215237 100644
--- a/modules/gui/macosx/playlist/VLCPlaylistTableCellView.m
+++ b/modules/gui/macosx/playlist/VLCPlaylistTableCellView.m
@@ -21,7 +21,10 @@
  *****************************************************************************/
 
 #import "VLCPlaylistTableCellView.h"
+#import "extensions/NSString+Helpers.h"
 #import "extensions/NSFont+VLCAdditions.h"
+#import "playlist/VLCPlaylistItem.h"
+#import "views/VLCImageView.h"
 
 @implementation VLCPlaylistTableCellView
 
@@ -33,4 +36,31 @@
     self.secondaryMediaTitleTextField.font = displayedFont;
 }
 
+- (void)setRepresentedPlaylistItem:(VLCPlaylistItem *)item
+{
+    NSString *artist = item.artistName;
+    if (artist && artist.length > 0) {
+        self.mediaTitleTextField.hidden = YES;
+        self.secondaryMediaTitleTextField.hidden = NO;
+        self.artistTextField.hidden = NO;
+        self.secondaryMediaTitleTextField.stringValue = item.title;
+        self.artistTextField.stringValue = artist;
+        self.audioArtworkImageView.image = item.artworkImage;
+        self.audioMediaTypeIndicator.hidden = NO;
+        self.mediaImageView.hidden = YES;
+    } else {
+        self.mediaTitleTextField.hidden = NO;
+        self.secondaryMediaTitleTextField.hidden = YES;
+        self.artistTextField.hidden = YES;
+        self.mediaTitleTextField.stringValue = item.title;
+        self.mediaImageView.image = item.artworkImage;
+        self.audioArtworkImageView.hidden = YES;
+        self.audioMediaTypeIndicator.hidden = YES;
+    }
+
+    self.durationTextField.stringValue = [NSString stringWithTimeFromTicks:item.duration];
+
+    _representedPlaylistItem = item;
+}
+
 @end



More information about the vlc-commits mailing list