diff options
author | dynaflash <[email protected]> | 2007-09-12 14:27:25 +0000 |
---|---|---|
committer | dynaflash <[email protected]> | 2007-09-12 14:27:25 +0000 |
commit | c10e3165be648676ce66fa2f2d5a39c38b46be22 (patch) | |
tree | d3ba19e70444508e907b48b8d5ff9a4479674633 /macosx/Controller.mm | |
parent | 38d04d4987f2565348df41d6c5e9b7239a570138 (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
Diffstat (limited to 'macosx/Controller.mm')
-rw-r--r-- | macosx/Controller.mm | 33 |
1 files changed, 33 insertions, 0 deletions
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 */ |