diff options
author | ritsuka <[email protected]> | 2014-12-29 09:00:47 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-12-29 09:00:47 +0000 |
commit | 90449dc954d3486248a1a9fcb6889046bacd2f67 (patch) | |
tree | 959f77f4623c0e44c27c6911e3e06dcb2b293190 /macosx/HBVideo.m | |
parent | 1e93087497f97e0615fa3d05aea6b157b9b88480 (diff) |
MacGui: set the preset name to custom when a setting in the video/picture/filters tab is changed.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6671 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBVideo.m')
-rw-r--r-- | macosx/HBVideo.m | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/macosx/HBVideo.m b/macosx/HBVideo.m index 7f3fa7435..119b9f421 100644 --- a/macosx/HBVideo.m +++ b/macosx/HBVideo.m @@ -9,6 +9,8 @@ #import "NSCodingMacro.h" #include "hb.h" +NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification"; + @interface HBVideo () @property (nonatomic, readwrite) double qualityMinValue; @@ -16,6 +18,8 @@ @property (nonatomic, readwrite) NSUInteger mediumPresetIndex; +@property (nonatomic, readwrite, getter=areNotificationsEnabled) BOOL notificationsEnabled; + @end @implementation HBVideo @@ -31,10 +35,22 @@ _job = job; [self updateQualityBounds]; + + _notificationsEnabled = YES; } return self; } +- (void)postChangedNotification +{ + if (self.areNotificationsEnabled) + { + [[NSNotificationCenter defaultCenter] postNotification: [NSNotification notificationWithName:HBVideoChangedNotification + object:self + userInfo:nil]]; + } +} + #pragma mark - Setters /** @@ -70,6 +86,50 @@ [self updateQualityBounds]; [self validatePresetsSettings]; [self validateAdvancedOptions]; + + [self postChangedNotification]; +} + +- (void)setQualityType:(int)qualityType +{ + _qualityType = qualityType; + [self postChangedNotification]; +} + +- (void)setAvgBitrate:(int)avgBitrate +{ + _avgBitrate = avgBitrate; + [self postChangedNotification]; +} + +- (void)setQuality:(double)quality +{ + _quality = quality; + [self postChangedNotification]; +} + +- (void)setFrameRate:(int)frameRate +{ + _frameRate = frameRate; + [self postChangedNotification]; +} + +- (void)setFrameRateMode:(int)frameRateMode +{ + _frameRateMode = frameRateMode; + [self postChangedNotification]; +} + +- (void)setTwoPass:(BOOL)twoPass +{ + _twoPass = twoPass; + [self postChangedNotification]; +} + +- (void)setTurboTwoPass:(BOOL)turboTwoPass +{ + _turboTwoPass = turboTwoPass; + [self postChangedNotification]; } - (void)containerChanged @@ -95,6 +155,13 @@ } } +- (void)setPreset:(NSString *)preset +{ + [_preset autorelease]; + _preset = [preset copy]; + [self postChangedNotification]; +} + - (void)setTune:(NSString *)tune { [_tune autorelease]; @@ -107,6 +174,35 @@ { _tune = @""; } + + [self postChangedNotification]; +} + +- (void)setProfile:(NSString *)profile +{ + [_profile autorelease]; + _profile = [profile copy]; + [self postChangedNotification]; +} + +- (void)setLevel:(NSString *)level +{ + [_level autorelease]; + _level = [level copy]; + [self postChangedNotification]; +} + +- (void)setVideoOptionExtra:(NSString *)videoOptionExtra +{ + [_videoOptionExtra autorelease]; + _videoOptionExtra = [videoOptionExtra copy]; + [self postChangedNotification]; +} + +- (void)setFastDecode:(BOOL)fastDecode +{ + _fastDecode = fastDecode; + [self postChangedNotification]; } - (void)validatePresetsSettings @@ -385,6 +481,8 @@ - (void)applyPreset:(NSDictionary *)preset { + self.notificationsEnabled = NO; + // map legacy encoder names via libhb. const char *strValue = hb_video_encoder_sanitize_name([preset[@"VideoEncoder"] UTF8String]); self.encoder = hb_video_encoder_get_from_name(strValue); @@ -521,6 +619,8 @@ // Turbo 1st pass for 2 Pass Encoding. self.turboTwoPass = [preset[@"VideoTurboTwoPass"] intValue]; + + self.notificationsEnabled = YES; } - (void)writeToPreset:(NSMutableDictionary *)preset |