Commit 314ce3a8 authored by Felix Paul Kühne's avatar Felix Paul Kühne

Library: show file size in editing mode only. else, display video dimensions if available

parent 39d87e20
......@@ -34,6 +34,8 @@
{
[super setEditing:editing animated:animated];
self.removeMediaButton.hidden = !editing;
[self _updatedDisplayedInformation];
}
- (void)prepareForReuse
......@@ -77,7 +79,13 @@
- (void)_updatedDisplayedInformation
{
self.titleLabel.text = self.mediaObject.title;
self.subtitleLabel.text = [NSString stringWithFormat:@"%@ — %i MB", [VLCTime timeWithNumber:[self.mediaObject duration]], (int)([self.mediaObject fileSizeInBytes] / 1e6)];
if (self.isEditing)
self.subtitleLabel.text = [NSString stringWithFormat:@"%@ — %i MB", [VLCTime timeWithNumber:[self.mediaObject duration]], (int)([self.mediaObject fileSizeInBytes] / 1e6)];
else {
self.subtitleLabel.text = [NSString stringWithFormat:@"%@", [VLCTime timeWithNumber:[self.mediaObject duration]]];
if (self.mediaObject.videoTrack)
self.subtitleLabel.text = [self.subtitleLabel.text stringByAppendingFormat:@" — %@x%@", [[self.mediaObject videoTrack] valueForKey:@"width"], [[self.mediaObject videoTrack] valueForKey:@"height"]];
}
self.thumbnailView.image = self.mediaObject.computedThumbnail;
self.progressView.progress = self.mediaObject.lastPosition.floatValue;
......
......@@ -54,10 +54,22 @@
[self _updatedDisplayedInformation];
}
- (void)setEditing:(BOOL)editing animated:(BOOL)animated
{
[super setEditing:editing animated:animated];
[self _updatedDisplayedInformation];
}
- (void)_updatedDisplayedInformation
{
self.titleLabel.text = self.mediaObject.title;
self.subtitleLabel.text = [NSString stringWithFormat:@"%@ — %i MB", [VLCTime timeWithNumber:[self.mediaObject duration]], (int)([self.mediaObject fileSizeInBytes] / 1e6)];
if (self.isEditing)
self.subtitleLabel.text = [NSString stringWithFormat:@"%@ — %i MB", [VLCTime timeWithNumber:[self.mediaObject duration]], (int)([self.mediaObject fileSizeInBytes] / 1e6)];
else {
self.subtitleLabel.text = [NSString stringWithFormat:@"%@", [VLCTime timeWithNumber:[self.mediaObject duration]]];
if (self.mediaObject.videoTrack)
self.subtitleLabel.text = [self.subtitleLabel.text stringByAppendingFormat:@" — %@x%@", [[self.mediaObject videoTrack] valueForKey:@"width"], [[self.mediaObject videoTrack] valueForKey:@"height"]];
}
self.thumbnailView.image = self.mediaObject.computedThumbnail;
self.progressIndicator.progress = self.mediaObject.lastPosition.floatValue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment