Browse Source

macosx/library: make video cells match desired appearance

pull/90/head
Felix Paul Kühne 7 years ago
parent
commit
005b007f9a
  1. 18
      extras/package/macosx/VLC.xcodeproj/project.pbxproj
  2. 6
      modules/gui/macosx/Makefile.am
  3. BIN
      modules/gui/macosx/Resources/librarywindow/ellipsis.png
  4. BIN
      modules/gui/macosx/Resources/librarywindow/ellipsis@2x.png
  5. BIN
      modules/gui/macosx/Resources/librarywindow/libraryCellGradient@1x.png
  6. BIN
      modules/gui/macosx/Resources/librarywindow/libraryCellGradient@2x.png
  7. BIN
      modules/gui/macosx/Resources/librarywindow/libraryPlay.png
  8. BIN
      modules/gui/macosx/Resources/librarywindow/libraryPlay@2x.png
  9. 71
      modules/gui/macosx/UI/VLCLibraryCollectionViewItem.xib
  10. 2
      modules/gui/macosx/UI/VLCLibraryFolderManagementWindow.xib
  11. 5
      modules/gui/macosx/UI/VLCLibraryWindow.xib
  12. 6
      modules/gui/macosx/library/VLCLibraryCollectionViewItem.h
  13. 79
      modules/gui/macosx/library/VLCLibraryCollectionViewItem.m

18
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 /* libraryCellGradient@1x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "libraryCellGradient@1x.png"; path = "../librarywindow/libraryCellGradient@1x.png"; sourceTree = "<group>"; };
7D0F64092202058700FDB91F /* libraryCellGradient@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "libraryCellGradient@2x.png"; path = "../librarywindow/libraryCellGradient@2x.png"; 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 /* ellipsis@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "ellipsis@2x.png"; path = "librarywindow/ellipsis@2x.png"; sourceTree = "<group>"; };
7D28E63F2275C9C70098D30E /* libraryPlay@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "libraryPlay@2x.png"; path = "librarywindow/libraryPlay@2x.png"; 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 /* libraryCellGradient@1x.png */,
7D0F64092202058700FDB91F /* libraryCellGradient@2x.png */,
7D28E63D2275C8660098D30E /* ellipsis.png */,
7D28E63E2275C8660098D30E /* ellipsis@2x.png */,
7D28E6402275C9C70098D30E /* libraryPlay.png */,
7D28E63F2275C9C70098D30E /* libraryPlay@2x.png */,
);
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 */,

6
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/libraryCellGradient@1x.png \
gui/macosx/Resources/librarywindow/libraryCellGradient@2x.png \
gui/macosx/Resources/librarywindow/ellipsis.png \
gui/macosx/Resources/librarywindow/ellipsis@2x.png \
gui/macosx/Resources/librarywindow/libraryPlay.png \
gui/macosx/Resources/librarywindow/libraryPlay@2x.png \
gui/macosx/Resources/mainwindow/backward-3btns-pressed.png \
gui/macosx/Resources/mainwindow/backward-3btns-pressed@2x.png \
gui/macosx/Resources/mainwindow/backward-3btns.png \

BIN
modules/gui/macosx/Resources/librarywindow/ellipsis.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

BIN
modules/gui/macosx/Resources/librarywindow/ellipsis@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

BIN
modules/gui/macosx/Resources/librarywindow/libraryCellGradient@1x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 631 B

BIN
modules/gui/macosx/Resources/librarywindow/libraryCellGradient@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 659 B

BIN
modules/gui/macosx/Resources/librarywindow/libraryPlay.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
modules/gui/macosx/Resources/librarywindow/libraryPlay@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

71
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>

2
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>

5
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"/>

6
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

79
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

Loading…
Cancel
Save