[vlc-commits] macosx: improve audio library metadata display
Felix Paul Kühne
git at videolan.org
Tue Aug 20 11:55:08 CEST 2019
vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Tue Aug 20 10:48:44 2019 +0200| [b7850912600679471bb781f8bb81679c552cefd2] | committer: Felix Paul Kühne
macosx: improve audio library metadata display
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b7850912600679471bb781f8bb81679c552cefd2
---
.../gui/macosx/UI/VLCLibraryAlbumTableCellView.xib | 2 +-
.../macosx/library/VLCLibraryAlbumTableCellView.m | 11 ++++++++-
.../gui/macosx/library/VLCLibraryAudioDataSource.m | 26 +++++++++++++++++++---
3 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/modules/gui/macosx/UI/VLCLibraryAlbumTableCellView.xib b/modules/gui/macosx/UI/VLCLibraryAlbumTableCellView.xib
index 73baaede84..06d9f93ff3 100644
--- a/modules/gui/macosx/UI/VLCLibraryAlbumTableCellView.xib
+++ b/modules/gui/macosx/UI/VLCLibraryAlbumTableCellView.xib
@@ -45,7 +45,7 @@
<rect key="frame" x="146" y="345" width="62" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Summary" id="sx3-rr-j2L">
<font key="font" usesAppearanceFont="YES"/>
- <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+ <color key="textColor" name="tertiaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
diff --git a/modules/gui/macosx/library/VLCLibraryAlbumTableCellView.m b/modules/gui/macosx/library/VLCLibraryAlbumTableCellView.m
index 0ec4e14228..dc86a37bdf 100644
--- a/modules/gui/macosx/library/VLCLibraryAlbumTableCellView.m
+++ b/modules/gui/macosx/library/VLCLibraryAlbumTableCellView.m
@@ -126,7 +126,16 @@ const CGFloat LayoutSpacer;
if (_representedAlbum.year > 0) {
self.yearTextField.intValue = _representedAlbum.year;
}
- self.summaryTextField.stringValue = _representedAlbum.summary;
+
+ if (_representedAlbum.summary.length > 0) {
+ self.summaryTextField.stringValue = _representedAlbum.summary;
+ } else {
+ if (_representedAlbum.numberOfTracks > 1) {
+ self.summaryTextField.stringValue = [NSString stringWithFormat:_NS("%i tracks"), _representedAlbum.numberOfTracks];
+ } else {
+ self.summaryTextField.stringValue = _NS("1 track");
+ }
+ }
NSImage *image;
if (_representedAlbum.artworkMRL.length > 0) {
diff --git a/modules/gui/macosx/library/VLCLibraryAudioDataSource.m b/modules/gui/macosx/library/VLCLibraryAudioDataSource.m
index 1626610a94..8071e77826 100644
--- a/modules/gui/macosx/library/VLCLibraryAudioDataSource.m
+++ b/modules/gui/macosx/library/VLCLibraryAudioDataSource.m
@@ -329,7 +329,19 @@ static NSString *VLCAudioLibraryCellIdentifier = @"VLCAudioLibraryCellIdentifier
{
VLCMediaLibraryArtist *artist = _displayedCollection[indexPath.item];
viewItem.mediaTitleTextField.stringValue = artist.name;
- viewItem.durationTextField.stringValue = [NSString stringWithFormat:_NS("%u albums, %u songs"), artist.numberOfAlbums, artist.numberOfTracks];
+ NSString *countMetadataString;
+ if (artist.numberOfAlbums > 1) {
+ countMetadataString = [NSString stringWithFormat:_NS("%u albums"), artist.numberOfAlbums];
+ } else {
+ countMetadataString = _NS("1 album");
+ }
+ if (artist.numberOfTracks > 1) {
+ countMetadataString = [countMetadataString stringByAppendingFormat:@", %@", [NSString stringWithFormat:_NS("%u songs"), artist.numberOfTracks]];
+ } else {
+ countMetadataString = [countMetadataString stringByAppendingFormat:@", %@", _NS("1 song")];
+ }
+ viewItem.durationTextField.stringValue = countMetadataString;
+
NSImage *image;
if (artist.artworkMRL.length > 0) {
image = [[NSImage alloc] initWithContentsOfURL:[NSURL URLWithString:artist.artworkMRL]];
@@ -344,7 +356,11 @@ static NSString *VLCAudioLibraryCellIdentifier = @"VLCAudioLibraryCellIdentifier
{
VLCMediaLibraryAlbum *album = _displayedCollection[indexPath.item];
viewItem.mediaTitleTextField.stringValue = album.title;
- viewItem.durationTextField.stringValue = [NSString stringWithFormat:_NS("%u songs"), album.numberOfTracks];
+ if (album.numberOfTracks > 1) {
+ viewItem.durationTextField.stringValue = [NSString stringWithFormat:_NS("%u songs"), album.numberOfTracks];
+ } else {
+ viewItem.durationTextField.stringValue = _NS("1 song");
+ }
NSImage *image;
if (album.artworkMRL.length > 0) {
image = [[NSImage alloc] initWithContentsOfURL:[NSURL URLWithString:album.artworkMRL]];
@@ -365,7 +381,11 @@ static NSString *VLCAudioLibraryCellIdentifier = @"VLCAudioLibraryCellIdentifier
{
VLCMediaLibraryGenre *genre = _displayedCollection[indexPath.item];
viewItem.mediaTitleTextField.stringValue = genre.name;
- viewItem.durationTextField.stringValue = [NSString stringWithFormat:_NS("%u items"), genre.numberOfTracks];
+ if (genre.numberOfTracks > 1) {
+ viewItem.durationTextField.stringValue = [NSString stringWithFormat:_NS("%u songs"), genre.numberOfTracks];
+ } else {
+ viewItem.durationTextField.stringValue = _NS("1 song");
+ }
viewItem.mediaImageView.image = [NSImage imageNamed: @"noart.png"];
}
More information about the vlc-commits
mailing list