summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-12-29 09:00:47 +0000
committerritsuka <[email protected]>2014-12-29 09:00:47 +0000
commit90449dc954d3486248a1a9fcb6889046bacd2f67 (patch)
tree959f77f4623c0e44c27c6911e3e06dcb2b293190
parent1e93087497f97e0615fa3d05aea6b157b9b88480 (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
-rw-r--r--macosx/Controller.m9
-rw-r--r--macosx/HBVideo.h2
-rw-r--r--macosx/HBVideo.m100
3 files changed, 110 insertions, 1 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m
index 4dd1a3d1b..94bd09d44 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -144,6 +144,7 @@
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pictureSettingsDidChange) name:HBPictureChangedNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pictureSettingsDidChange) name:HBFiltersChangedNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(formatChanged:) name:HBContainerChangedNotification object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(customSettingUsed) name:HBVideoChangedNotification object:nil];
}
return self;
@@ -2578,6 +2579,8 @@ static void queueFSEventStreamCallback(
fVideoController.pictureFilters = self.job.filters.summary;
[fPreviewController reloadPreviews];
+
+ [self customSettingUsed];
}
#pragma mark -
@@ -2695,7 +2698,11 @@ static void queueFSEventStreamCallback(
[self updateFileName];
}
- [self pictureSettingsDidChange];
+ // align picture settings and video filters in the UI using tabs
+ fVideoController.pictureSettings = self.job.picture.summary;
+ fVideoController.pictureFilters = self.job.filters.summary;
+
+ [fPreviewController reloadPreviews];
}
}
diff --git a/macosx/HBVideo.h b/macosx/HBVideo.h
index 22424061a..257c6d29c 100644
--- a/macosx/HBVideo.h
+++ b/macosx/HBVideo.h
@@ -9,6 +9,8 @@
@class HBJob;
+extern NSString * const HBVideoChangedNotification;
+
/**
* HBVideo
*/
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