diff options
author | ritsuka <[email protected]> | 2014-12-27 10:46:04 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-12-27 10:46:04 +0000 |
commit | df8b2ff3e109699e3dadd88404911f8dfc7b210a (patch) | |
tree | 8489fee4edaf57adf55f69d0c0d28f61a5757057 /macosx/HBFilters.m | |
parent | 8df584534c0c39f5c2f298d8ba480cc906743bbf (diff) |
MacGui: change the queue to work with serialized HBJob objects, remove the NSDictionary job representation and the duplicate prepareJob method. Implement NSCopying protocol in HBJob.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6655 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBFilters.m')
-rw-r--r-- | macosx/HBFilters.m | 151 |
1 files changed, 33 insertions, 118 deletions
diff --git a/macosx/HBFilters.m b/macosx/HBFilters.m index b09ab7d27..86ec87180 100644 --- a/macosx/HBFilters.m +++ b/macosx/HBFilters.m @@ -199,6 +199,37 @@ NSDictionary *_HandBrake_nlmeansTunesDict; [self postChangedNotification]; } +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(NSZone *)zone +{ + HBFilters *copy = [[[self class] alloc] init]; + + if (copy) + { + copy->_detelecine = _detelecine; + copy->_detelecineCustomString = [_detelecineCustomString copy]; + + copy->_deinterlace = _deinterlace; + copy->_deinterlaceCustomString = [_deinterlaceCustomString copy]; + + copy->_decomb = _decomb; + copy->_decombCustomString = [_decombCustomString copy]; + + copy->_denoise = [_denoise copy]; + copy->_denoisePreset = [_denoisePreset copy]; + copy->_denoiseTune = [_denoiseTune copy]; + copy->_denoiseCustomString = [_denoiseCustomString copy]; + + copy->_deblock = _deblock; + copy->_grayscale = _grayscale; + + copy->_useDecomb = _useDecomb; + } + + return copy; +} + #pragma mark - NSCoding - (void)encodeWithCoder:(NSCoder *)coder @@ -255,7 +286,7 @@ NSDictionary *_HandBrake_nlmeansTunesDict; #pragma mark - Presets and queue -- (void)prepareFiltersForPreset:(NSMutableDictionary *)preset +- (void)writeToPreset:(NSMutableDictionary *)preset { preset[@"PictureDecombDeinterlace"] = @(self.useDecomb); @@ -277,7 +308,7 @@ NSDictionary *_HandBrake_nlmeansTunesDict; preset[@"VideoGrayScale"] = @(self.grayscale); } -- (void)applySettingsFromPreset:(NSDictionary *)preset +- (void)applyPreset:(NSDictionary *)preset { self.notificationsEnabled = NO; @@ -394,120 +425,4 @@ NSDictionary *_HandBrake_nlmeansTunesDict; self.notificationsEnabled = YES; } -- (NSString *)summary -{ - NSMutableString *summary = [NSMutableString string]; - - /* Detelecine */ - switch (self.detelecine) - { - case 1: - [summary appendFormat:@" - Detelecine (%@)", self.detelecineCustomString]; - break; - - case 2: - [summary appendString:@" - Detelecine (Default)"]; - break; - - default: - break; - } - - if (self.useDecomb) - { - /* Decomb */ - switch (self.decomb) - { - case 1: - [summary appendFormat:@" - Decomb (%@)", self.decombCustomString]; - break; - - case 2: - [summary appendString:@" - Decomb (Default)"]; - break; - - case 3: - [summary appendString:@" - Decomb (Fast)"]; - break; - - case 4: - [summary appendString:@" - Decomb (Bob)"]; - break; - - default: - break; - } - } - else - { - /* Deinterlace */ - switch (self.deinterlace) - { - case 1: - [summary appendFormat:@" - Deinterlace (%@)", self.deinterlaceCustomString]; - break; - - case 2: - [summary appendString:@" - Deinterlace (Fast)"]; - break; - - case 3: - [summary appendString:@" - Deinterlace (Slow)"]; - break; - - case 4: - [summary appendString:@" - Deinterlace (Slower)"]; - break; - - case 5: - [summary appendString:@" - Deinterlace (Bob)"]; - break; - - default: - break; - } - } - - /* Deblock */ - if (self.deblock > 0) - { - [summary appendFormat:@" - Deblock (%ld)", self.deblock]; - } - - /* Denoise */ - if (![self.denoise isEqualToString:@"off"]) - { - [summary appendFormat:@" - Denoise (%@", [[_HandBrake_denoiseTypesDict allKeysForObject:self.denoise] firstObject]]; - if (![self.denoisePreset isEqualToString:@"none"]) - { - [summary appendFormat:@", %@", [[_HandBrake_denoisePresetsDict allKeysForObject:self.denoisePreset] firstObject]]; - - if ([self.denoise isEqualToString:@"nlmeans"]) - { - [summary appendFormat:@", %@", [[_HandBrake_nlmeansTunesDict allKeysForObject:self.denoiseTune] firstObject]]; - } - } - else - { - [summary appendFormat:@", %@", self.denoiseCustomString]; - } - - [summary appendString:@")"]; - - } - - /* Grayscale */ - if (self.grayscale) - { - [summary appendString:@" - Grayscale"]; - } - - if ([summary hasPrefix:@" - "]) - { - [summary deleteCharactersInRange:NSMakeRange(0, 3)]; - } - - return [NSString stringWithString:summary]; -} - @end |