vlc | branch: master | Felix Paul Kühne <[email protected]> | Sun Apr 28 14:07:54 
2019 +0200| [005b007f9a5e825c2ca92f49cf1d9de7dd854f98] | committer: Felix Paul 
Kühne

macosx/library: make video cells match desired appearance

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

 .../package/macosx/VLC.xcodeproj/project.pbxproj   |  18 +++--
 modules/gui/macosx/Makefile.am                     |   6 +-
 .../macosx/Resources/librarywindow/ellipsis.png    | Bin 0 -> 136 bytes
 .../macosx/Resources/librarywindow/[email protected] | Bin 0 -> 170 bytes
 .../librarywindow/[email protected]       | Bin 631 -> 0 bytes
 .../librarywindow/[email protected]       | Bin 659 -> 0 bytes
 .../macosx/Resources/librarywindow/libraryPlay.png | Bin 0 -> 1710 bytes
 .../Resources/librarywindow/[email protected]     | Bin 0 -> 2245 bytes
 .../gui/macosx/UI/VLCLibraryCollectionViewItem.xib |  71 +++++++++---------
 .../macosx/UI/VLCLibraryFolderManagementWindow.xib |   2 +-
 modules/gui/macosx/UI/VLCLibraryWindow.xib         |   5 +-
 .../macosx/library/VLCLibraryCollectionViewItem.h  |   6 ++
 .../macosx/library/VLCLibraryCollectionViewItem.m  |  79 +++++++++++++++++++++
 13 files changed, 140 insertions(+), 47 deletions(-)

diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj 
b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
index d9c698f778..cd17eb87d8 100644
--- a/extras/package/macosx/VLC.xcodeproj/project.pbxproj
+++ b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
@@ -439,14 +439,16 @@
                7D0F64032202047900FDB91F /* VLCLibraryCollectionViewItem.h */ = 
{isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 
VLCLibraryCollectionViewItem.h; sourceTree = "<group>"; };
                7D0F64042202047900FDB91F /* VLCLibraryCollectionViewItem.m */ = 
{isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = 
VLCLibraryCollectionViewItem.m; sourceTree = "<group>"; };
                7D0F64052202047900FDB91F /* VLCLibraryCollectionViewItem.xib */ 
= {isa = PBXFileReference; lastKnownFileType = file.xib; path = 
VLCLibraryCollectionViewItem.xib; sourceTree = "<group>"; };
-               7D0F64082202058700FDB91F /* [email protected] */ = 
{isa = PBXFileReference; lastKnownFileType = image.png; name = 
"[email protected]"; path = 
"../librarywindow/[email protected]"; sourceTree = "<group>"; };
-               7D0F64092202058700FDB91F /* [email protected] */ = 
{isa = PBXFileReference; lastKnownFileType = image.png; name = 
"[email protected]"; path = 
"../librarywindow/[email protected]"; sourceTree = "<group>"; };
                7D0F640A2202163E00FDB91F /* VLCPlaylistDataSource.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 
VLCPlaylistDataSource.h; sourceTree = "<group>"; };
                7D0F640B2202163E00FDB91F /* VLCPlaylistDataSource.m */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = 
VLCPlaylistDataSource.m; sourceTree = "<group>"; };
                7D28E6342275B4820098D30E /* NSColor+VLCAdditions.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 
"NSColor+VLCAdditions.h"; sourceTree = "<group>"; };
                7D28E6352275B4820098D30E /* NSColor+VLCAdditions.m */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = 
"NSColor+VLCAdditions.m"; sourceTree = "<group>"; };
                7D28E6372275B7340098D30E /* NSFont+VLCAdditions.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 
"NSFont+VLCAdditions.h"; sourceTree = "<group>"; };
                7D28E6382275B7340098D30E /* NSFont+VLCAdditions.m */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = 
