-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finally proper output format handling added (& cleanup)
- Loading branch information
1 parent
2a3aa08
commit 8c43b79
Showing
11 changed files
with
164 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// AppUtil.h | ||
// WhatSub | ||
// | ||
// Created by Marcin Grabda on 5/4/11. | ||
// Copyright 2011 burningtomato.com. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
|
||
@interface AppPreferences : NSObject { | ||
@private | ||
} | ||
|
||
+ (NSArray*)typeExtensionsForName:(NSString*)typeName; | ||
+ (NSString*)getNPUsername; | ||
+ (NSString*)getNPPassword; | ||
+ (NSString*)getNPLanguageCode; | ||
+ (NSString*)getOutputFormat; | ||
+ (NSStringEncoding)getOutputEncoding; | ||
+ (BOOL)isSRTOnlyConversionAllowed; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// | ||
// AppUtil.m | ||
// WhatSub | ||
// | ||
// Created by Marcin Grabda on 5/4/11. | ||
// Copyright 2011 burningtomato.com. All rights reserved. | ||
// | ||
|
||
#import "AppPreferences.h" | ||
|
||
|
||
@implementation AppPreferences | ||
|
||
- (id)init | ||
{ | ||
self = [super init]; | ||
if (self) { | ||
} | ||
return self; | ||
} | ||
|
||
- (void)dealloc | ||
{ | ||
[super dealloc]; | ||
} | ||
|
||
+ (NSArray*)typeExtensionsForName:(NSString*)typeName | ||
{ | ||
int i; | ||
NSArray *typeList = [[[NSBundle mainBundle] infoDictionary] | ||
objectForKey:@"CFBundleDocumentTypes"]; | ||
for (i=0; i<[typeList count]; i++) { | ||
if ([[[typeList objectAtIndex:i] objectForKey:@"CFBundleTypeName"] | ||
isEqualToString:typeName]) | ||
return [[typeList objectAtIndex:i] objectForKey:@"CFBundleTypeExtensions"]; | ||
} | ||
return nil; | ||
} | ||
|
||
+ (NSString*)getNPUsername | ||
{ | ||
return [[NSUserDefaults standardUserDefaults] valueForKey:@"NPUsername"]; | ||
} | ||
|
||
+ (NSString*)getNPPassword | ||
{ | ||
return [[NSUserDefaults standardUserDefaults] valueForKey:@"NPPassword"]; | ||
} | ||
|
||
+ (NSString*)getNPLanguageCode | ||
{ | ||
NSString* language = [[NSUserDefaults standardUserDefaults] valueForKey:@"NPLanguage"]; | ||
NSDictionary* languages = [NSDictionary dictionaryWithObjectsAndKeys: | ||
@"PL", @"Polish", | ||
@"EN", @"English", nil]; | ||
return [languages objectForKey:language]; | ||
} | ||
|
||
+ (NSString*)getOutputFormat | ||
{ | ||
return [[NSUserDefaults standardUserDefaults] valueForKey:@"OutputFormat"]; | ||
} | ||
|
||
+ (NSStringEncoding)getOutputEncoding | ||
{ | ||
NSString* encoding = [[NSUserDefaults standardUserDefaults] valueForKey:@"OutputEncoding"]; | ||
NSDictionary* encodings = [NSDictionary dictionaryWithObjectsAndKeys: | ||
[NSNumber numberWithUnsignedInteger:NSUTF8StringEncoding], @"UTF-8", | ||
[NSNumber numberWithUnsignedInteger:NSUTF16StringEncoding], @"UTF-16", | ||
[NSNumber numberWithUnsignedInteger:NSISOLatin1StringEncoding], @"ISO-8859-1", | ||
[NSNumber numberWithUnsignedInteger:NSWindowsCP1252StringEncoding], @"CP1252", | ||
[NSNumber numberWithUnsignedInteger:NSISOLatin2StringEncoding], @"ISO-8859-2", | ||
[NSNumber numberWithUnsignedInteger:NSWindowsCP1250StringEncoding], @"CP1250", | ||
nil]; | ||
NSNumber* encodingNumber = [encodings objectForKey:encoding]; | ||
return [encodingNumber unsignedIntegerValue]; | ||
} | ||
|
||
+ (BOOL)isSRTOnlyConversionAllowed | ||
{ | ||
NSNumber* wrappedBool = [[NSUserDefaults standardUserDefaults] valueForKey:@"AllowSRTOnlyConversion"]; | ||
return [wrappedBool boolValue]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters