summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2010-07-22 19:09:41 +0000
committersr55 <[email protected]>2010-07-22 19:09:41 +0000
commit422ce524afd6b470150a211ee6891af670af1db5 (patch)
tree423c625e1e02fc9c6e32190ebbe0524176fd5f2f
parent4bef20d6e23432eeeeaae0d15c1a240780913046 (diff)
MacGui:
- Re-checking 3453 after accidentally removing it. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3458 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--macosx/Controller.m86
1 files changed, 57 insertions, 29 deletions
diff --git a/macosx/Controller.m b/macosx/Controller.m
index d9122b587..47303dfc9 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -182,9 +182,9 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
*/
if (hbInstanceNum > 1)
{
- alertTitle = [NSString stringWithFormat:
- NSLocalizedString(@"There is already an instance of HandBrake running.", @"")];
- NSBeginCriticalAlertSheet(
+ alertTitle = [NSString stringWithFormat:
+ NSLocalizedString(@"There is already an instance of HandBrake running.", @"")];
+ NSBeginCriticalAlertSheet(
alertTitle,
NSLocalizedString(@"Reload Queue", nil),
nil,
@@ -195,29 +195,48 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
}
else
{
- if (fWorkingCount > 0)
+ if (fWorkingCount > 0 || fPendingCount > 0)
{
- alertTitle = [NSString stringWithFormat:
- NSLocalizedString(@"HandBrake Has Detected %d Previously Encoding Item and %d Pending Item(s) In Your Queue.", @""),
- fWorkingCount,fPendingCount];
+ if (fWorkingCount > 0)
+ {
+ alertTitle = [NSString stringWithFormat:
+ NSLocalizedString(@"HandBrake Has Detected %d Previously Encoding Item(s) and %d Pending Item(s) In Your Queue.", @""),
+ fWorkingCount,fPendingCount];
+ }
+ else
+ {
+ alertTitle = [NSString stringWithFormat:
+ NSLocalizedString(@"HandBrake Has Detected %d Pending Item(s) In Your Queue.", @""),
+ fPendingCount];
+ }
+
+ NSBeginCriticalAlertSheet(
+ alertTitle,
+ NSLocalizedString(@"Reload Queue", nil),
+ nil,
+ NSLocalizedString(@"Empty Queue", nil),
+ fWindow, self,
+ nil, @selector(didDimissReloadQueue:returnCode:contextInfo:), nil,
+ NSLocalizedString(@" Do you want to reload them ?", nil));
}
else
{
- alertTitle = [NSString stringWithFormat:
- NSLocalizedString(@"HandBrake Has Detected %d Pending Item(s) In Your Queue.", @""),
- fPendingCount];
+ /* Since we addressed any pending or previously encoding items above, we go ahead and make sure the queue
+ * is empty of any finished items or cancelled items */
+ [self clearQueueAllItems];
+ /* We show whichever open source window specified in LaunchSourceBehavior preference key */
+ if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source"])
+ {
+ [self browseSources:nil];
+ }
+
+ if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"LaunchSourceBehavior"] isEqualToString: @"Open Source (Title Specific)"])
+ {
+ [self browseSources:(id)fOpenSourceTitleMMenu];
+ }
}
- NSBeginCriticalAlertSheet(
- alertTitle,
- NSLocalizedString(@"Reload Queue", nil),
- nil,
- NSLocalizedString(@"Empty Queue", nil),
- fWindow, self,
- nil, @selector(didDimissReloadQueue:returnCode:contextInfo:), nil,
- NSLocalizedString(@" Do you want to reload them ?", nil));
}
-
}
else
{
@@ -255,7 +274,6 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
{
if ([[runningAppsDictionary valueForKey:@"NSApplicationName"] isEqualToString:@"HandBrake"])
{
- hbInstances++;
/*Report the path to each active instances app path */
runningInstancePidNum = [[runningAppsDictionary valueForKey:@"NSApplicationProcessIdentifier"] intValue];
runningInstanceAppPath = [runningAppsDictionary valueForKey:@"NSApplicationPath"];
@@ -272,7 +290,8 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
/* Tell fQueueController what our pidNum is */
[fQueueController setPidNum:pidNum];
}
- }
+ hbInstances++;
+ }
}
return hbInstances;
}
@@ -281,8 +300,11 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
- (void) didDimissReloadQueue: (NSWindow *)sheet returnCode: (int)returnCode contextInfo: (void *)contextInfo
{
+
+ [self writeToActivityLog: "didDimissReloadQueue number of hb instances:%d", hbInstanceNum];
if (returnCode == NSAlertOtherReturn)
{
+ [self writeToActivityLog: "didDimissReloadQueue NSAlertOtherReturn Chosen"];
[self clearQueueAllItems];
/* We show whichever open source window specified in LaunchSourceBehavior preference key */
@@ -298,8 +320,10 @@ static NSString * ChooseSourceIdentifier = @"Choose Source It
}
else
{
- if ([self hbInstances] == 1)
+ [self writeToActivityLog: "didDimissReloadQueue First Button Chosen"];
+ if (hbInstanceNum == 1)
{
+
[self setQueueEncodingItemsAsPending];
}
[self showQueueWindow:NULL];
@@ -2081,15 +2105,19 @@ fWorkingCount = 0;
/* we look here to see if the preset is we move on to the next one */
while ( tempObject = [enumerator nextObject] )
{
- /* If the queue item is marked as "encoding" (1)
- * then change its status back to pending (2) which effectively
- * puts it back into the queue to be encoded
- */
- if ([[tempObject objectForKey:@"Status"] intValue] == 1)
+ /* We want to keep any queue item that is pending or was previously being encoded */
+ if ([[tempObject objectForKey:@"Status"] intValue] == 1 || [[tempObject objectForKey:@"Status"] intValue] == 2)
{
- [tempObject setObject:[NSNumber numberWithInt: 2] forKey:@"Status"];
+ /* If the queue item is marked as "encoding" (1)
+ * then change its status back to pending (2) which effectively
+ * puts it back into the queue to be encoded
+ */
+ if ([[tempObject objectForKey:@"Status"] intValue] == 1)
+ {
+ [tempObject setObject:[NSNumber numberWithInt: 2] forKey:@"Status"];
+ }
+ [tempArray addObject:tempObject];
}
- [tempArray addObject:tempObject];
}
[QueueFileArray setArray:tempArray];