diff options
author | ritsuka <[email protected]> | 2014-08-16 16:05:26 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-08-16 16:05:26 +0000 |
commit | 66590157361bb0b7e7cf2a4622feee77fd38fe1c (patch) | |
tree | 4507e5e08cd5ab17789071d1698f80eaf961e7a1 /macosx | |
parent | b6084716cf4dbfc50596fa8126eb0fa1c0101dfa (diff) |
MacGui: Fixed the languages selection in the built in presets for languages with a native name.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6300 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/English.lproj/Preferences.xib | 340 | ||||
-rw-r--r-- | macosx/HBAudioSettings.m | 30 | ||||
-rw-r--r-- | macosx/HBLanguagesSelection.h | 2 | ||||
-rw-r--r-- | macosx/HBLanguagesSelection.m | 22 |
4 files changed, 54 insertions, 340 deletions
diff --git a/macosx/English.lproj/Preferences.xib b/macosx/English.lproj/Preferences.xib index 87d687057..2e1dfef5e 100644 --- a/macosx/English.lproj/Preferences.xib +++ b/macosx/English.lproj/Preferences.xib @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F12" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F14" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> <deployment version="1060" identifier="macosx"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/> @@ -346,175 +346,10 @@ <font key="font" metaFont="smallSystem"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> - <objectValues> - <string>Afar</string> - <string>Abkhazian</string> - <string>Afrikaans</string> - <string>Albanian</string> - <string>Amharic</string> - <string>Arabic</string> - <string>Armenian</string> - <string>Assamese</string> - <string>Avestan</string> - <string>Aymara</string> - <string>Azerbaijani</string> - <string>Bashkir</string> - <string>Basque</string> - <string>Belarusian</string> - <string>Bengali</string> - <string>Bihari</string> - <string>Bislama</string> - <string>Bosnian</string> - <string>Breton</string> - <string>Bulgarian</string> - <string>Burmese</string> - <string>Catalan</string> - <string>Chamorro</string> - <string>Chechen</string> - <string>Chichewa; Nyanja</string> - <string>Chinese</string> - <string>Church Slavic</string> - <string>Chuvash</string> - <string>Cornish</string> - <string>Corsican</string> - <string>Croatian</string> - <string>Czech</string> - <string>Dansk</string> - <string>Deutsch</string> - <string>Dzongkha</string> - <string>English</string> - <string>Espanol</string> - <string>Esperanto</string> - <string>Estonian</string> - <string>Faroese</string> - <string>Fijian</string> - <string>Francais</string> - <string>Frisian</string> - <string>Georgian</string> - <string>Gaelic (Scots)</string> - <string>Gallegan</string> - <string>Greek, Modern ()</string> - <string>Guarani</string> - <string>Gujarati</string> - <string>Hebrew</string> - <string>Herero</string> - <string>Hindi</string> - <string>Hiri Motu</string> - <string>Inuktitut</string> - <string>Interlingue</string> - <string>Interlingua</string> - <string>Indonesian</string> - <string>Inupiaq</string> - <string>Irish</string> - <string>Islenska</string> - <string>Italiano</string> - <string>Javanese</string> - <string>Japanese</string> - <string>Kalaallisut (Greenlandic)</string> - <string>Kannada</string> - <string>Kashmiri</string> - <string>Kazakh</string> - <string>Khmer</string> - <string>Kikuyu</string> - <string>Kinyarwanda</string> - <string>Kirghiz</string> - <string>Komi</string> - <string>Korean</string> - <string>Kuanyama</string> - <string>Kurdish</string> - <string>Lao</string> - <string>Latin</string> - <string>Latvian</string> - <string>Lingala</string> - <string>Lithuanian</string> - <string>Letzeburgesch</string> - <string>Macedonian</string> - <string>Magyar</string> - <string>Malay</string> - <string>Malayalam</string> - <string>Malagasy</string> - <string>Maltese</string> - <string>Manx</string> - <string>Maori</string> - <string>Marathi</string> - <string>Marshall</string> - <string>Moldavian</string> - <string>Mongolian</string> - <string>Nauru</string> - <string>Navajo</string> - <string>Ndebele, South</string> - <string>Ndebele, North</string> - <string>Ndonga</string> - <string>Nederlands</string> - <string>Nepali</string> - <string>Northern Sami</string> - <string>Norwegian</string> - <string>Norwegian Bokmal</string> - <string>Norwegian Nynorsk</string> - <string>Occitan (post 1500); Provencal</string> - <string>Oriya</string> - <string>Oromo</string> - <string>Ossetian; Ossetic</string> - <string>Panjabi</string> - <string>Persian</string> - <string>Pali</string> - <string>Polish</string> - <string>Portuges</string> - <string>Pushto</string> - <string>Quechua</string> - <string>Raeto-Romance</string> - <string>Romanian</string> - <string>Rundi</string> - <string>Russian</string> - <string>Sango</string> - <string>Sanskrit</string> - <string>Sardinian</string> - <string>Serbian</string> - <string>Sinhalese</string> - <string>Slovak</string> - <string>Slovenian</string> - <string>Samoan</string> - <string>Shona</string> - <string>Sindhi</string> - <string>Somali</string> - <string>Sotho, Southern</string> - <string>Sundanese</string> - <string>Suomi</string> - <string>Svenska</string> - <string>Swahili</string> - <string>Swati</string> - <string>Tahitian</string> - <string>Tamil</string> - <string>Tatar</string> - <string>Telugu</string> - <string>Tajik</string> - <string>Tagalog</string> - <string>Thai</string> - <string>Tibetian</string> - <string>Tigrinya</string> - <string>Tonga (Tonga Islands)</string> - <string>Tswana</string> - <string>Tsonga</string> - <string>Turkish</string> - <string>Turkmen</string> - <string>Twi</string> - <string>Uighur</string> - <string>Ukrainian</string> - <string>Urdu</string> - <string>Uzbek</string> - <string>Vietnamese</string> - <string>Volapk</string> - <string>Welsh</string> - <string>Wolof</string> - <string>Xhosa</string> - <string>Yiddish</string> - <string>Yoruba</string> - <string>Zhuang</string> - <string>Zulu</string> - </objectValues> </comboBoxCell> <connections> - <binding destination="61" name="value" keyPath="values.DefaultLanguage" id="270"/> + <binding destination="-2" name="content" keyPath="self.languages.languagesArray" id="xPC-Fg-O3G"/> + <binding destination="61" name="value" keyPath="values.DefaultLanguage" previousBinding="xPC-Fg-O3G" id="I2t-Qy-TKa"/> </connections> </comboBox> <textField verticalHuggingPriority="750" id="252"> @@ -533,175 +368,10 @@ <font key="font" metaFont="smallSystem"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> - <objectValues> - <string>Afar</string> - <string>Abkhazian</string> - <string>Afrikaans</string> - <string>Albanian</string> - <string>Amharic</string> - <string>Arabic</string> - <string>Armenian</string> - <string>Assamese</string> - <string>Avestan</string> - <string>Aymara</string> - <string>Azerbaijani</string> - <string>Bashkir</string> - <string>Basque</string> - <string>Belarusian</string> - <string>Bengali</string> - <string>Bihari</string> - <string>Bislama</string> - <string>Bosnian</string> - <string>Breton</string> - <string>Bulgarian</string> - <string>Burmese</string> - <string>Catalan</string> - <string>Chamorro</string> - <string>Chechen</string> - <string>Chichewa; Nyanja</string> - <string>Chinese</string> - <string>Church Slavic</string> - <string>Chuvash</string> - <string>Cornish</string> - <string>Corsican</string> - <string>Croatian</string> - <string>Czech</string> - <string>Dansk</string> - <string>Deutsch</string> - <string>Dzongkha</string> - <string>English</string> - <string>Espanol</string> - <string>Esperanto</string> - <string>Estonian</string> - <string>Faroese</string> - <string>Fijian</string> - <string>Francais</string> - <string>Frisian</string> - <string>Georgian</string> - <string>Gaelic (Scots)</string> - <string>Gallegan</string> - <string>Greek, Modern ()</string> - <string>Guarani</string> - <string>Gujarati</string> - <string>Hebrew</string> - <string>Herero</string> - <string>Hindi</string> - <string>Hiri Motu</string> - <string>Inuktitut</string> - <string>Interlingue</string> - <string>Interlingua</string> - <string>Indonesian</string> - <string>Inupiaq</string> - <string>Irish</string> - <string>Islenska</string> - <string>Italiano</string> - <string>Javanese</string> - <string>Japanese</string> - <string>Kalaallisut (Greenlandic)</string> - <string>Kannada</string> - <string>Kashmiri</string> - <string>Kazakh</string> - <string>Khmer</string> - <string>Kikuyu</string> - <string>Kinyarwanda</string> - <string>Kirghiz</string> - <string>Komi</string> - <string>Korean</string> - <string>Kuanyama</string> - <string>Kurdish</string> - <string>Lao</string> - <string>Latin</string> - <string>Latvian</string> - <string>Lingala</string> - <string>Lithuanian</string> - <string>Letzeburgesch</string> - <string>Macedonian</string> - <string>Magyar</string> - <string>Malay</string> - <string>Malayalam</string> - <string>Malagasy</string> - <string>Maltese</string> - <string>Manx</string> - <string>Maori</string> - <string>Marathi</string> - <string>Marshall</string> - <string>Moldavian</string> - <string>Mongolian</string> - <string>Nauru</string> - <string>Navajo</string> - <string>Ndebele, South</string> - <string>Ndebele, North</string> - <string>Ndonga</string> - <string>Nederlands</string> - <string>Nepali</string> - <string>Northern Sami</string> - <string>Norwegian</string> - <string>Norwegian Bokmal</string> - <string>Norwegian Nynorsk</string> - <string>Occitan (post 1500); Provencal</string> - <string>Oriya</string> - <string>Oromo</string> - <string>Ossetian; Ossetic</string> - <string>Panjabi</string> - <string>Persian</string> - <string>Pali</string> - <string>Polish</string> - <string>Portuges</string> - <string>Pushto</string> - <string>Quechua</string> - <string>Raeto-Romance</string> - <string>Romanian</string> - <string>Rundi</string> - <string>Russian</string> - <string>Sango</string> - <string>Sanskrit</string> - <string>Sardinian</string> - <string>Serbian</string> - <string>Sinhalese</string> - <string>Slovak</string> - <string>Slovenian</string> - <string>Samoan</string> - <string>Shona</string> - <string>Sindhi</string> - <string>Somali</string> - <string>Sotho, Southern</string> - <string>Sundanese</string> - <string>Suomi</string> - <string>Svenska</string> - <string>Swahili</string> - <string>Swati</string> - <string>Tahitian</string> - <string>Tamil</string> - <string>Tatar</string> - <string>Telugu</string> - <string>Tajik</string> - <string>Tagalog</string> - <string>Thai</string> - <string>Tibetian</string> - <string>Tigrinya</string> - <string>Tonga (Tonga Islands)</string> - <string>Tswana</string> - <string>Tsonga</string> - <string>Turkish</string> - <string>Turkmen</string> - <string>Twi</string> - <string>Uighur</string> - <string>Ukrainian</string> - <string>Urdu</string> - <string>Uzbek</string> - <string>Vietnamese</string> - <string>Volapk</string> - <string>Welsh</string> - <string>Wolof</string> - <string>Xhosa</string> - <string>Yiddish</string> - <string>Yoruba</string> - <string>Zhuang</string> - <string>Zulu</string> - </objectValues> </comboBoxCell> <connections> - <binding destination="61" name="value" keyPath="values.AlternateLanguage" id="513"/> + <binding destination="-2" name="content" keyPath="self.languages.languagesArray" id="l02-3Q-yhI"/> + <binding destination="61" name="value" keyPath="values.AlternateLanguage" previousBinding="l02-3Q-yhI" id="M5z-5g-aQN"/> </connections> </comboBox> <textField verticalHuggingPriority="750" id="509"> diff --git a/macosx/HBAudioSettings.m b/macosx/HBAudioSettings.m index 4f0f1003d..e5e65ea62 100644 --- a/macosx/HBAudioSettings.m +++ b/macosx/HBAudioSettings.m @@ -55,6 +55,22 @@ return [fallbacks autorelease]; } +- (NSString *)isoCodeForNativeLang:(NSString *)language +{ + const iso639_lang_t *lang = lang_get_next(NULL); + for (lang = lang_get_next(lang); lang != NULL; lang = lang_get_next(lang)) + { + NSString *nativeLanguage = strlen(lang->native_name) ? @(lang->native_name) : @(lang->eng_name); + + if ([language isEqualToString:nativeLanguage]) + { + return @(lang->iso639_2); + } + } + + return nil; +} + - (void)applySettingsFromPreset:(NSDictionary *)preset { // Track selection behavior @@ -85,13 +101,19 @@ { if ([[NSUserDefaults standardUserDefaults] stringForKey:@"DefaultLanguage"]) { - iso639_lang_t *lang = lang_for_english([[[NSUserDefaults standardUserDefaults] stringForKey:@"DefaultLanguage"] UTF8String]); - [self.trackSelectionLanguages addObject:@(lang->iso639_2)]; + NSString *lang = [self isoCodeForNativeLang:[[NSUserDefaults standardUserDefaults] stringForKey:@"DefaultLanguage"]]; + if (lang) + { + [self.trackSelectionLanguages addObject:lang]; + } } if ([[NSUserDefaults standardUserDefaults] stringForKey:@"AlternateLanguage"]) { - iso639_lang_t *lang = lang_for_english([[[NSUserDefaults standardUserDefaults] stringForKey:@"AlternateLanguage"] UTF8String]); - [self.trackSelectionLanguages addObject:@(lang->iso639_2)]; + NSString *lang = [self isoCodeForNativeLang:[[NSUserDefaults standardUserDefaults] stringForKey:@"AlternateLanguage"]]; + if (lang) + { + [self.trackSelectionLanguages addObject:lang]; + } } } } diff --git a/macosx/HBLanguagesSelection.h b/macosx/HBLanguagesSelection.h index bd95a003b..c5d96052e 100644 --- a/macosx/HBLanguagesSelection.h +++ b/macosx/HBLanguagesSelection.h @@ -15,7 +15,7 @@ /** * HBLang */ -@interface HBLang : NSObject +@interface HBLang : NSObject <NSCopying> @property (nonatomic, readwrite) BOOL isSelected; @property (nonatomic, readonly) NSString *language; diff --git a/macosx/HBLanguagesSelection.m b/macosx/HBLanguagesSelection.m index 3bdb8ec61..bdc6ed7ae 100644 --- a/macosx/HBLanguagesSelection.m +++ b/macosx/HBLanguagesSelection.m @@ -20,6 +20,17 @@ return self; } +- (instancetype)copyWithZone:(NSZone *)zone +{ + HBLang *lang = [[self class] allocWithZone:zone]; + + lang->_isSelected = self.isSelected; + lang->_language = [self.language retain]; + lang->_iso639_2 = [self.iso639_2 retain]; + + return lang; +} + - (void)dealloc { [_language release]; @@ -28,10 +39,21 @@ [super dealloc]; } +- (NSString *)description +{ + return self.language; +} + @end @implementation HBLanguagesSelection +- (instancetype)init +{ + self = [self initWithLanguages:nil]; + return self; +} + - (instancetype)initWithLanguages:(NSArray *)languages { self = [super init]; |