summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordynaflash <[email protected]>2007-09-12 14:27:25 +0000
committerdynaflash <[email protected]>2007-09-12 14:27:25 +0000
commitc10e3165be648676ce66fa2f2d5a39c38b46be22 (patch)
treed3ba19e70444508e907b48b8d5ff9a4479674633
parent38d04d4987f2565348df41d6c5e9b7239a570138 (diff)
MacGui: Add warning if "Sleep" or "Shutdown" is going to occur after encoding is done ala user prefs.
- Thanks hawkman! git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@956 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--macosx/Controller.h2
-rw-r--r--macosx/Controller.mm33
2 files changed, 35 insertions, 0 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h
index 18d4681b0..560f4e903 100644
--- a/macosx/Controller.h
+++ b/macosx/Controller.h
@@ -305,5 +305,7 @@
-(IBAction)showGrowlDoneNotification:(id)sender;
- (IBAction)showDebugOutputPanel:(id)sender;
- (void)setupToolbar;
+
+- (void) remindUserOfSleepOrShutdown;
@end
diff --git a/macosx/Controller.mm b/macosx/Controller.mm
index 232302909..b439348dd 100644
--- a/macosx/Controller.mm
+++ b/macosx/Controller.mm
@@ -793,6 +793,9 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
frame.origin.y -= 36;
[fWindow setFrame:frame display:YES animate:YES];
fRipIndicatorShown = YES;
+ /* We check to see if we need to warn the user that the computer will go to sleep
+ or shut down when encoding is finished */
+ [self remindUserOfSleepOrShutdown];
}
/* Update dock icon */
@@ -1788,6 +1791,36 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
[NSApp terminate: self];
}
+- (void) remindUserOfSleepOrShutdown
+{
+ if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"AlertWhenDone"] isEqualToString: @"Put Computer To Sleep"])
+ {
+ /*Warn that computer will sleep after encoding*/
+ int reminduser;
+ NSBeep();
+ reminduser = NSRunAlertPanel(@"The computer will sleep after encoding is done.",@"You have selected to sleep the computer after encoding. To turn off sleeping, go to the HandBrake preferences.", @"OK", @"Preferences...", nil);
+ [NSApp requestUserAttention:NSCriticalRequest];
+ if ( reminduser == NSAlertAlternateReturn )
+ {
+ [self showPreferencesWindow:NULL];
+ }
+ }
+ else if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"AlertWhenDone"] isEqualToString: @"Shut Down Computer"])
+ {
+ /*Warn that computer will shut down after encoding*/
+ int reminduser;
+ NSBeep();
+ reminduser = NSRunAlertPanel(@"The computer will shut down after encoding is done.",@"You have selected to shut down the computer after encoding. To turn off shut down, go to the HandBrake preferences.", @"OK", @"Preferences...", nil);
+ [NSApp requestUserAttention:NSCriticalRequest];
+ if ( reminduser == NSAlertAlternateReturn )
+ {
+ [self showPreferencesWindow:NULL];
+ }
+ }
+
+}
+
+
- (void) doRip
{
/* Let libhb do the job */