summaryrefslogtreecommitdiffstats
path: root/macosx/HBQueueController.m
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2018-06-13 13:04:41 +0200
committerDamiano Galassi <[email protected]>2018-06-13 13:04:41 +0200
commitba64e40a8afc4667ab2419c8c4996ed89a1eb918 (patch)
treea171661548385c7a57989650a953f70f5df190b8 /macosx/HBQueueController.m
parentbe9c7a2def8a9380a2ff43d47ed6d1af24541fff (diff)
MacGui: do not play a sound for notification if alerts are disabled in prefs.
Diffstat (limited to 'macosx/HBQueueController.m')
-rw-r--r--macosx/HBQueueController.m12
1 files changed, 5 insertions, 7 deletions
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];
}
}