summaryrefslogtreecommitdiffstats
path: root/macosx/HBJob+UIAdditions.m
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-12-28 08:14:32 +0000
committerritsuka <[email protected]>2014-12-28 08:14:32 +0000
commita03845e869297931544d4d8ba5a15678411df155 (patch)
tree020a76f4d45e2375f5fd61d5f083f51cb0176552 /macosx/HBJob+UIAdditions.m
parent3acda4f9eb6a6c23f0a9c627aba354433656f70d (diff)
MacGui: move more things out of HBController.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6664 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBJob+UIAdditions.m')
-rw-r--r--macosx/HBJob+UIAdditions.m72
1 files changed, 72 insertions, 0 deletions
diff --git a/macosx/HBJob+UIAdditions.m b/macosx/HBJob+UIAdditions.m
index 6e5bf030a..509668e17 100644
--- a/macosx/HBJob+UIAdditions.m
+++ b/macosx/HBJob+UIAdditions.m
@@ -31,8 +31,80 @@
return angles;
}
+- (NSArray *)containers
+{
+ NSMutableArray *containers = [NSMutableArray array];
+
+ for (const hb_container_t *container = hb_container_get_next(NULL);
+ container != NULL;
+ container = hb_container_get_next(container))
+ {
+ NSString *title = nil;
+ if (container->format & HB_MUX_MASK_MP4)
+ {
+ title = NSLocalizedString(@"MP4 File", @"");
+ }
+ else if (container->format & HB_MUX_MASK_MKV)
+ {
+ title = NSLocalizedString(@"MKV File", @"");
+ }
+ else
+ {
+ title = [NSString stringWithUTF8String:container->name];
+ }
+ [containers addObject:title];
+ }
+
+ return [[containers copy] autorelease];
+}
+
+@end
+
+@implementation HBContainerTransformer
+
++ (Class)transformedValueClass
+{
+ return [NSString class];
+}
+
+- (id)transformedValue:(id)value
+{
+ int container = [value intValue];
+ if (container & HB_MUX_MASK_MP4)
+ {
+ return NSLocalizedString(@"MP4 File", @"");
+ }
+ else if (container & HB_MUX_MASK_MKV)
+ {
+ return NSLocalizedString(@"MKV File", @"");
+ }
+ else
+ {
+ const char *name = hb_container_get_name(container);
+ if (name)
+ {
+ return @(name);
+ }
+ else
+ {
+ return nil;
+ }
+ }
+}
+
++ (BOOL)allowsReverseTransformation
+{
+ return YES;
+}
+
+- (id)reverseTransformedValue:(id)value
+{
+ return @(hb_container_get_from_name([value UTF8String]));
+}
+
@end
+
@implementation HBURLTransformer
+ (Class)transformedValueClass