"NSFont+VLCAdditions.m"; sourceTree = "<group>"; };
+               7D28E63D2275C8660098D30E /* ellipsis.png */ = {isa = 
PBXFileReference; lastKnownFileType = image.png; name = ellipsis.png; path = 
librarywindow/ellipsis.png; sourceTree = "<group>"; };
+               7D28E63E2275C8660098D30E /* [email protected] */ = {isa = 
PBXFileReference; lastKnownFileType = image.png; name = "[email protected]"; path 
= "librarywindow/[email protected]"; sourceTree = "<group>"; };
+               7D28E63F2275C9C70098D30E /* [email protected] */ = {isa = 
PBXFileReference; lastKnownFileType = image.png; name = "[email protected]"; 
path = "librarywindow/[email protected]"; sourceTree = "<group>"; };
+               7D28E6402275C9C70098D30E /* libraryPlay.png */ = {isa = 
PBXFileReference; lastKnownFileType = image.png; name = libraryPlay.png; path = 
librarywindow/libraryPlay.png; sourceTree = "<group>"; };
                7D2E0ED920CD204D0033A221 /* VLCWindow.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= VLCWindow.m; sourceTree = "<group>"; };
                7D2E0EDA20CD204D0033A221 /* VLCWindow.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
VLCWindow.h; sourceTree = "<group>"; };
                7D2E0EDC20CD206F0033A221 /* VLCVideoWindowCommon.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
VLCVideoWindowCommon.h; sourceTree = "<group>"; };
@@ -1291,13 +1293,15 @@
                        name = misc;
                        sourceTree = "<group>";
                };
-               7D0F64072202057C00FDB91F /* Library Window */ = {
+               7D28E63C2275C80E0098D30E /* Library Window */ = {
                        isa = PBXGroup;
                        children = (
-                               7D0F64082202058700FDB91F /* 
[email protected] */,
-                               7D0F64092202058700FDB91F /* 
[email protected] */,
+                               7D28E63D2275C8660098D30E /* ellipsis.png */,
+                               7D28E63E2275C8660098D30E /* [email protected] */,
+                               7D28E6402275C9C70098D30E /* libraryPlay.png */,
+                               7D28E63F2275C9C70098D30E /* [email protected] 
*/,
                        );
-                       path = "Library Window";
+                       name = "Library Window";
                        sourceTree = "<group>";
                };
                7D903EB4224393C700917358 /* core dependencies */ = {
@@ -1380,7 +1384,7 @@
                CC0430EE13B2461A00D7D52E /* UI Graphics */ = {
                        isa = PBXGroup;
                        children = (
-                               7D0F64072202057C00FDB91F /* Library Window */,
+                               7D28E63C2275C80E0098D30E /* Library Window */,
                                6B82255A1E4D2BE400833BE1 /* Main Window */,
                                6B8229CB1E4D2D2C00833BE1 /* Sidebar Icons */,
                                6B8229FD1E4D2DB400833BE1 /* noart.png */,
diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am
index 658215ceb4..fc804d9ffc 100644
--- a/modules/gui/macosx/Makefile.am
+++ b/modules/gui/macosx/Makefile.am
@@ -297,8 +297,10 @@ libmacosx_plugin_la_RES = \
        gui/macosx/Resources/File-Icons/wav.icns \
        gui/macosx/Resources/File-Icons/wma.icns \
        gui/macosx/Resources/File-Icons/wmv.icns \
-       gui/macosx/Resources/librarywindow/[email protected] \
-       gui/macosx/Resources/librarywindow/[email protected] \
+       gui/macosx/Resources/librarywindow/ellipsis.png \
+       gui/macosx/Resources/librarywindow/[email protected] \
+       gui/macosx/Resources/librarywindow/libraryPlay.png \
+       gui/macosx/Resources/librarywindow/[email protected] \
        gui/macosx/Resources/mainwindow/backward-3btns-pressed.png \
        gui/macosx/Resources/mainwindow/[email protected] \
        gui/macosx/Resources/mainwindow/backward-3btns.png \
diff --git a/modules/gui/macosx/Resources/librarywindow/ellipsis.png 
b/modules/gui/macosx/Resources/librarywindow/ellipsis.png
new file mode 100644
index 0000000000..85ed54a0e7
Binary files /dev/null and 
b/modules/gui/macosx/Resources/librarywindow/ellipsis.png differ
diff --git a/modules/gui/macosx/Resources/librarywindow/[email protected] 
b/modules/gui/macosx/Resources/librarywindow/[email protected]
new file mode 100644
index 0000000000..424ad8f32e
Binary files /dev/null and 
b/modules/gui/macosx/Resources/librarywindow/[email protected] differ
diff --git 
a/modules/gui/macosx/Resources/librarywindow/[email protected] 
b/modules/gui/macosx/Resources/librarywindow/[email protected]
deleted file mode 100644
index ae65fd2ae5..0000000000
Binary files 
a/modules/gui/macosx/Resources/librarywindow/[email protected] and 
/dev/null differ
diff --git 
a/modules/gui/macosx/Resources/librarywindow/[email protected] 
b/modules/gui/macosx/Resources/librarywindow/[email protected]
deleted file mode 100644
index 6c88fd40f3..0000000000
Binary files 
a/modules/gui/macosx/Resources/librarywindow/[email protected] and 
/dev/null differ
diff --git a/modules/gui/macosx/Resources/librarywindow/libraryPlay.png 
b/modules/gui/macosx/Resources/librarywindow/libraryPlay.png
new file mode 100644
index 0000000000..1d11778aa7
Binary files /dev/null and 
b/modules/gui/macosx/Resources/librarywindow/libraryPlay.png differ
diff --git a/modules/gui/macosx/Resources/librarywindow/[email protected] 
b/modules/gui/macosx/Resources/librarywindow/[email protected]
new file mode 100644
index 0000000000..771af5950f
Binary files /dev/null and 
b/modules/gui/macosx/Resources/librarywindow/[email protected] differ
diff --git a/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib 
b/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib
index 1315f68822..87147d3da2 100644
--- a/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib
+++ b/modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib
@@ -17,27 +17,40 @@
         </customObject>
         <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="480" height="272"/>
+        <customView id="Hz6-mo-xeY" 
customClass="VLCLibraryCollectionViewTrackingView">
+            <rect key="frame" x="0.0" y="0.0" width="256" height="214"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" 
flexibleMinY="YES"/>
             <subviews>
                 <customView translatesAutoresizingMaskIntoConstraints="NO" 
id="2aB-sB-hfY" customClass="VLCImageView">
-                    <rect key="frame" x="0.0" y="0.0" width="480" 
height="272"/>
+                    <rect key="frame" x="0.0" y="46" width="256" height="168"/>
+                    <subviews>
+                        <button verticalHuggingPriority="750" 
translatesAutoresizingMaskIntoConstraints="NO" id="S3I-5Z-qgS">
+                            <rect key="frame" x="96" y="52" 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"/>
+                            </buttonCell>
+                            <connections>
+                                <action selector="playInstantly:" target="-2" 
id="E2B-oj-rx3"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="S3I-5Z-qgS" 
firstAttribute="centerX" secondItem="2aB-sB-hfY" secondAttribute="centerX" 
id="Seo-tS-piW"/>
+                        <constraint firstAttribute="height" constant="168" 
id="Vrp-AD-scC"/>
+                        <constraint firstItem="S3I-5Z-qgS" 
firstAttribute="centerY" secondItem="2aB-sB-hfY" secondAttribute="centerY" 
id="ZWU-oW-OVa"/>
+                    </constraints>
                 </customView>
-                <imageView horizontalHuggingPriority="251" 
verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" 
id="A5y-ue-y7t">
-                    <rect key="frame" x="0.0" y="0.0" width="480" 
height="272"/>
-                    <imageCell key="cell" refusesFirstResponder="YES" 
alignment="left" imageScaling="axesIndependently" image="libraryCellGradient" 
id="kbU-NG-wPM"/>
-                </imageView>
                 <textField horizontalHuggingPriority="251" 
verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" 
id="OBS-Eh-1mT">
-                    <rect key="frame" x="18" y="20" width="52" height="24"/>
-                    <textFieldCell key="cell" lineBreakMode="clipping" 
title="Label" id="7Hy-o3-LvX">
+                    <rect key="frame" x="-2" y="18" 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"/>
                         <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="VAn-gF-QiZ">
-                    <rect key="frame" x="420" y="20" width="42" height="19"/>
+                    <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"/>
                         <color key="textColor" name="labelColor" 
catalog="System" colorSpace="catalog"/>
@@ -45,8 +58,12 @@
                     </textFieldCell>
                 </textField>
                 <button verticalHuggingPriority="750" 
translatesAutoresizingMaskIntoConstraints="NO" id="Ubz-8I-W2F">
-                    <rect key="frame" x="417" y="224" width="49" height="32"/>
-                    <buttonCell key="cell" type="push" title="+" 
bezelStyle="rounded" alignment="center" borderStyle="border" 
imageScaling="proportionallyDown" inset="2" id="6ko-MM-ds0">
+                    <rect key="frame" x="216" y="174" width="20" height="20"/>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="20" 
id="XhX-7U-Nxj"/>
+                        <constraint firstAttribute="height" constant="20" 
id="ZDT-YM-Cbr"/>
+                    </constraints>
+                    <buttonCell key="cell" type="square" 
bezelStyle="shadowlessSquare" image="ellipsis" imagePosition="only" 
alignment="center" inset="2" id="6ko-MM-ds0">
                         <behavior key="behavior" pushIn="YES" 
lightByBackground="YES" lightByGray="YES"/>
                         <font key="font" metaFont="system"/>
                     </buttonCell>
@@ -54,39 +71,23 @@
                         <action selector="addToPlaylist:" target="-2" 
id="2C9-Rn-VAb"/>
                     </connections>
                 </button>
-                <button verticalHuggingPriority="750" 
translatesAutoresizingMaskIntoConstraints="NO" id="S3I-5Z-qgS">
-                    <rect key="frame" x="368" y="224" width="49" height="32"/>
-                    <buttonCell key="cell" type="push" title="P" 
bezelStyle="rounded" alignment="center" borderStyle="border" 
imageScaling="proportionallyDown" inset="2" id="IHP-p1-d0R">
-                        <behavior key="behavior" pushIn="YES" 
lightByBackground="YES" lightByGray="YES"/>
-                        <font key="font" metaFont="system"/>
-                    </buttonCell>
-                    <connections>
-                        <action selector="playInstantly:" target="-2" 
id="E2B-oj-rx3"/>
-                    </connections>
-                </button>
             </subviews>
             <constraints>
-                <constraint firstItem="VAn-gF-QiZ" firstAttribute="leading" 
relation="greaterThanOrEqual" secondItem="OBS-Eh-1mT" 
secondAttribute="trailing" constant="20" id="2di-oZ-tsC"/>
+                <constraint firstItem="VAn-gF-QiZ" firstAttribute="leading" 
secondItem="Hz6-mo-xeY" secondAttribute="leading" id="0TA-ug-pKW"/>
+                <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="20" id="8Qf-Un-Gdl"/>
-                <constraint firstAttribute="bottom" secondItem="2aB-sB-hfY" 
secondAttribute="bottom" id="C2H-Jc-A9V"/>
-                <constraint firstItem="Ubz-8I-W2F" firstAttribute="leading" 
secondItem="S3I-5Z-qgS" secondAttribute="trailing" constant="12" 
id="DZe-x4-j0v"/>
-                <constraint firstItem="A5y-ue-y7t" firstAttribute="top" 
secondItem="Hz6-mo-xeY" secondAttribute="top" id="NpD-8l-D5s"/>
-                <constraint firstAttribute="trailing" secondItem="VAn-gF-QiZ" 
secondAttribute="trailing" constant="20" id="Ol6-wf-2dJ"/>
+                <constraint firstAttribute="bottom" secondItem="VAn-gF-QiZ" 
secondAttribute="bottom" id="Kp0-Hx-3Ek"/>
                 <constraint firstItem="2aB-sB-hfY" firstAttribute="top" 
secondItem="Hz6-mo-xeY" secondAttribute="top" id="YP6-lv-ECe"/>
                 <constraint firstAttribute="trailing" secondItem="Ubz-8I-W2F" 
secondAttribute="trailing" constant="20" id="ZVz-SL-rxZ"/>
-                <constraint firstAttribute="bottom" secondItem="A5y-ue-y7t" 
secondAttribute="bottom" id="cnQ-bx-Fmn"/>
-                <constraint firstAttribute="bottom" secondItem="OBS-Eh-1mT" 
secondAttribute="bottom" constant="20" id="dy4-gP-Sdi"/>
-                <constraint firstItem="Ubz-8I-W2F" firstAttribute="centerY" 
secondItem="S3I-5Z-qgS" secondAttribute="centerY" id="fTo-dl-S2N"/>
                 <constraint firstAttribute="trailing" secondItem="2aB-sB-hfY" 
secondAttribute="trailing" id="oZw-Ab-83p"/>
-                <constraint firstAttribute="trailing" secondItem="A5y-ue-y7t" 
secondAttribute="trailing" id="rKQ-WW-oC6"/>
                 <constraint firstItem="2aB-sB-hfY" firstAttribute="leading" 
secondItem="Hz6-mo-xeY" secondAttribute="leading" id="t9g-tX-AQX"/>
-                <constraint firstItem="VAn-gF-QiZ" firstAttribute="bottom" 
secondItem="OBS-Eh-1mT" secondAttribute="bottom" id="ukj-ba-ask"/>
-                <constraint firstItem="A5y-ue-y7t" firstAttribute="leading" 
secondItem="Hz6-mo-xeY" secondAttribute="leading" id="x7v-58-kKz"/>
-                <constraint firstItem="OBS-Eh-1mT" firstAttribute="leading" 
secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" 
id="yvp-xr-geN"/>
+                <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>
         </customView>
     </objects>
     <resources>
-        <image name="libraryCellGradient" width="2" height="190"/>
+        <image name="ellipsis" width="17" height="3"/>
+        <image name="libraryPlay" width="64" height="64"/>
     </resources>
 </document>
diff --git a/modules/gui/macosx/UI/VLCLibraryFolderManagementWindow.xib 
b/modules/gui/macosx/UI/VLCLibraryFolderManagementWindow.xib
index 580517ec65..bfb18204fa 100644
--- a/modules/gui/macosx/UI/VLCLibraryFolderManagementWindow.xib
+++ b/modules/gui/macosx/UI/VLCLibraryFolderManagementWindow.xib
@@ -98,7 +98,7 @@
                             <rect key="frame" x="1" y="318" width="636" 
height="16"/>
                             <autoresizingMask key="autoresizingMask"/>
                         </scroller>
-                        <scroller key="verticalScroller" hidden="YES" 
wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" 
id="wbF-0g-t3S">
+                        <scroller key="verticalScroller" hidden="YES" 
wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="wbF-0g-t3S">
                             <rect key="frame" x="224" y="17" width="15" 
height="102"/>
                             <autoresizingMask key="autoresizingMask"/>
                         </scroller>
diff --git a/modules/gui/macosx/UI/VLCLibraryWindow.xib 
b/modules/gui/macosx/UI/VLCLibraryWindow.xib
index 857e20fc7e..a5c5e0c1ad 100644
--- a/modules/gui/macosx/UI/VLCLibraryWindow.xib
+++ b/modules/gui/macosx/UI/VLCLibraryWindow.xib
@@ -52,8 +52,9 @@
                                                 <collectionView 
selectable="YES" id="B8x-e8-7zp" customClass="VLCLibraryCollectionView">
                                                     <rect key="frame" x="0.0" 
y="0.0" width="242" height="291"/>
                                                     <autoresizingMask 
key="autoresizingMask" widthSizable="YES"/>
-                                                    <collectionViewFlowLayout 
key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" 
id="Rag-cM-k1g">
-                                                        <size key="itemSize" 
width="240" height="120"/>
+                                                    <collectionViewFlowLayout 
key="collectionViewLayout" minimumInteritemSpacing="20" minimumLineSpacing="20" 
id="Rag-cM-k1g">
+                                                        <size key="itemSize" 
width="256" height="214"/>
+                                                        <edgeInsets 
key="sectionInset" left="20" right="20" top="0.0" bottom="0.0"/>
                                                     </collectionViewFlowLayout>
                                                     <color 
key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" 
colorSpace="catalog"/>
                                                     <color 
key="secondaryBackgroundColor" name="controlAlternatingRowColor" 
catalog="System" colorSpace="catalog"/>
diff --git a/modules/gui/macosx/library/VLCLibraryCollectionViewItem.h 
b/modules/gui/macosx/library/VLCLibraryCollectionViewItem.h
index 6c3cc45cab..df25052046 100644
--- a/modules/gui/macosx/library/VLCLibraryCollectionViewItem.h
+++ b/modules/gui/macosx/library/VLCLibraryCollectionViewItem.h
@@ -44,4 +44,10 @@ extern NSString *VLCLibraryCellIdentifier;
 
 @end
 
+@interface VLCLibraryCollectionViewTrackingView : NSView
+
+@property (readwrite, assign) NSButton *buttonToHide;
+
+@end
+
 NS_ASSUME_NONNULL_END
diff --git a/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m 
b/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
index 7bf3cb1bdd..84817d54ad 100644
--- a/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
+++ b/modules/gui/macosx/library/VLCLibraryCollectionViewItem.m
@@ -28,6 +28,8 @@
 #import "library/VLCLibraryDataTypes.h"
 #import "views/VLCImageView.h"
 #import "extensions/NSString+Helpers.h"
+#import "extensions/NSFont+VLCAdditions.h"
+#import "extensions/NSColor+VLCAdditions.h"
 
 NSString *VLCLibraryCellIdentifier = @"VLCLibraryCellIdentifier";
 
@@ -51,6 +53,48 @@ NSString *VLCLibraryCellIdentifier = 
@"VLCLibraryCellIdentifier";
 - (void)dealloc
 {
     [[NSNotificationCenter defaultCenter] removeObserver:self];
+    if (@available(macOS 10_14, *)) {
+        [[NSApplication sharedApplication] removeObserver:self 
forKeyPath:@"effectiveAppearance"];
+    }
+}
+
+- (void)awakeFromNib
+{
+    self.playInstantlyButton.hidden = YES;
+    [(VLCLibraryCollectionViewTrackingView *)self.view 
setButtonToHide:self.playInstantlyButton];
+    self.mediaTitleTextField.font = [NSFont VLClibraryCellTitleFont];
+    self.durationTextField.font = [NSFont VLClibraryCellSubtitleFont];
+    self.durationTextField.textColor = [NSColor VLClibrarySubtitleColor];
+
+    if (@available(macOS 10_14, *)) {
+        [[NSApplication sharedApplication] addObserver:self
+                                            forKeyPath:@"effectiveAppearance"
+                                               options:0
+                                               context:nil];
+    }
+
+    [self updateColoredAppearance];
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath
+                      ofObject:(id)object
+                        change:(NSDictionary<NSKeyValueChangeKey,id> *)change
+                       context:(void *)context
+{
+    [self updateColoredAppearance];
+}
+
+- (void)updateColoredAppearance
+{
+    if (@available(macOS 10_14, *)) {
+        if ([self.view.effectiveAppearance.name 
isEqualToString:NSAppearanceNameDarkAqua]) {
+            self.mediaTitleTextField.textColor = [NSColor 
VLClibraryDarkTitleColor];
+        } else {
+            self.mediaTitleTextField.textColor = [NSColor 
VLClibraryLightTitleColor];
+        }
+    } else {
+        self.mediaTitleTextField.textColor = [NSColor 
VLClibraryLightTitleColor];
+    }
 }
 
 #pragma mark - view representation
@@ -123,3 +167,38 @@ NSString *VLCLibraryCellIdentifier = 
@"VLCLibraryCellIdentifier";
 }
 
 @end
+
+@interface VLCLibraryCollectionViewTrackingView ()
+{
+    NSTrackingArea *_trackingArea;
+}
+@end
+
+@implementation VLCLibraryCollectionViewTrackingView
+
+- (void)mouseExited:(NSEvent *)event
+{
+    self.buttonToHide.hidden = YES;
+}
+
+- (void)mouseEntered:(NSEvent *)event
+{
+    self.buttonToHide.hidden = NO;
+}
+
+- (void)updateTrackingAreas
+{
+    [super updateTrackingAreas];
+    if(_trackingArea != nil) {
+        [self removeTrackingArea:_trackingArea];
+    }
+
+    NSTrackingAreaOptions trackingAreaOptions = 
(NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways);
+    _trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds]
+                                                 options:trackingAreaOptions
+                                                   owner:self
+                                                userInfo:nil];
+    [self addTrackingArea:_trackingArea];
+}
+
+@end

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to