From 7b632f1ee194df32506ac4c1a8b90936ddc9e35a Mon Sep 17 00:00:00 2001 From: dynaflash Date: Tue, 3 Aug 2010 15:43:25 +0000 Subject: [PATCH] MacGui: Re-locate logic for encode done notifications as per user preferences. - 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 | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/macosx/Controller.m b/macosx/Controller.m index d0b5c9dd..5bba38c5 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -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 { -- 2.11.0