summaryrefslogtreecommitdiffstats
path: root/macosx/HBJob.m
diff options
context:
space:
mode:
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;