diff options
author | Damiano Galassi <[email protected]> | 2019-07-29 07:34:38 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2019-07-29 07:34:38 +0200 |
commit | 8e2843720a9e6a87670da4e3caccfd570f66389f (patch) | |
tree | 9ed0392c6aef95b2f600d948564b030da2293d95 /macosx/HBAutoNamer.m | |
parent | 9446eba9eac07b6b47dc6d6e9f3c2a7331b38aa0 (diff) |
MacGui: refactor the preferences keys and autonaming methods; fix the queue when running multiple HandBrake instances; fixed a number of bugs.
Diffstat (limited to 'macosx/HBAutoNamer.m')
-rw-r--r-- | macosx/HBAutoNamer.m | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/macosx/HBAutoNamer.m b/macosx/HBAutoNamer.m index 642706f7b..3b75de729 100644 --- a/macosx/HBAutoNamer.m +++ b/macosx/HBAutoNamer.m @@ -6,10 +6,9 @@ #import "HBAutoNamer.h" -#import <AppKit/AppKit.h> - #import "HBJob.h" -#import "HBUtilities.h" +#import "HBJob+HBAdditions.h" +#import "HBPreferencesKeys.h" static void *HBAutoNamerPrefsContext = &HBAutoNamerPrefsContext; static void *HBAutoNamerContext = &HBAutoNamerContext; @@ -29,7 +28,7 @@ static void *HBAutoNamerContext = &HBAutoNamerContext; if (self) { _job = job; - _format = [[NSUserDefaults standardUserDefaults] objectForKey:@"HBAutoNamingFormat"]; + _format = [NSUserDefaults.standardUserDefaults objectForKey:HBAutoNamingFormat]; [self addFormatObservers]; [self addJobObservers]; [self addPrefsObservers]; @@ -55,7 +54,7 @@ static void *HBAutoNamerContext = &HBAutoNamerContext; else if (context == HBAutoNamerPrefsContext) { [self removeJobObservers]; - self.format = [[NSUserDefaults standardUserDefaults] objectForKey:@"HBAutoNamingFormat"]; + self.format = [NSUserDefaults.standardUserDefaults objectForKey:HBAutoNamingFormat]; [self addJobObservers]; [self updateFileName]; [self updateFileExtension]; @@ -107,7 +106,7 @@ static void *HBAutoNamerContext = &HBAutoNamerContext; if (self.job && !(undo.isUndoing || undo.isRedoing)) { - NSString *extension = [HBUtilities automaticExtForJob:self.job]; + NSString *extension = self.job.automaticExt; if (![extension isEqualTo:self.job.outputFileName.pathExtension]) { self.job.outputFileName = [[self.job.outputFileName stringByDeletingPathExtension] stringByAppendingPathExtension:extension]; @@ -162,10 +161,10 @@ static void *HBAutoNamerContext = &HBAutoNamerContext; { NSUndoManager *undo = self.job.undo; - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DefaultAutoNaming"] && self.job && !(undo.isUndoing || undo.isRedoing)) + if ([NSUserDefaults.standardUserDefaults boolForKey:HBDefaultAutoNaming] && self.job && !(undo.isUndoing || undo.isRedoing)) { // Generate a new file name - NSString *fileName = [HBUtilities automaticNameForJob:self.job]; + NSString *fileName = self.job.automaticName; // Swap the old one with the new one self.job.outputFileName = [NSString stringWithFormat:@"%@.%@", fileName, self.job.outputFileName.pathExtension]; |