[vlc-commits] [Git][videolan/vlc][master] 6 commits: macosx: Use VLCAccentColor and VLCPlayTemplate for small play button on VLCLibrarySongTableCellView

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat May 13 09:20:30 UTC 2023



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


Commits:
9e15e37d by Claudio Cambra at 2023-05-13T08:48:09+00:00
macosx: Use VLCAccentColor and VLCPlayTemplate for small play button on VLCLibrarySongTableCellView

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

- - - - -
196bbfd9 by Claudio Cambra at 2023-05-13T08:48:09+00:00
macosx: Ensure play instantly button is set to system accent colour if possible in VLCLibrarySongTableCellView

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

- - - - -
1448948a by Claudio Cambra at 2023-05-13T08:48:09+00:00
macosx: Use VLCAccentColor for progress indicator foreground

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

- - - - -
d5f3fed7 by Claudio Cambra at 2023-05-13T08:48:09+00:00
macosx: Remove now unused VLCLibraryProgressIndicatorForegroundColor

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

- - - - -
1d73e8f9 by Claudio Cambra at 2023-05-13T08:48:09+00:00
macosx: Add method in NSImage extension to tint an image

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

- - - - -
185d8522 by Claudio Cambra at 2023-05-13T08:48:09+00:00
macosx: Tint images for activated shuffle and repeat to VLCAccentColor

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

- - - - -


9 changed files:

- modules/gui/macosx/UI/VLCLibrarySongTableCellView.xib
- modules/gui/macosx/extensions/NSColor+VLCAdditions.h
- modules/gui/macosx/extensions/NSColor+VLCAdditions.m
- modules/gui/macosx/extensions/NSImage+VLCAdditions.h
- modules/gui/macosx/extensions/NSImage+VLCAdditions.m
- modules/gui/macosx/library/VLCLibraryWindow.m
- modules/gui/macosx/library/audio-library/VLCLibrarySongTableCellView.m
- modules/gui/macosx/views/VLCLinearProgressIndicator.m
- modules/gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.m


Changes:

=====================================
modules/gui/macosx/UI/VLCLibrarySongTableCellView.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>
@@ -35,15 +36,16 @@
                     </textFieldCell>
                 </textField>
                 <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="NFZ-x0-t5c">
-                    <rect key="frame" x="10" y="7" width="12.5" height="36"/>
+                    <rect key="frame" x="10" y="17" width="16" height="16"/>
                     <constraints>
-                        <constraint firstAttribute="height" constant="32" id="bai-RH-huE"/>
+                        <constraint firstAttribute="width" secondItem="NFZ-x0-t5c" secondAttribute="height" multiplier="1:1" id="Hv5-J8-wdk"/>
+                        <constraint firstAttribute="height" constant="16" id="bai-RH-huE"/>
                     </constraints>
-                    <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="play.fill" catalog="system" imagePosition="only" alignment="left" imageScaling="proportionallyDown" inset="2" id="5MR-Gt-X4p">
+                    <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCPlayTemplate" imagePosition="only" alignment="left" imageScaling="proportionallyDown" inset="2" id="5MR-Gt-X4p">
                         <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="system"/>
                     </buttonCell>
-                    <color key="contentTintColor" red="1" green="0.38123786450000002" blue="0.039215686270000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                    <color key="contentTintColor" name="VLCAccentColor"/>
                 </button>
                 <textField horizontalHuggingPriority="1000" verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="XNL-fH-9bU">
                     <rect key="frame" x="334" y="17" width="56" height="16"/>
@@ -81,6 +83,9 @@
         </customView>
     </objects>
     <resources>
-        <image name="play.fill" catalog="system" width="12" height="13"/>
+        <image name="VLCPlayTemplate" width="128" height="128"/>
+        <namedColor name="VLCAccentColor">
+            <color red="1" green="0.37999999523162842" blue="0.039999999105930328" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+        </namedColor>
     </resources>
 </document>


=====================================
modules/gui/macosx/extensions/NSColor+VLCAdditions.h
=====================================
@@ -36,7 +36,6 @@ NS_ASSUME_NONNULL_BEGIN
 + (instancetype)VLClibrarySeparatorLightColor;
 + (instancetype)VLClibrarySeparatorDarkColor;
 + (instancetype)VLClibraryProgressIndicatorBackgroundColor;
-+ (instancetype)VLClibraryProgressIndicatorForegroundColor;
 + (instancetype)VLClibraryItemBorderLightColor;
 + (instancetype)VLClibraryItemBorderDarkColor;
 + (instancetype)VLClibraryCollectionViewItemBackgroundLightColor;


=====================================
modules/gui/macosx/extensions/NSColor+VLCAdditions.m
=====================================
@@ -78,11 +78,6 @@
     return [NSColor colorWithRed:37./255. green:41./255. blue:44./255. alpha:.8];
 }
 
-+ (instancetype)VLClibraryProgressIndicatorForegroundColor
-{
-    return [NSColor colorWithRed:246./255. green:127./255. blue:0. alpha:1.];
-}
-
 + (instancetype)VLClibraryItemBorderLightColor
 {
     return [NSColor colorWithRed:0.89 green:0.89 blue:0.91 alpha:1.];


=====================================
modules/gui/macosx/extensions/NSImage+VLCAdditions.h
=====================================
@@ -29,6 +29,8 @@ NS_ASSUME_NONNULL_BEGIN
 + (instancetype)quickLookPreviewForLocalPath:(NSString*)path withSize:(NSSize)size;
 + (instancetype)quickLookPreviewForLocalURL:(NSURL*)url withSize:(NSSize)size;
 
+- (instancetype)imageTintedWithColor:(NSColor *)color;
+
 @end
 
 NS_ASSUME_NONNULL_END


=====================================
modules/gui/macosx/extensions/NSImage+VLCAdditions.m
=====================================
@@ -72,4 +72,19 @@
     return image;
 }
 
