From ba64e40a8afc4667ab2419c8c4996ed89a1eb918 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Wed, 13 Jun 2018 13:04:41 +0200 Subject: MacGui: do not play a sound for notification if alerts are disabled in prefs. --- macosx/HBQueueController.m | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'macosx/HBQueueController.m') diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m index 0c7ad25e3..ea9159766 100644 --- a/macosx/HBQueueController.m +++ b/macosx/HBQueueController.m @@ -891,12 +891,12 @@ } } -- (void)showNotificationWithTitle:(NSString *)title description:(NSString *)description url:(NSURL *)fileURL +- (void)showNotificationWithTitle:(NSString *)title description:(NSString *)description url:(NSURL *)fileURL playSound:(BOOL)playSound { NSUserNotification *notification = [[NSUserNotification alloc] init]; notification.title = title; notification.informativeText = description; - notification.soundName = NSUserNotificationDefaultSoundName; + notification.soundName = playSound ? NSUserNotificationDefaultSoundName : nil; notification.hasActionButton = YES; notification.actionButtonTitle = NSLocalizedString(@"Show", @"Notification -> Show in Finder"); notification.userInfo = @{ @"Path": fileURL.path }; @@ -952,10 +952,7 @@ [[NSUserDefaults standardUserDefaults] integerForKey:@"HBAlertWhenDone"] == HBDoneActionAlertAndNotification) { // If Play System Alert has been selected in Preferences - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HBAlertWhenDoneSound"] == YES) - { - NSBeep(); - } + bool playSound = [[NSUserDefaults standardUserDefaults] boolForKey:@"HBAlertWhenDoneSound"]; NSString *title; NSString *description; @@ -975,7 +972,8 @@ [self showNotificationWithTitle:title description:description - url:job.completeOutputURL]; + url:job.completeOutputURL + playSound:playSound]; } } -- cgit v1.2.3