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
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
+ (Class)transformedValueClass {
|
|
|
|
return [NSImage class];
|
|
|
|
}
|
|
|
|
+ (BOOL)allowsReverseTransformation {
|
|
|
|
return NO;
|
|
|
|
}
|
2008-02-22 13:27:24 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (id)init {
|
2008-02-23 13:57:33 +00:00
|
|
|
self = [super init];
|
2022-02-07 05:49:27 +00:00
|
|
|
if(self) {
|
2022-02-10 09:51:40 +00:00
|
|
|
if(@available(macOS 11.0, *)) {
|
|
|
|
self.playImage = [NSImage imageWithSystemSymbolName:@"play.fill" accessibilityDescription:NSLocalizedString(@"PlayingTrackTooltip", "")];
|
|
|
|
self.queueImage = [NSImage imageWithSystemSymbolName:@"plus" accessibilityDescription:NSLocalizedString(@"QueuedTrackTooltip", "")];
|
|
|
|
self.errorImage = [NSImage imageWithSystemSymbolName:@"nosign" accessibilityDescription:NSLocalizedString(@"ErrorTrackTooltip", "")];
|
|
|
|
self.stopAfterImage = [NSImage imageWithSystemSymbolName:@"stop.fill" accessibilityDescription:NSLocalizedString(@"StopAfterTrackTooltip", "")];
|
|
|
|
} else {
|
|
|
|
self.playImage = [NSImage imageNamed:@"playTemplate"];
|
|
|
|
self.queueImage = [NSImage imageNamed:@"NSAddTemplate"];
|
|
|
|
self.errorImage = [NSImage imageNamed:@"NSStopProgressTemplate"];
|
|
|
|
self.stopAfterImage = [NSImage imageNamed:@"stopTemplate"];
|
|
|
|
}
|
2008-02-23 13:57:33 +00:00
|
|
|
}
|
2022-02-07 05:49:27 +00:00
|
|
|
|
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 {
|
2022-02-07 05:49:27 +00:00
|
|
|
if(value == nil) return nil;
|
2008-02-22 13:27:24 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
if([value isEqualToString:@"playing"]) {
|
2008-02-23 13:57:33 +00:00
|
|
|
return self.playImage;
|
2022-02-07 05:49:27 +00:00
|
|
|
} else if([value isEqualToString:@"queued"]) {
|
2008-02-23 13:57:33 +00:00
|
|
|
return self.queueImage;
|
2022-02-07 05:49:27 +00:00
|
|
|
} else if([value isEqualToString:@"error"]) {
|
2008-02-23 13:57:33 +00:00
|
|
|
return self.errorImage;
|
2022-02-07 05:49:27 +00:00
|
|
|
} else if([value isEqualToString:@"stopAfter"]) {
|
2008-03-01 03:29:21 +00:00
|
|
|
return self.stopAfterImage;
|
2008-02-25 15:39:04 +00:00
|
|
|
}
|
2008-02-22 13:27:24 +00:00
|
|
|
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|