+- (instancetype)imageTintedWithColor:(NSColor *)color
+{
+    NSImage * const image = [self copy];
+
+    if (color != nil) {
+        [image lockFocus];
+        [color set];
+        const NSRect imageRect = {NSZeroPoint, image.size};
+        NSRectFillUsingOperation(imageRect, NSCompositeSourceIn);
+        [image unlockFocus];
+    }
+
+    return image;
+}
+
 @end


=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -24,9 +24,10 @@
 
 #import "VLCLibraryDataTypes.h"
 
-#import "extensions/NSString+Helpers.h"
-#import "extensions/NSFont+VLCAdditions.h"
 #import "extensions/NSColor+VLCAdditions.h"
+#import "extensions/NSImage+VLCAdditions.h"
+#import "extensions/NSFont+VLCAdditions.h"
+#import "extensions/NSString+Helpers.h"
 #import "extensions/NSView+VLCAdditions.h"
 #import "main/VLCMain.h"
 
@@ -325,7 +326,7 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
     if (_playlistController.playbackOrder == VLC_PLAYLIST_PLAYBACK_ORDER_NORMAL) {
         self.shufflePlaylistButton.image = [NSImage imageNamed:@"shuffleOff"];
     } else {
-        self.shufflePlaylistButton.image = [NSImage imageNamed:@"shuffleOn"];
+        self.shufflePlaylistButton.image = [[NSImage imageNamed:@"shuffleOn"] imageTintedWithColor:[NSColor VLCAccentColor]];
     }
 }
 
@@ -351,10 +352,10 @@ static void addShadow(NSImageView *__unsafe_unretained imageView)
     enum vlc_playlist_playback_repeat currentRepeatState = _playlistController.playbackRepeat;
     switch (currentRepeatState) {
         case VLC_PLAYLIST_PLAYBACK_REPEAT_ALL:
-            self.repeatPlaylistButton.image = [NSImage imageNamed:@"repeatAll"];
+            self.repeatPlaylistButton.image = [[NSImage imageNamed:@"repeatAll"] imageTintedWithColor:[NSColor VLCAccentColor]];
             break;
         case VLC_PLAYLIST_PLAYBACK_REPEAT_CURRENT:
-            self.repeatPlaylistButton.image = [NSImage imageNamed:@"repeatOne"];
+            self.repeatPlaylistButton.image = [[NSImage imageNamed:@"repeatOne"] imageTintedWithColor:[NSColor VLCAccentColor]];
             break;
 
         default:


=====================================
modules/gui/macosx/library/audio-library/VLCLibrarySongTableCellView.m
=====================================
@@ -58,6 +58,11 @@ NSString *VLCAudioLibrarySongCellIdentifier = @"VLCAudioLibrarySongCellIdentifie
 
     self.trackingView.viewToHide = self.playInstantlyButton;
     self.trackingView.viewToShow = self.trackNumberTextField;
+
+    if (@available(macOS 10.14, *)) {
+        self.playInstantlyButton.contentTintColor = [NSColor VLCAccentColor];
+    }
+
     [self prepareForReuse];
 }
 


=====================================
modules/gui/macosx/views/VLCLinearProgressIndicator.m
=====================================
@@ -58,7 +58,7 @@
     frame.size.width = 0.;
     _foregroundView = [[NSView alloc] initWithFrame:frame];
     _foregroundView.wantsLayer = YES;
-    _foregroundView.layer.backgroundColor = [NSColor VLClibraryProgressIndicatorForegroundColor].CGColor;
+    _foregroundView.layer.backgroundColor = [NSColor VLCAccentColor].CGColor;
     _foregroundView.autoresizingMask = NSViewWidthSizable;
     _foregroundView.translatesAutoresizingMaskIntoConstraints = NO;
     [self addSubview:_foregroundView];


=====================================
modules/gui/macosx/windows/mainwindow/VLCMainWindowControlsBar.m
=====================================
@@ -25,6 +25,7 @@
 #import "VLCControlsBarCommon.h"
 
 #import "extensions/NSColor+VLCAdditions.h"
+#import "extensions/NSImage+VLCAdditions.h"
 #import "extensions/NSString+Helpers.h"
 
 #import "library/VLCInputItem.h"
@@ -86,12 +87,12 @@
                                name:VLCPlaybackRepeatChanged
                              object:nil];
 
-    _repeatAllImage = [NSImage imageNamed:@"repeatAll"];
+    _repeatAllImage = [[NSImage imageNamed:@"repeatAll"] imageTintedWithColor:[NSColor VLCAccentColor]];
     _repeatOffImage = [NSImage imageNamed:@"repeatOff"];
-    _repeatOneImage = [NSImage imageNamed:@"repeatOne"];
+    _repeatOneImage = [[NSImage imageNamed:@"repeatOne"] imageTintedWithColor:[NSColor VLCAccentColor]];
 
     _shuffleOffImage = [NSImage imageNamed:@"shuffleOff"];
-    _shuffleOnImage = [NSImage imageNamed:@"shuffleOn"];
+    _shuffleOnImage = [[NSImage imageNamed:@"shuffleOn"] imageTintedWithColor:[NSColor VLCAccentColor]];
 
     self.repeatButton.action = @selector(repeatAction:);
     self.shuffleButton.action = @selector(shuffleAction:);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/33fc5b20515000b8d602373f9cb425eae68c60d6...185d8522afa716cc7c7677715b63447d8f1c58aa

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/33fc5b20515000b8d602373f9cb425eae68c60d6...185d8522afa716cc7c7677715b63447d8f1c58aa
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