2008-02-22 13:27:24 +00:00
|
|
|
//
|
|
|
|
// StatusImageTransformer.m
|
|
|
|
// Cog
|
|
|
|
//
|
|
|
|
// Created by Vincent Spader on 2/21/08.
|
|
|
|
// Copyright 2008 __MyCompanyName__. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "StatusImageTransformer.h"
|
|
|
|
#import "PlaylistEntry.h"
|
|
|
|
|
|
|
|
|
|
|
|
@implementation StatusImageTransformer
|
|
|
|
|
2008-02-23 13:57:33 +00:00
|
|
|
@synthesize playImage;
|
|
|
|
@synthesize queueImage;
|
|
|
|
@synthesize errorImage;
|
2008-03-01 03:29:21 +00:00
|
|
|
@synthesize stopAfterImage;
|
2008-02-23 13:57:33 +00:00
|
|
|
|
2008-02-22 13:27:24 +00:00
|
|
|
+ (Class)transformedValueClass { return [NSImage class]; }
|
|
|
|
+ (BOOL)allowsReverseTransformation { return NO; }
|
|
|
|
|
2008-02-23 13:57:33 +00:00
|
|
|
- (id)init
|
|
|
|
{
|
|
|
|
self = [super init];
|
|
|
|
if (self)
|
|
|
|
{
|
|
|
|
self.playImage = [NSImage imageNamed:@"play"];
|
|
|
|
self.queueImage = [NSImage imageNamed:@"NSAddTemplate"];
|
|
|
|
self.errorImage = [NSImage imageNamed:@"NSStopProgressTemplate"];
|
2008-03-01 03:29:21 +00:00
|
|
|
self.stopAfterImage = [NSImage imageNamed:@"stop_current"];
|
2008-02-23 13:57:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2008-02-22 13:27:24 +00:00
|
|
|
// Convert from string to RepeatMode
|
|
|
|
- (id)transformedValue:(id)value {
|
|
|
|
if (value == nil) return nil;
|
|
|
|
|
2008-03-01 03:29:21 +00:00
|
|
|
if ([value isEqualToString:@"playing"])
|
|
|
|
{
|
2008-02-23 13:57:33 +00:00
|
|
|
return self.playImage;
|
2008-02-22 13:27:24 +00:00
|
|
|
}
|
2008-03-01 03:29:21 +00:00
|
|
|
else if ([value isEqualToString:@"queued"])
|
|
|
|
{
|
2008-02-23 13:57:33 +00:00
|
|
|
return self.queueImage;
|
2008-02-22 13:27:24 +00:00
|
|
|
}
|
2008-03-01 03:29:21 +00:00
|
|
|
else if ([value isEqualToString:@"error"]) {
|
2008-02-23 13:57:33 +00:00
|
|
|
return self.errorImage;
|
2008-02-22 13:27:24 +00:00
|
|
|
}
|
2008-03-01 03:29:21 +00:00
|
|
|
else if ([value isEqualToString:@"stopAfter"]) {
|
|
|
|
return self.stopAfterImage;
|
2008-02-25 15:39:04 +00:00
|
|
|
}
|
2008-02-22 13:27:24 +00:00
|
|
|
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@end
|