summaryrefslogtreecommitdiffstats
path: root/macosx/HBJob.m
diff options
context:
space:
mode:
authorritsuka <[email protected]>2015-02-01 12:21:34 +0000
committerritsuka <[email protected]>2015-02-01 12:21:34 +0000
commit17d0a11545ccf18dc167d025deaf47f8198b0710 (patch)
tree2403a1e79bd65625ed6a679bdcaaf266c44e963c /macosx/HBJob.m
parentf344cbc5d7b9cfe2e4c5acb8de89402933907eda (diff)
MacGui: clean up the methods to update the destination file name and extension.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6854 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBJob.m')
-rw-r--r--macosx/HBJob.m26
1 files changed, 23 insertions, 3 deletions
diff --git a/macosx/HBJob.m b/macosx/HBJob.m
index d991d9709..f81d387a2 100644
--- a/macosx/HBJob.m
+++ b/macosx/HBJob.m
@@ -17,6 +17,12 @@
NSString *HBContainerChangedNotification = @"HBContainerChangedNotification";
NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification";
+@interface HBJob ()
+
+@property (nonatomic, readwrite, getter=areNotificationsEnabled) BOOL notificationsEnabled;
+
+@end
+
@implementation HBJob
- (instancetype)initWithTitle:(HBTitle *)title andPreset:(HBPreset *)preset
@@ -47,6 +53,8 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification";
_uuid = [[[NSUUID UUID] UUIDString] retain];
[self applyPreset:preset];
+
+ _notificationsEnabled = YES;
}
return self;
@@ -54,6 +62,8 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification";
- (void)applyPreset:(HBPreset *)preset
{
+ self.notificationsEnabled = NO;
+
if (preset.isDefault)
{
self.presetName = [NSString stringWithFormat:@"%@ (Default)", preset.name];
@@ -76,6 +86,8 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification";
[@[self.audio, self.subtitles, self.filters, self.picture, self.video] makeObjectsPerformSelector:@selector(applyPreset:)
withObject:content];
+
+ self.notificationsEnabled = YES;
}
- (void)applyCurrentSettingsToPreset:(NSMutableDictionary *)dict
@@ -98,8 +110,11 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification";
[self.subtitles containerChanged:container];
[self.video containerChanged];
- // post a notification for any interested observers to indicate that our video container has changed
- [[NSNotificationCenter defaultCenter] postNotificationName:HBContainerChangedNotification object:self];
+ if (self.notificationsEnabled)
+ {
+ // post a notification for any interested observers to indicate that our video container has changed
+ [[NSNotificationCenter defaultCenter] postNotificationName:HBContainerChangedNotification object:self];
+ }
}
- (void)setTitle:(HBTitle *)title
@@ -112,7 +127,10 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification";
- (void)setChaptersEnabled:(BOOL)chaptersEnabled
{
_chaptersEnabled = chaptersEnabled;
- [[NSNotificationCenter defaultCenter] postNotificationName:HBChaptersChangedNotification object:self];
+ if (self.notificationsEnabled)
+ {
+ [[NSNotificationCenter defaultCenter] postNotificationName:HBChaptersChangedNotification object:self];
+ }
}
+ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key
@@ -186,6 +204,8 @@ NSString *HBChaptersChangedNotification = @"HBChaptersChangedNotification";
copy->_chaptersEnabled = _chaptersEnabled;
copy->_chapterTitles = [[NSMutableArray alloc] initWithArray:_chapterTitles copyItems:YES];
+
+ copy->_notificationsEnabled = _notificationsEnabled;
}
return copy;