Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 6a03de0f87
Fetching contributors…

Cannot retrieve contributors at this time

59 lines (46 sloc) 1.385 kB
//
// VivaTrackExtensions.m
// Viva
//
// Created by Daniel Kennett on 4/13/11.
// For license information, see LICENSE.markdown
//
#import "VivaTrackExtensions.h"
#import "LocalFilesController.h"
@implementation SPTrack (VivaTrackExtensions)
+(NSSet *)keyPathsForValuesAffectingCondensedArtist {
return [NSSet setWithObject:@"artists"];
}
-(NSString *)condensedArtist {
if ([[self artists] count] > 0) {
return [[[self artists] valueForKey:@"name"] componentsJoinedByString:@", "];
}
return nil;
}
+(NSSet *)keyPathsForValuesAffectingCondensedArtistForUIDisplay {
return [NSSet setWithObject:@"artists"];
}
-(NSString *)condensedArtistForUIDisplay {
if ([[self artists] count] > 1) {
return [[[self artists] valueForKey:@"name"] componentsJoinedByString:@", "];
}
return nil;
}
+(NSSet *)keyPathsForValuesAffectingIsEnabledInUI {
return [NSSet setWithObjects:@"availability", @"local", nil];
}
-(BOOL)isEnabledInUI {
return (self.availability == SP_TRACK_AVAILABILITY_AVAILABLE ||
self.isLocal);
}
+(NSSet *)keyPathsForValuesAffectingUiTextColor {
return [NSSet setWithObject:@"isEnabledInUI"];
}
-(NSColor *)uiTextColor {
return self.isEnabledInUI ? [NSColor blackColor] : [NSColor disabledControlTextColor];
}
-(LocalFile *)localFile {
if (!self.isLocal) return nil;
return [[LocalFilesController sharedInstance] localFileForTrack:self];
}
@end
Jump to Line
Something went wrong with that request. Please try again.