OSDN Git Service

MacGui: Re-locate logic for encode done notifications as per user preferences.
authordynaflash <dynaflash@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 3 Aug 2010 15:43:25 +0000 (15:43 +0000)
committerdynaflash <dynaflash@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 3 Aug 2010 15:43:25 +0000 (15:43 +0000)
- Fixes an issue where a system beep would occur after every encode when Alert Window was chosen.
- Also means less calls to showGrowlDoneNotification as we were calling it after every encode and then checking the user prefs instead of checking prefs before calling it.

git-svn-id: svn://localhost/HandBrake/trunk@3468 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/Controller.m

index d0b5c9d..5bba38c 100644 (file)
@@ -1003,8 +1003,17 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
                 pathOfFinishedEncode = [[QueueFileArray objectAtIndex:currentQueueEncodeIndex] objectForKey:@"DestinationPath"];
                 
                 /* Both the Growl Alert and Sending to MetaX can be done as encodes roll off the queue */
-                /* Growl alert */
-                [self showGrowlDoneNotification:pathOfFinishedEncode];
+                if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"AlertWhenDone"] isEqualToString: @"Growl Notification"] || 
+                    [[[NSUserDefaults standardUserDefaults] stringForKey:@"AlertWhenDone"] isEqualToString: @"Alert Window And Growl"])
+                {
+                    /* If Play System Alert has been selected in Preferences */
+                    if( [[NSUserDefaults standardUserDefaults] boolForKey:@"AlertWhenDoneSound"] == YES )
+                    {
+                        NSBeep();
+                    }
+                    [self showGrowlDoneNotification:pathOfFinishedEncode];
+                }
+                
                 /* Send to MetaX */
                 [self sendToMetaX:pathOfFinishedEncode];
                 
@@ -1382,30 +1391,19 @@ static NSString *        ChooseSourceIdentifier             = @"Choose Source It
 -(void)showGrowlDoneNotification:(NSString *) filePath
 {
     /* This end of encode action is called as each encode rolls off of the queue */
-    
-      /* If Play System Alert has been selected in Preferences */
-    if( [[NSUserDefaults standardUserDefaults] boolForKey:@"AlertWhenDoneSound"] == YES )
-    {
-        NSBeep();
-    }
     /* Setup the Growl stuff ... */
     NSString * finishedEncode = filePath;
     /* strip off the path to just show the file name */
     finishedEncode = [finishedEncode lastPathComponent];
-    if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"AlertWhenDone"] isEqualToString: @"Growl Notification"] || 
-        [[[NSUserDefaults standardUserDefaults] stringForKey:@"AlertWhenDone"] isEqualToString: @"Alert Window And Growl"])
-    {
-        NSString * growlMssg = [NSString stringWithFormat: @"your HandBrake encode %@ is done!",finishedEncode];
-        [GrowlApplicationBridge 
-         notifyWithTitle:@"Put down that cocktail..." 
-         description:growlMssg 
-         notificationName:SERVICE_NAME
-         iconData:nil 
-         priority:0 
-         isSticky:1 
-         clickContext:nil];
-    }
-    
+    NSString * growlMssg = [NSString stringWithFormat: @"your HandBrake encode %@ is done!",finishedEncode];
+    [GrowlApplicationBridge 
+     notifyWithTitle:@"Put down that cocktail..." 
+     description:growlMssg 
+     notificationName:SERVICE_NAME
+     iconData:nil 
+     priority:0 
+     isSticky:1 
+     clickContext:nil];
 }
 -(void)sendToMetaX:(NSString *) filePath
 {