[Bf-blender-cvs] [dfc0afb] master: OSX/GHOST: use notifications to inform user about a progress reached 100% The occurance can be controlled in NotificationCenter, todo: move to own function ?

Jens Verwiebe noreply at git.blender.org
Wed Oct 22 19:59:24 CEST 2014


Commit: dfc0afb5b8b2cf432159bf801733f97d3dbdc495
Author: Jens Verwiebe
Date:   Wed Oct 22 19:59:00 2014 +0200
Branches: master
https://developer.blender.org/rBdfc0afb5b8b2cf432159bf801733f97d3dbdc495

OSX/GHOST: use notifications to inform user about a progress reached 100%
The occurance can be controlled in NotificationCenter, todo: move to own function ?

===================================================================

M	intern/ghost/intern/GHOST_WindowCocoa.mm

===================================================================

diff --git a/intern/ghost/intern/GHOST_WindowCocoa.mm b/intern/ghost/intern/GHOST_WindowCocoa.mm
index 7e589cb..f95a23f 100644
--- a/intern/ghost/intern/GHOST_WindowCocoa.mm
+++ b/intern/ghost/intern/GHOST_WindowCocoa.mm
@@ -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];




More information about the Bf-blender-cvs mailing list