OSX/GHOST: use notifications to inform user about a progress reached 100%
authorJens Verwiebe <info@jensverwiebe.de>
Wed, 22 Oct 2014 17:59:00 +0000 (19:59 +0200)
committerJens Verwiebe <info@jensverwiebe.de>
Wed, 22 Oct 2014 17:59:16 +0000 (19:59 +0200)
The occurance can be controlled in NotificationCenter, todo: move to own function ?

intern/ghost/intern/GHOST_WindowCocoa.mm

index 7e589cb74eb1552c657deb274a1287429b9f6c50..f95a23f358d938f0bc3820a779d766f52d3f4803 100644 (file)
@@ -1339,6 +1339,20 @@ GHOST_TSuccess GHOST_WindowCocoa::endProgressBar()
        [[NSImage imageNamed:@"NSApplicationIcon"] drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
        [dockIcon unlockFocus];
        [NSApp setApplicationIconImage:dockIcon];
+       
+       
+       // With OSX 10.8 and later, we can use notifications to inform the user when the progress reached 100%
+       // Atm. just fire this when the progressbar ends, the behavior is controlled in the NotificationCenter
+       // If Blender is not frontmost window, a message pops up with sound, in any case an entry in notifications
+       
+       if ([NSUserNotificationCenter respondsToSelector:@selector(defaultUserNotificationCenter)]) {
+               NSUserNotification *notification = [[NSUserNotification alloc] init];
+               notification.title = @"Blender progress notification";
+               notification.informativeText = @"Calculation ended";
+               notification.soundName = NSUserNotificationDefaultSoundName;
+               [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
+       }
+       
        [dockIcon release];
        
        [pool drain];