summaryrefslogtreecommitdiffstats
path: root/macosx/HBVideo.m
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2015-10-20 18:55:08 +0200
committerDamiano Galassi <[email protected]>2015-10-20 18:55:08 +0200
commit7f50c27989a63e87d2f17c6495d29e136ccfd837 (patch)
tree280036131fa6d7dd1a11ef84a55c4dfad3e96aca /macosx/HBVideo.m
parentc32d5236135c6be0b4987fb74de511e3332d7396 (diff)
MacGui: added undo/redo support to the video, picture, filters, chapters and range parts of HBJob.
Diffstat (limited to 'macosx/HBVideo.m')
-rw-r--r--macosx/HBVideo.m70
1 files changed, 67 insertions, 3 deletions
diff --git a/macosx/HBVideo.m b/macosx/HBVideo.m
index b8a98d406..604e4aecc 100644
--- a/macosx/HBVideo.m
+++ b/macosx/HBVideo.m
@@ -81,58 +81,97 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification";
{
// if so, convert the old setting to the new scale as close as possible
// based on percentages
- self.quality = floor((maxValue - minValue + 1.) * (previousPercentOfSliderScale));
+ if (!(self.undo.isUndoing || self.undo.isRedoing))
+ {
+ self.quality = floor((maxValue - minValue + 1.) * (previousPercentOfSliderScale));
+ }
}
}
- (void)setEncoder:(int)encoder
{
+ if (encoder != _encoder)
+ {
+ [[self.undo prepareWithInvocationTarget:self] setEncoder:_encoder];
+ }
_encoder = encoder;
[self updateQualityBounds];
- [self validatePresetsSettings];
- [self validateAdvancedOptions];
+
+ if (!(self.undo.isUndoing || self.undo.isRedoing))
+ {
+ [self validatePresetsSettings];
+ [self validateAdvancedOptions];
+ }
[self postChangedNotification];
}
- (void)setQualityType:(int)qualityType
{
+ if (qualityType != _qualityType)
+ {
+ [[self.undo prepareWithInvocationTarget:self] setQualityType:_qualityType];
+ }
_qualityType = qualityType;
[self postChangedNotification];
}
- (void)setAvgBitrate:(int)avgBitrate
{
+ if (avgBitrate != _avgBitrate)
+ {
+ [[self.undo prepareWithInvocationTarget:self] setAvgBitrate:_avgBitrate];
+ }
_avgBitrate = avgBitrate;
[self postChangedNotification];
}
- (void)setQuality:(double)quality
{
+ if (quality != _quality)
+ {
+ [[self.undo prepareWithInvocationTarget:self] setQuality:_quality];
+ }
_quality = quality;
[self postChangedNotification];
}
- (void)setFrameRate:(int)frameRate
{
+ if (frameRate != _frameRate)
+ {
+ [(HBVideo *)[self.undo prepareWithInvocationTarget:self] setFrameRate:_frameRate];
+ }
_frameRate = frameRate;
[self postChangedNotification];
}
- (void)setFrameRateMode:(int)frameRateMode
{
+ if (frameRateMode != _frameRateMode)
+ {
+ [[self.undo prepareWithInvocationTarget:self] setFrameRateMode:_frameRateMode];
+ }
_frameRateMode = frameRateMode;
[self postChangedNotification];
}
- (void)setTwoPass:(BOOL)twoPass
{
+ if (twoPass != _twoPass)
+ {
+ [[self.undo prepareWithInvocationTarget:self] setTwoPass:_twoPass];
+ }
_twoPass = twoPass;
[self postChangedNotification];
}
- (void)setTurboTwoPass:(BOOL)turboTwoPass
{
+ if (turboTwoPass != _turboTwoPass)
+ {
+ [[self.undo prepareWithInvocationTarget:self] setTurboTwoPass:_turboTwoPass];
+ }
_turboTwoPass = turboTwoPass;
[self postChangedNotification];
}
@@ -162,12 +201,21 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification";
- (void)setPreset:(NSString *)preset
{
+ if (![preset isEqualToString:_preset])
+ {
+ [[self.undo prepareWithInvocationTarget:self] setPreset:_preset];
+ }
_preset = [preset copy];
[self postChangedNotification];
}
- (void)setTune:(NSString *)tune
{
+ if (![tune isEqualToString:_tune])
+ {
+ [[self.undo prepareWithInvocationTarget:self] setTune:_tune];
+ }
+
if (![tune isEqualToString:@"none"])
{
_tune = [tune copy];
@@ -182,18 +230,30 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification";
- (void)setProfile:(NSString *)profile
{
+ if (![profile isEqualToString:_profile])
+ {
+ [[self.undo prepareWithInvocationTarget:self] setProfile:_profile];
+ }
_profile = [profile copy];
[self postChangedNotification];
}
- (void)setLevel:(NSString *)level
{
+ if (![level isEqualToString:_level])
+ {
+ [(HBVideo *)[self.undo prepareWithInvocationTarget:self] setLevel:_level];
+ }
_level = [level copy];
[self postChangedNotification];
}
- (void)setVideoOptionExtra:(NSString *)videoOptionExtra
{
+ if (![videoOptionExtra isEqualToString:_videoOptionExtra])
+ {
+ [[self.undo prepareWithInvocationTarget:self] setVideoOptionExtra:_videoOptionExtra];
+ }
if (videoOptionExtra != nil)
{
_videoOptionExtra = [videoOptionExtra copy];
@@ -207,6 +267,10 @@ NSString * const HBVideoChangedNotification = @"HBVideoChangedNotification";
- (void)setFastDecode:(BOOL)fastDecode
{
+ if (fastDecode != _fastDecode)
+ {
+ [[self.undo prepareWithInvocationTarget:self] setFastDecode:_fastDecode];
+ }
_fastDecode = fastDecode;
[self postChangedNotification];
}