summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordynaflash <[email protected]>2008-09-18 18:54:31 +0000
committerdynaflash <[email protected]>2008-09-18 18:54:31 +0000
commit3609b74b98372c0c4960a0a681fd1f0a4dc24c9b (patch)
tree8e259bace00169d3283cfeba6764f06c2a88ef5a /macosx
parentc8338193fc58ba12f46870027c1e1c6a2454d145 (diff)
MacGui: "Stop" command modifications
- Clicking on the "stop" icon in the toolbar now produces a different alert window with three choices - " Continue Encoding " default, just dismisses the window and continues on its merry way. - " Cancel Current and Stop " Cancels the current encode and stops the queue - " Cancel Current and Continue " Cancels the current encode and moves to the next pending encode (if there is one). - Also fixed an issue with deleting a canceled encode at the top of the queue list. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1718 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r--macosx/Controller.h2
-rw-r--r--macosx/Controller.mm43
-rw-r--r--macosx/HBQueueController.mm3
3 files changed, 35 insertions, 13 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h
index 897d833a1..6f58b7a29 100644
--- a/macosx/Controller.h
+++ b/macosx/Controller.h
@@ -329,7 +329,7 @@ BOOL fIsDragging;
- (IBAction) Cancel: (id) sender;
- (void) doCancelCurrentJob;
-
+- (void) doCancelCurrentJobAndStop;
- (IBAction) Pause: (id) sender;
- (IBAction) calculateBitrate: (id) sender;
diff --git a/macosx/Controller.mm b/macosx/Controller.mm
index 483dc8523..a7d1b73c6 100644
--- a/macosx/Controller.mm
+++ b/macosx/Controller.mm
@@ -1536,8 +1536,8 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
- (void) removeQueueFileItem:(int) queueItemToRemove
{
- // NSMutableDictionary * queueToApply = [QueueFileArray objectAtIndex:currentQueueEncodeIndex];
- if ([[[QueueFileArray objectAtIndex:queueItemToRemove] objectForKey:@"Status"] intValue] == 3) //<-- Find out if the item we are removing is a cancelled item
+ /* Find out if the item we are removing is a cancelled item*/
+ if ([[[QueueFileArray objectAtIndex:queueItemToRemove] objectForKey:@"Status"] intValue] == 3)
{
/* Since we are removing a cancelled item, WE need to decrement the currentQueueEncodeIndex
* by one to keep in sync with the queue array
@@ -2976,8 +2976,8 @@ fWorkingCount = 0;
{
if (!fQueueController) return;
-
- NSString * alertTitle = [NSString stringWithFormat:NSLocalizedString(@"Stop encoding ?", nil)];
+ hb_pause( fQueueEncodeLibhb );
+ NSString * alertTitle = [NSString stringWithFormat:NSLocalizedString(@"You are currently encoding. What would you like to do ?", nil)];
// Which window to attach the sheet to?
NSWindow * docWindow;
@@ -2988,22 +2988,43 @@ fWorkingCount = 0;
NSBeginCriticalAlertSheet(
alertTitle,
- NSLocalizedString(@"Keep Encoding", nil),
- nil,
- NSLocalizedString(@"Stop Encoding", nil),
+ NSLocalizedString(@"Continue Encoding", nil),
+ NSLocalizedString(@"Cancel Current and Stop", nil),
+ NSLocalizedString(@"Cancel Current and Continue", nil),
docWindow, self,
- nil, @selector(didDimissCancelCurrentJob:returnCode:contextInfo:), nil,
- NSLocalizedString(@"Your movie will be lost if you don't continue encoding.", nil));
+ nil, @selector(didDimissCancel:returnCode:contextInfo:), nil,
+ NSLocalizedString(@"Your encode will be cancelled if you don't continue encoding.", nil));
// didDimissCancelCurrentJob:returnCode:contextInfo: will be called when the dialog is dismissed
}
-- (void) didDimissCancelCurrentJob: (NSWindow *)sheet returnCode: (int)returnCode contextInfo: (void *)contextInfo
+- (void) didDimissCancel: (NSWindow *)sheet returnCode: (int)returnCode contextInfo: (void *)contextInfo
{
- if (returnCode == NSAlertOtherReturn)
+ hb_resume( fQueueEncodeLibhb );
+ if (returnCode == NSAlertOtherReturn)
+ {
[self doCancelCurrentJob]; // <- this also stops libhb
+ }
+ if (returnCode == NSAlertAlternateReturn)
+ {
+ [self doCancelCurrentJobAndStop];
+ }
}
+- (void) doCancelCurrentJobAndStop
+{
+ hb_stop( fQueueEncodeLibhb );
+ fEncodeState = 2; // don't alert at end of processing since this was a cancel
+
+ // now that we've stopped the currently encoding job, lets mark it as cancelled
+ [[QueueFileArray objectAtIndex:currentQueueEncodeIndex] setObject:[NSNumber numberWithInt:3] forKey:@"Status"];
+ // and as always, save it in the queue .plist...
+ /* We save all of the Queue data here */
+ [self saveQueueFileItem];
+ // so now lets move to
+ currentQueueEncodeIndex++ ;
+ [self writeToActivityLog: "cancelling current job and stopping the queue"];
+}
- (IBAction) Pause: (id) sender
{
hb_state_t s;
diff --git a/macosx/HBQueueController.mm b/macosx/HBQueueController.mm
index cb8be2351..0e1476128 100644
--- a/macosx/HBQueueController.mm
+++ b/macosx/HBQueueController.mm
@@ -473,7 +473,8 @@ if (fWorkingCount > 0)
/* if this is a currently encoding job, we need to be sure to alert the user,
* to let them decide to cancel it first, then if they do, we can come back and
* remove it */
- if (row == fEncodingQueueItem)
+
+ if ([[[fJobGroups objectAtIndex:row] objectForKey:@"Status"] intValue] == 1)
{
NSString * alertTitle = [NSString stringWithFormat:NSLocalizedString(@"Stop This Encode and Remove It ?", nil)];
// Which window to attach the sheet to?