Commit 7319b0b4 authored by Felix Paul Kühne's avatar Felix Paul Kühne

playlist: add codec information

On iPad, right swipe on cell, on phone/pod, long touch to display
parent 5787e92c
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="5053" systemVersion="12F45" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none">
<dependencies> <dependencies>
<deployment version="1792" defaultVersion="1552" identifier="iOS"/> <deployment version="1792" identifier="iOS"/>
<development version="5000" identifier="xcode"/> <development version="5000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
</dependencies> </dependencies>
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
...@@ -56,6 +56,13 @@ ...@@ -56,6 +56,13 @@
<color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<size key="shadowOffset" width="0.0" height="0.0"/> <size key="shadowOffset" width="0.0" height="0.0"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Meta Data" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="lP6-D2-Oef">
<rect key="frame" x="10" y="8" width="321" height="125"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" cocoaTouchSystemColor="lightTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews> </subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view> </view>
...@@ -64,6 +71,7 @@ ...@@ -64,6 +71,7 @@
<outlet property="folderIconView" destination="0uT-W6-UMC" id="coZ-4M-nCp"/> <outlet property="folderIconView" destination="0uT-W6-UMC" id="coZ-4M-nCp"/>
<outlet property="isSelectedView" destination="pl6-iw-2ZI" id="1sX-gh-yiU"/> <outlet property="isSelectedView" destination="pl6-iw-2ZI" id="1sX-gh-yiU"/>
<outlet property="mediaIsUnreadView" destination="ftR-Og-FOs" id="5aH-vE-E37"/> <outlet property="mediaIsUnreadView" destination="ftR-Og-FOs" id="5aH-vE-E37"/>
<outlet property="metaDataLabel" destination="lP6-D2-Oef" id="OBz-fP-Wk1"/>
<outlet property="subtitleLabel" destination="jdp-lJ-hIF" id="YUa-G7-CMl"/> <outlet property="subtitleLabel" destination="jdp-lJ-hIF" id="YUa-G7-CMl"/>
<outlet property="thumbnailView" destination="31" id="46"/> <outlet property="thumbnailView" destination="31" id="46"/>
<outlet property="titleLabel" destination="4XD-oC-pqG" id="Te1-JA-An0"/> <outlet property="titleLabel" destination="4XD-oC-pqG" id="Te1-JA-An0"/>
...@@ -75,4 +83,9 @@ ...@@ -75,4 +83,9 @@
<image name="folderIcon.png" width="221" height="205"/> <image name="folderIcon.png" width="221" height="205"/>
<image name="gradient-cell-ios7-ipad.png" width="2" height="190"/> <image name="gradient-cell-ios7-ipad.png" width="2" height="190"/>
</resources> </resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination"/>
</simulatedMetricsContainer>
</document> </document>
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5053" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies> <dependencies>
<deployment version="1792" defaultVersion="1552" identifier="iOS"/> <deployment version="1792" identifier="iOS"/>
<development version="5000" identifier="xcode"/> <development version="5000" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
</dependencies> </dependencies>
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
...@@ -16,20 +16,20 @@ ...@@ -16,20 +16,20 @@
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" id="4"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" id="4">
<rect key="frame" x="0.0" y="0.0" width="320" height="90"/> <rect key="frame" x="0.0" y="0.0" width="320" height="91"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/> <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
</imageView> </imageView>
<imageView hidden="YES" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="top" image="folderIcon.png" id="5iA-hI-rrr"> <imageView hidden="YES" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="top" image="folderIcon.png" id="5iA-hI-rrr">
<rect key="frame" x="0.0" y="35" width="320" height="55"/> <rect key="frame" x="0.0" y="35" width="320" height="56"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</imageView> </imageView>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="gradient-cell-ios7.png" id="22"> <imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="gradient-cell-ios7.png" id="22">
<rect key="frame" x="0.0" y="0.0" width="320" height="90"/> <rect key="frame" x="0.0" y="0.0" width="320" height="91"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</imageView> </imageView>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Title" lineBreakMode="wordWrap" baselineAdjustment="none" minimumScaleFactor="0.5" adjustsLetterSpacingToFitWidth="YES" id="6"> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Title" lineBreakMode="wordWrap" baselineAdjustment="none" minimumScaleFactor="0.5" adjustsLetterSpacingToFitWidth="YES" id="6">
<rect key="frame" x="7" y="46" width="305" height="21"/> <rect key="frame" x="7" y="47" width="305" height="21"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" name="HelveticaNeue-Light" family="Helvetica Neue" pointSize="15"/> <fontDescription key="fontDescription" name="HelveticaNeue-Light" family="Helvetica Neue" pointSize="15"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<size key="shadowOffset" width="0.0" height="0.0"/> <size key="shadowOffset" width="0.0" height="0.0"/>
</label> </label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="New" textAlignment="right" lineBreakMode="wordWrap" baselineAdjustment="none" minimumScaleFactor="0.5" adjustsLetterSpacingToFitWidth="YES" id="sYw-l2-Tmv"> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="New" textAlignment="right" lineBreakMode="wordWrap" baselineAdjustment="none" minimumScaleFactor="0.5" adjustsLetterSpacingToFitWidth="YES" id="sYw-l2-Tmv">
<rect key="frame" x="222" y="61" width="93" height="26"/> <rect key="frame" x="222" y="62" width="93" height="26"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/> <fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
...@@ -45,19 +45,27 @@ ...@@ -45,19 +45,27 @@
<size key="shadowOffset" width="0.0" height="0.0"/> <size key="shadowOffset" width="0.0" height="0.0"/>
</label> </label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Subtitle — Subtitle" lineBreakMode="wordWrap" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="7"> <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Subtitle — Subtitle" lineBreakMode="wordWrap" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" id="7">
<rect key="frame" x="7" y="66" width="252" height="15"/> <rect key="frame" x="7" y="67" width="252" height="15"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/> <fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <color key="highlightedColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<size key="shadowOffset" width="0.0" height="0.0"/> <size key="shadowOffset" width="0.0" height="0.0"/>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Meta Data" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="3xi-uj-aAV">
<rect key="frame" x="7" y="8" width="305" height="41.5"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" cocoaTouchSystemColor="lightTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews> </subviews>
</tableViewCellContentView> </tableViewCellContentView>
<color key="backgroundColor" white="0.12" alpha="1" colorSpace="calibratedWhite"/> <color key="backgroundColor" white="0.12" alpha="1" colorSpace="calibratedWhite"/>
<connections> <connections>
<outlet property="folderIconView" destination="5iA-hI-rrr" id="K2w-2u-dEl"/> <outlet property="folderIconView" destination="5iA-hI-rrr" id="K2w-2u-dEl"/>
<outlet property="mediaIsUnreadView" destination="sYw-l2-Tmv" id="us6-sJ-NVp"/> <outlet property="mediaIsUnreadView" destination="sYw-l2-Tmv" id="us6-sJ-NVp"/>
<outlet property="metaDataLabel" destination="3xi-uj-aAV" id="BXL-7W-XC9"/>
<outlet property="subtitleLabel" destination="7" id="8"/> <outlet property="subtitleLabel" destination="7" id="8"/>
<outlet property="thumbnailView" destination="4" id="9"/> <outlet property="thumbnailView" destination="4" id="9"/>
<outlet property="titleLabel" destination="6" id="10"/> <outlet property="titleLabel" destination="6" id="10"/>
...@@ -68,4 +76,9 @@ ...@@ -68,4 +76,9 @@
<image name="folderIcon.png" width="120" height="112"/> <image name="folderIcon.png" width="120" height="112"/>
<image name="gradient-cell-ios7.png" width="2" height="92"/> <image name="gradient-cell-ios7.png" width="2" height="92"/>
</resources> </resources>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document> </document>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* VLCPlaylistCollectionViewCell.h * VLCPlaylistCollectionViewCell.h
* VLC for iOS * VLC for iOS
***************************************************************************** *****************************************************************************
* Copyright (c) 2013 VideoLAN. All rights reserved. * Copyright (c) 2013-2015 VideoLAN. All rights reserved.
* $Id$ * $Id$
* *
* Authors: Felix Paul Kühne <fkuehne # videolan.org> * Authors: Felix Paul Kühne <fkuehne # videolan.org>
...@@ -24,13 +24,16 @@ ...@@ -24,13 +24,16 @@
@property (nonatomic, strong) IBOutlet UIView *mediaIsUnreadView; @property (nonatomic, strong) IBOutlet UIView *mediaIsUnreadView;
@property (nonatomic, strong) IBOutlet UIImageView *isSelectedView; @property (nonatomic, strong) IBOutlet UIImageView *isSelectedView;
@property (nonatomic, strong) IBOutlet UIImageView *folderIconView; @property (nonatomic, strong) IBOutlet UIImageView *folderIconView;
@property (nonatomic, strong) IBOutlet UILabel *metaDataLabel;
@property (nonatomic, retain) MLFile *mediaObject; @property (nonatomic, retain) MLFile *mediaObject;
@property (nonatomic, weak) UICollectionView *collectionView; @property (nonatomic, weak) UICollectionView *collectionView;
@property (readonly) BOOL showsMetaData;
- (void)setEditing:(BOOL)editing animated:(BOOL)animated; - (void)setEditing:(BOOL)editing animated:(BOOL)animated;
- (void)selectionUpdate; - (void)selectionUpdate;
- (void)shake:(BOOL)shake; - (void)shake:(BOOL)shake;
- (void)showMetadata:(BOOL)showMeta;
@end @end
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* VLCPlaylistCollectionViewCell.m * VLCPlaylistCollectionViewCell.m
* VLC for iOS * VLC for iOS
***************************************************************************** *****************************************************************************
* Copyright (c) 2013 VideoLAN. All rights reserved. * Copyright (c) 2013-2015 VideoLAN. All rights reserved.
* $Id$ * $Id$
* *
* Authors: Felix Paul Kühne <fkuehne # videolan.org> * Authors: Felix Paul Kühne <fkuehne # videolan.org>
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
_checkboxEmptyImage = [UIImage imageNamed:@"checkbox-legacy-empty"]; _checkboxEmptyImage = [UIImage imageNamed:@"checkbox-legacy-empty"];
_checkboxImage = [UIImage imageNamed:@"checkbox-legacy"]; _checkboxImage = [UIImage imageNamed:@"checkbox-legacy"];
} }
self.metaDataLabel.hidden = YES;
} }
- (void)setEditing:(BOOL)editing animated:(BOOL)animated - (void)setEditing:(BOOL)editing animated:(BOOL)animated
...@@ -345,4 +346,153 @@ ...@@ -345,4 +346,153 @@
} }
} }
- (void)showMetadata:(BOOL)showMeta
{
if (showMeta) {
NSMutableString *mediaInfo = [[NSMutableString alloc] init];
MLFile *theFile;
if ([self.mediaObject isKindOfClass:[MLFile class]])
theFile = self.mediaObject;
else if ([self.mediaObject isKindOfClass:[MLShowEpisode class]])
theFile = [[(MLShowEpisode *)self.mediaObject files]anyObject];
else if ([self.mediaObject isKindOfClass:[MLAlbumTrack class]])
theFile = [[(MLAlbumTrack *)self.mediaObject files]anyObject];
if (!theFile) {
self.metaDataLabel.hidden = YES;
return;
}
NSMutableArray *videoTracks = [[NSMutableArray alloc] init];
NSMutableArray *audioTracks = [[NSMutableArray alloc] init];
NSMutableArray *spuTracks = [[NSMutableArray alloc] init];
NSArray *tracks = [[theFile tracks] allObjects];
NSUInteger trackCount = tracks.count;
for (NSUInteger x = 0; x < trackCount; x++) {
NSManagedObject *track = tracks[x];
NSString *trackEntityName = [[track entity] name];
if ([trackEntityName isEqualToString:@"VideoTrackInformation"])
[videoTracks addObject:track];
else if ([trackEntityName isEqualToString:@"AudioTrackInformation"])
[audioTracks addObject:track];
else if ([trackEntityName isEqualToString:@"SubtitlesTrackInformation"])
[spuTracks addObject:track];
}
/* print video info */
trackCount = videoTracks.count;
if (trackCount != 1)
[mediaInfo appendFormat:@"%lu video tracks", (unsigned long)trackCount];
else
[mediaInfo appendString:@"1 video track"];
if (trackCount > 0) {
[mediaInfo appendString:@" ("];
for (NSUInteger x = 0; x < trackCount; x++) {
int fourcc = [[videoTracks[x] valueForKey:@"codec"] intValue];
if (x != 0)
[mediaInfo appendFormat:@", %4.4s", (char *)&fourcc];
else
[mediaInfo appendFormat:@"%4.4s", (char *)&fourcc];
}
[mediaInfo appendString:@")"];
}
[mediaInfo appendString:@"\n\n"];
/* print audio info */
trackCount = audioTracks.count;
if (trackCount != 1)
[mediaInfo appendFormat:@"%lu audio tracks", (unsigned long)trackCount];
else
[mediaInfo appendString:@"1 audio track"];
if (trackCount > 0) {
[mediaInfo appendString:@":\n"];
for (NSUInteger x = 0; x < trackCount; x++) {
NSManagedObject *track = audioTracks[x];
int fourcc = [[track valueForKey:@"codec"] intValue];
if (x != 0)
[mediaInfo appendFormat:@", %4.4s", (char *)&fourcc];
else
[mediaInfo appendFormat:@"%4.4s", (char *)&fourcc];
int channelNumber = [[track valueForKey:@"channelsNumber"] intValue];
NSString *language = [track valueForKey:@"language"];
int bitrate = [[track valueForKey:@"bitrate"] intValue];
if (channelNumber != 0 || language != nil || bitrate > 0) {
[mediaInfo appendString:@" ["];
if (bitrate > 0)
[mediaInfo appendFormat:@"%i kbit/s", bitrate / 1024];
if (channelNumber > 0) {
if (bitrate > 0)
[mediaInfo appendString:@", "];
if (channelNumber == 1)
[mediaInfo appendString:@"MONO"];
else if (channelNumber == 2)
[mediaInfo appendString:@"STEREO"];
else
[mediaInfo appendString:@"MULTI-CHANNEL"];
}
if (language != nil) {
if (channelNumber > 0 || bitrate > 0)
[mediaInfo appendString:@", "];
[mediaInfo appendString:[language uppercaseString]];
}
[mediaInfo appendString:@"]"];
}
}
}
[mediaInfo appendString:@"\n\n"];
/* SPU */
trackCount = spuTracks.count;
if (trackCount != 1)
[mediaInfo appendFormat:@"%lu subtitles tracks", (unsigned long)trackCount];
else
[mediaInfo appendString:@"1 subtitles track"];
if (trackCount > 0) {
[mediaInfo appendString:@" ("];
for (NSUInteger x = 0; x < trackCount; x++) {
NSString *language = [spuTracks[x] valueForKey:@"language"];
if (language) {
if (x != 0)
[mediaInfo appendFormat:@", %@", [language uppercaseString]];
else
[mediaInfo appendString:[language uppercaseString]];
}
}
[mediaInfo appendString:@")"];
}
self.metaDataLabel.text = mediaInfo;
videoTracks = audioTracks = spuTracks = nil;
}
void (^animationBlock)() = ^() {
self.metaDataLabel.hidden = !showMeta;
};
void (^completionBlock)(BOOL finished) = ^(BOOL finished) {
self.metaDataLabel.hidden = !showMeta;
};
NSTimeInterval animationDuration = .2;
[UIView animateWithDuration:animationDuration animations:animationBlock completion:completionBlock];
}
- (BOOL)showsMetaData
{
return !self.metaDataLabel.hidden;
}
@end @end
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* VLCPlaylistTableViewCell.h * VLCPlaylistTableViewCell.h
* VLC for iOS * VLC for iOS
***************************************************************************** *****************************************************************************
* Copyright (c) 2013 VideoLAN. All rights reserved. * Copyright (c) 2013-2015 VideoLAN. All rights reserved.
* $Id$ * $Id$
* *
* Authors: Felix Paul Kühne <fkuehne # videolan.org> * Authors: Felix Paul Kühne <fkuehne # videolan.org>
...@@ -18,14 +18,19 @@ ...@@ -18,14 +18,19 @@
@property (nonatomic, strong) IBOutlet UILabel *titleLabel; @property (nonatomic, strong) IBOutlet UILabel *titleLabel;
@property (nonatomic, strong) IBOutlet UILabel *subtitleLabel; @property (nonatomic, strong) IBOutlet UILabel *subtitleLabel;
@property (nonatomic, strong) IBOutlet UILabel *metaDataLabel;
@property (nonatomic, strong) IBOutlet UIImageView *thumbnailView; @property (nonatomic, strong) IBOutlet UIImageView *thumbnailView;
@property (nonatomic, strong) IBOutlet VLCLinearProgressIndicator *progressIndicator; @property (nonatomic, strong) IBOutlet VLCLinearProgressIndicator *progressIndicator;
@property (nonatomic, strong) IBOutlet UIView *mediaIsUnreadView; @property (nonatomic, strong) IBOutlet UIView *mediaIsUnreadView;
@property (nonatomic, strong) IBOutlet UIImageView *folderIconView; @property (nonatomic, strong) IBOutlet UIImageView *folderIconView;
@property (readonly) BOOL isExpanded;
@property (nonatomic, strong) NSManagedObject *mediaObject; @property (nonatomic, strong) NSManagedObject *mediaObject;
+ (VLCPlaylistTableViewCell *)cellWithReuseIdentifier:(NSString *)ident; + (VLCPlaylistTableViewCell *)cellWithReuseIdentifier:(NSString *)ident;
+ (CGFloat)heightOfCell; + (CGFloat)heightOfCell;
- (void)collapsWithAnimation:(BOOL)animate;
@end @end
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* VLCPlaylistTableViewCell.m * VLCPlaylistTableViewCell.m
* VLC for iOS * VLC for iOS
***************************************************************************** *****************************************************************************
* Copyright (c) 2013 VideoLAN. All rights reserved. * Copyright (c) 2013-2015 VideoLAN. All rights reserved.
* $Id$ * $Id$
* *
* Authors: Felix Paul Kühne <fkuehne # videolan.org> * Authors: Felix Paul Kühne <fkuehne # videolan.org>
...@@ -42,10 +42,17 @@ ...@@ -42,10 +42,17 @@
NSAssert([[nibContentArray lastObject] isKindOfClass:[VLCPlaylistTableViewCell class]], @"meh meh"); NSAssert([[nibContentArray lastObject] isKindOfClass:[VLCPlaylistTableViewCell class]], @"meh meh");
VLCPlaylistTableViewCell *cell = (VLCPlaylistTableViewCell *)[nibContentArray lastObject]; VLCPlaylistTableViewCell *cell = (VLCPlaylistTableViewCell *)[nibContentArray lastObject];
cell.multipleSelectionBackgroundView = [[UIView alloc] initWithFrame:cell.frame]; cell.multipleSelectionBackgroundView = [[UIView alloc] initWithFrame:cell.frame];
cell.metaDataLabel.hidden = YES;
return cell; return cell;
} }
- (void)setNeedsDisplay
{
[self collapsWithAnimation:NO];
[super setNeedsDisplay];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{ {
[self _updatedDisplayedInformationForKeyPath:keyPath]; [self _updatedDisplayedInformationForKeyPath:keyPath];
...@@ -125,6 +132,7 @@ ...@@ -125,6 +132,7 @@
[self _addObserver]; [self _addObserver];
} }
[self collapsWithAnimation:NO];
[self _updatedDisplayedInformationForKeyPath:nil]; [self _updatedDisplayedInformationForKeyPath:nil];
} }
...@@ -330,18 +338,174 @@ ...@@ -330,18 +338,174 @@
- (void)longTouchGestureAction:(UIGestureRecognizer *)recognizer - (void)longTouchGestureAction:(UIGestureRecognizer *)recognizer
{ {
_isExpanded = YES;
CGRect frame = self.frame; CGRect frame = self.frame;
if (frame.size.height > 90.) frame.size.height = 180.;
BOOL metaHidden = NO;
MLFile *theFile;
if ([self.mediaObject isKindOfClass:[MLFile class]])
theFile = (MLFile *)self.mediaObject;
else if ([self.mediaObject isKindOfClass:[MLShowEpisode class]])
theFile = [[(MLShowEpisode *)self.mediaObject files]anyObject];
else if ([self.mediaObject isKindOfClass:[MLAlbumTrack class]])
theFile = [[(MLAlbumTrack *)self.mediaObject files]anyObject];
NSMutableString *mediaInfo = [[NSMutableString alloc] init];
if (theFile) {
NSMutableArray *videoTracks = [[NSMutableArray alloc] init];
NSMutableArray *audioTracks = [[NSMutableArray alloc] init];
NSMutableArray *spuTracks = [[NSMutableArray alloc] init];
NSArray *tracks = [[theFile tracks] allObjects];
NSUInteger trackCount = tracks.count;
for (NSUInteger x = 0; x < trackCount; x++) {
NSManagedObject *track = tracks[x];
NSString *trackEntityName = [[track entity] name];
if ([trackEntityName isEqualToString:@"VideoTrackInformation"])
[videoTracks addObject:track];
else if ([trackEntityName isEqualToString:@"AudioTrackInformation"])
[audioTracks addObject:track];
else if ([trackEntityName isEqualToString:@"SubtitlesTrackInformation"])
[spuTracks addObject:track];
}
/* print video info */
trackCount = videoTracks.count;
if (trackCount != 1)
[mediaInfo appendFormat:@"%lu video tracks", (unsigned long)trackCount];
else
[mediaInfo appendString:@"1 video track"];
if (trackCount > 0) {
[mediaInfo appendString:@" ("];
for (NSUInteger x = 0; x < trackCount; x++) {
int fourcc = [[videoTracks[x] valueForKey:@"codec"] intValue];
if (x != 0)
[mediaInfo appendFormat:@", %4.4s", (char *)&fourcc];
else
[mediaInfo appendFormat:@"%4.4s", (char *)&fourcc];
}
[mediaInfo appendString:@")"];
}
[mediaInfo appendString:@"\n\n"];
/* print audio info */
trackCount = audioTracks.count;
if (trackCount != 1)
[mediaInfo appendFormat:@"%lu audio tracks", (unsigned long)trackCount];
else
[mediaInfo appendString:@"1 audio track"];
if (trackCount > 0) {
[mediaInfo appendString:@":\n"];
for (NSUInteger x = 0; x < trackCount; x++) {
NSManagedObject *track = audioTracks[x];
int fourcc = [[track valueForKey:@"codec"] intValue];
if (x != 0)
[mediaInfo appendFormat:@", %4.4s", (char *)&fourcc];
else
[mediaInfo appendFormat:@"%4.4s", (char *)&fourcc];
int channelNumber = [[track valueForKey:@"channelsNumber"] intValue];
NSString *language = [track valueForKey:@"language"];
int bitrate = [[track valueForKey:@"bitrate"] intValue];
if (channelNumber != 0 || language != nil || bitrate > 0) {
[mediaInfo appendString:@" ["];