Skip to content
Snippets Groups Projects
Commit 21b23aa8 authored by Claudio Cambra's avatar Claudio Cambra Committed by Jean-Baptiste Kempf
Browse files

macosx: Improve album supplementary view layout, add play/enqueue buttons


Signed-off-by: default avatarClaudio Cambra <claudio.cambra@gmail.com>
parent 75f7213a
No related branches found
Tags 1.9.6
1 merge request!2262macosx: Improve album supplementary view layout, add play/enqueue buttons
Pipeline #245373 passed with stage
in 19 minutes and 6 seconds
......@@ -6,48 +6,93 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="VLCLibraryCollectionViewAlbumItem"/>
<customObject id="-2" userLabel="File's Owner" customClass="VLCLibraryCollectionViewAlbumSupplementaryDetailView"/>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<view id="HAc-or-XD8" customClass="VLCLibraryCollectionViewAlbumSupplementaryDetailView">
<rect key="frame" x="0.0" y="0.0" width="1061" height="332"/>
<view misplaced="YES" id="HAc-or-XD8" customClass="VLCLibraryCollectionViewAlbumSupplementaryDetailView">
<rect key="frame" x="0.0" y="0.0" width="1071" height="304"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<box boxType="custom" borderType="none" cornerRadius="4" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="TDx-ys-0hc">
<rect key="frame" x="0.0" y="0.0" width="1061" height="312"/>
<rect key="frame" x="0.0" y="0.0" width="1071" height="292"/>
<view key="contentView" id="l4M-qd-E0u">
<rect key="frame" x="0.0" y="0.0" width="1061" height="312"/>
<rect key="frame" x="0.0" y="0.0" width="1071" height="292"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
<color key="borderColor" name="controlColor" catalog="System" colorSpace="catalog"/>
<color key="fillColor" name="separatorColor" catalog="System" colorSpace="catalog"/>
</box>
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FWp-yd-2Pm">
<rect key="frame" x="0.0" y="0.0" width="1061" height="302"/>
<rect key="frame" x="0.0" y="0.0" width="1071" height="282"/>
<subviews>
<stackView distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="TOx-1e-6D9">
<rect key="frame" x="0.0" y="10" width="351" height="292"/>
<stackView distribution="equalCentering" orientation="vertical" alignment="leading" spacing="10" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="TOx-1e-6D9">
<rect key="frame" x="0.0" y="10" width="252" height="272"/>
<subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="xZd-Hk-h2M">
<rect key="frame" x="10" y="0.0" width="331" height="292"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="no-art" id="6X6-Og-u8A"/>
<imageView translatesAutoresizingMaskIntoConstraints="NO" id="xZd-Hk-h2M" customClass="VLCImageView">
<rect key="frame" x="10" y="40" width="232" height="232"/>
<constraints>
<constraint firstAttribute="width" secondItem="xZd-Hk-h2M" secondAttribute="height" multiplier="1:1" id="TIK-Ez-QbE"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="axesIndependently" image="no-art" id="6X6-Og-u8A"/>
</imageView>
<stackView distribution="fillEqually" orientation="horizontal" alignment="top" spacing="10" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" horizontalHuggingPriority="1000" verticalHuggingPriority="1000" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6Nc-Mb-wDa">
<rect key="frame" x="10" y="0.0" width="232" height="30"/>
<subviews>
<button verticalHuggingPriority="750" imageHugsTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ntd-VT-2KS">
<rect key="frame" x="-6" y="-4" width="123" height="40"/>
<buttonCell key="cell" type="push" title=" Play" bezelStyle="rounded" image="play.fill" catalog="system" imagePosition="left" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Rgc-Uk-A3h">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<color key="bezelColor" red="0.96497207880000002" green="0.38123786450000002" blue="0.048660390079999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="contentTintColor" red="0.96497207880000002" green="0.38123786450000002" blue="0.048660390079999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<connections>
<action selector="playAction:" target="HAc-or-XD8" id="edJ-21-Ej1"/>
</connections>
</button>
<button verticalHuggingPriority="750" imageHugsTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="idL-3a-QaA">
<rect key="frame" x="115" y="-4" width="123" height="40"/>
<buttonCell key="cell" type="push" title=" Enqueue" bezelStyle="rounded" image="plus" catalog="system" imagePosition="left" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="igY-iu-P0N">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="enqueueAction:" target="HAc-or-XD8" id="jkL-Pm-24a"/>
</connections>
</button>
</subviews>
<visibilityPriorities>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
</subviews>
<constraints>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="xZd-Hk-h2M" secondAttribute="trailing" constant="10" id="GHL-NF-uZf"/>
<constraint firstItem="xZd-Hk-h2M" firstAttribute="top" secondItem="TOx-1e-6D9" secondAttribute="top" id="fYG-48-y9a"/>
<constraint firstItem="xZd-Hk-h2M" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="TOx-1e-6D9" secondAttribute="leading" constant="10" id="gvA-cd-m3X"/>
<constraint firstItem="xZd-Hk-h2M" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="TOx-1e-6D9" secondAttribute="leading" constant="10" id="5LU-fv-D53"/>
<constraint firstAttribute="bottom" secondItem="6Nc-Mb-wDa" secondAttribute="bottom" id="9VU-I8-ob5"/>
<constraint firstAttribute="trailing" secondItem="6Nc-Mb-wDa" secondAttribute="trailing" constant="10" id="DmE-xP-Wvn"/>
<constraint firstItem="xZd-Hk-h2M" firstAttribute="height" secondItem="TOx-1e-6D9" secondAttribute="height" constant="-40" id="F6y-Zh-lrJ"/>
<constraint firstItem="6Nc-Mb-wDa" firstAttribute="top" secondItem="xZd-Hk-h2M" secondAttribute="bottom" constant="10" id="MbQ-q1-COw"/>
<constraint firstItem="6Nc-Mb-wDa" firstAttribute="leading" secondItem="TOx-1e-6D9" secondAttribute="leading" constant="10" id="Tce-Dm-Jve"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="xZd-Hk-h2M" secondAttribute="trailing" constant="10" id="a95-AT-EG5"/>
<constraint firstItem="xZd-Hk-h2M" firstAttribute="top" secondItem="TOx-1e-6D9" secondAttribute="top" id="b2u-ln-Wf4"/>
<constraint firstItem="xZd-Hk-h2M" firstAttribute="centerX" secondItem="TOx-1e-6D9" secondAttribute="centerX" id="zLM-Ut-V4H"/>
</constraints>
<visibilityPriorities>
<integer value="1000"/>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="bw7-QB-Ssc">
<rect key="frame" x="359" y="20" width="702" height="282"/>
<rect key="frame" x="260" y="0.0" width="811" height="282"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nCe-dY-YMM">
<rect key="frame" x="-2" y="230" width="124" height="52"/>
......@@ -80,7 +125,7 @@
<tableViewGridLines key="gridStyleMask" horizontal="YES"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn editable="NO" width="641" minWidth="10" maxWidth="1000" id="tVn-dP-rPg">
<tableColumn editable="NO" width="669" minWidth="10" maxWidth="1000" id="tVn-dP-rPg">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
......@@ -93,7 +138,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES"/>
<prototypeCellViews>
<tableCellView id="vmz-MH-Uum">
<rect key="frame" x="11" y="1" width="650" height="24"/>
<rect key="frame" x="11" y="1" width="678" height="24"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</tableCellView>
</prototypeCellViews>
......@@ -126,8 +171,12 @@
</stackView>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="TOx-1e-6D9" secondAttribute="bottom" constant="10" id="sVI-op-597"/>
<constraint firstItem="TOx-1e-6D9" firstAttribute="width" secondItem="bw7-QB-Ssc" secondAttribute="width" multiplier="0.5" id="wgl-yE-5rb"/>
<constraint firstItem="TOx-1e-6D9" firstAttribute="top" secondItem="FWp-yd-2Pm" secondAttribute="top" id="7hM-jR-3N3"/>
<constraint firstAttribute="bottom" secondItem="TOx-1e-6D9" secondAttribute="bottom" constant="10" id="bdR-rj-nKk"/>
<constraint firstAttribute="bottom" secondItem="bw7-QB-Ssc" secondAttribute="bottom" id="elF-5e-5LQ"/>
<constraint firstAttribute="trailing" secondItem="bw7-QB-Ssc" secondAttribute="trailing" id="uvg-NE-l4m"/>
<constraint firstItem="TOx-1e-6D9" firstAttribute="leading" secondItem="FWp-yd-2Pm" secondAttribute="leading" id="vAN-Ww-VKA"/>
<constraint firstItem="bw7-QB-Ssc" firstAttribute="top" secondItem="FWp-yd-2Pm" secondAttribute="top" id="xYi-0p-Tii"/>
</constraints>
<visibilityPriorities>
<integer value="1000"/>
......@@ -155,10 +204,12 @@
<outlet property="albumTitleTextField" destination="nCe-dY-YMM" id="h3l-p0-w3e"/>
<outlet property="albumTracksTableView" destination="eEJ-WA-0aM" id="l8k-M9-a8e"/>
</connections>
<point key="canvasLocation" x="-237.5" y="-257"/>
<point key="canvasLocation" x="-237.5" y="-284"/>
</view>
</objects>
<resources>
<image name="no-art" width="128" height="128"/>
<image name="play.fill" catalog="system" width="12" height="13"/>
<image name="plus" catalog="system" width="15" height="13"/>
</resources>
</document>
......@@ -24,6 +24,7 @@
NS_ASSUME_NONNULL_BEGIN
@class VLCMediaLibraryAlbum;
@class VLCImageView;
extern NSString *const VLCLibraryCollectionViewAlbumSupplementaryDetailViewIdentifier;
extern NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewAlbumSupplementaryDetailViewKind;
......@@ -33,9 +34,12 @@ extern NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewAl
@property (readwrite, retain, nonatomic) VLCMediaLibraryAlbum *representedAlbum;
@property (readwrite, weak) IBOutlet NSTextField *albumTitleTextField;
@property (readwrite, weak) IBOutlet NSTextField *albumDetailsTextField;
@property (readwrite, weak) IBOutlet NSImageView *albumArtworkImageView;
@property (readwrite, weak) IBOutlet VLCImageView *albumArtworkImageView;
@property (readwrite, weak) IBOutlet NSTableView *albumTracksTableView;
- (IBAction)playAction:(id)sender;
- (IBAction)enqueueAction:(id)sender;
@end
NS_ASSUME_NONNULL_END
\ No newline at end of file
......@@ -42,7 +42,9 @@ NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewAlbumSupp
@interface VLCLibraryCollectionViewAlbumSupplementaryDetailView ()
{
VLCLibraryAlbumTracksDataSource *_tracksDataSource;
VLCLibraryController *_libraryController;
}
@end
@implementation VLCLibraryCollectionViewAlbumSupplementaryDetailView
......@@ -81,4 +83,33 @@ NSCollectionViewSupplementaryElementKind const VLCLibraryCollectionViewAlbumSupp
[_albumTracksTableView reloadData];
}
- (IBAction)playAction:(id)sender
{
if (!_libraryController) {
_libraryController = [[VLCMain sharedInstance] libraryController];
}
// We want to add all the tracks to the playlist but only play the first one immediately,
// otherwise we will skip straight to the last track of the last album from the artist
__block BOOL playImmediately = YES;
[_representedAlbum iterateMediaItemsWithBlock:^(VLCMediaLibraryMediaItem* mediaItem) {
[_libraryController appendItemToPlaylist:mediaItem playImmediately:playImmediately];
if(playImmediately) {
playImmediately = NO;
}
}];
}
- (IBAction)enqueueAction:(id)sender
{
if (!_libraryController) {
_libraryController = [[VLCMain sharedInstance] libraryController];
}
[_representedAlbum iterateMediaItemsWithBlock:^(VLCMediaLibraryMediaItem* mediaItem) {
[_libraryController appendItemToPlaylist:mediaItem playImmediately:NO];
}];
}
@end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment