summaryrefslogtreecommitdiffstats
path: root/macosx/HBController.m
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2016-12-14 15:15:36 +0100
committerDamiano Galassi <[email protected]>2016-12-14 15:15:36 +0100
commit14c2e61e3a4efe5ec508061b2e6bc702699662cb (patch)
treeefdda1b40038f25b637008b0c10e6be0c205f603 /macosx/HBController.m
parentf5a7f690c83fa18f3ca4d4f4f196f10db76c3480 (diff)
MacGui: use the languages from the audio preferences for built-in presets, this had been broken when the MacGui started to use hb_preset_job_init().
Diffstat (limited to 'macosx/HBController.m')
-rw-r--r--macosx/HBController.m48
1 files changed, 46 insertions, 2 deletions
diff --git a/macosx/HBController.m b/macosx/HBController.m
index a223ef54f..8b55d6343 100644
--- a/macosx/HBController.m
+++ b/macosx/HBController.m
@@ -135,7 +135,14 @@
fQueueController.controller = self;
presetManager = manager;
- _currentPreset = manager.defaultPreset;
+ if (manager.defaultPreset.isBuiltIn)
+ {
+ _currentPreset = [self presetByAddingDefaultLanguages:manager.defaultPreset];
+ }
+ else
+ {
+ _currentPreset = manager.defaultPreset;
+ }
_scanSpecificTitleIdx = 1;
}
@@ -1252,6 +1259,43 @@
_currentPreset = currentPreset;
}
+
+ if (!(self.undoManager.isUndoing || self.undoManager.isRedoing))
+ {
+ // If the preset is one of the built in, set some additional options
+ if (_currentPreset.isBuiltIn)
+ {
+ _currentPreset = [self presetByAddingDefaultLanguages:_currentPreset];
+ }
+ }
+}
+
+- (HBPreset *)presetByAddingDefaultLanguages:(HBPreset *)preset
+{
+ HBMutablePreset *mutablePreset = [preset mutableCopy];
+ NSMutableArray<NSString *> *languages = [NSMutableArray array];
+
+ if ([[NSUserDefaults standardUserDefaults] stringForKey:@"AlternateLanguage"])
+ {
+ NSString *lang = [HBUtilities isoCodeForNativeLang:[[NSUserDefaults standardUserDefaults] stringForKey:@"AlternateLanguage"]];
+ if (lang)
+ {
+ [languages insertObject:lang atIndex:0];
+ }
+ }
+
+ if ([[NSUserDefaults standardUserDefaults] stringForKey:@"DefaultLanguage"])
+ {
+ NSString *lang = [HBUtilities isoCodeForNativeLang:[[NSUserDefaults standardUserDefaults] stringForKey:@"DefaultLanguage"]];
+ if (lang)
+ {
+ [languages insertObject:lang atIndex:0];
+ }
+ }
+
+ mutablePreset[@"AudioLanguageList"] = languages;
+
+ return mutablePreset;
}
- (void)setEdited:(BOOL)edited
@@ -1279,7 +1323,7 @@
[self removeJobObservers];
// Apply the preset to the current job
- [self.job applyPreset:preset];
+ [self.job applyPreset:self.currentPreset];
// If Auto Naming is on, update the destination
[self updateFileName];