//
//  HBPreferencesTransFormer.m
//  HandBrake
//
//  Created by 松島 浩道 on 09/01/29.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "HBPreferencesTransFormer.h"


@implementation HBPreferencesTransFormer

+ (Class)transformedValueClass
{
    return [NSString class];
}

+ (BOOL)allowsReverseTransformation
{
    return YES;
}

- (id)transformedValue:(id)value
{
	return NSLocalizedStringFromTable(value, @"Controller", @"");
}

- (id)reverseTransformedValue:(id)value
{
	NSArray* strings = [[NSArray alloc] initWithObjects:@"Alert Window",
						@"Alert Window And Growl",
						@"Put Computer To Sleep",
						@"Shut Down Computer",
						@"Growl Notification",
						@"Do Nothing", nil ];
	[strings autorelease];
	int index;
	for( index = 0; index < [strings count]; index++ )
	{
		NSString* str = NSLocalizedStringFromTable([strings objectAtIndex:index], @"Controller", @"");
		if( [str isEqualToString:value] )
		{
			return [strings objectAtIndex:index];
		}
	}
	return value;
}

@end
