OSDN Git Service

MacGui: Fix errant encode done growl alert and send to MetaX function when finishing...
[handbrake-jp/handbrake-jp-git.git] / macosx / HBQueueController.mm
index a024133..555ba5c 100644 (file)
@@ -1473,6 +1473,8 @@ static NSString*    HBQueuePauseResumeToolbarIdentifier       = @"HBQueuePauseRe
         [fProgressBar setIndeterminate:NO];
         [fProgressBar stopAnimation:nil];
         [fProgressBar setDoubleValue:0.0];
+        
+        
     }
     
     else
@@ -1571,9 +1573,12 @@ static NSString*    HBQueuePauseResumeToolbarIdentifier       = @"HBQueuePauseRe
                          withSubtitleInfo: YES]];
         }
     }
-    
     else
+    {
         [fJobDescTextField setStringValue: @"No encodes pending"];
+    
+    }
+    
 }
 
 //------------------------------------------------------------------------------------
@@ -1748,7 +1753,29 @@ static NSString*    HBQueuePauseResumeToolbarIdentifier       = @"HBQueuePauseRe
 //------------------------------------------------------------------------------------
 - (void)currentJobChanged: (HBJob *) currentJob
 {
+    /* if the job has a destination path, lets perform finished job notifications in fHBController 
+     * We call this here so that we pickup the last job in the queue and single encodes before fCurrentJob
+     * is released. So for the first job and the beginning of single encodes we check for the existence
+     * of a valid fCurrentJob jobGroup
+     */
     [currentJob retain];
+    /* We need to compare the job group to determine if this is the end of a job group
+     * or just the end of a job within a group to keep from sending encode done notification
+     * after the first pass in a two pass encode
+     */
+    HBJobGroup * theJobGroupCheck = [currentJob jobGroup];
+    if ((theJobGroupCheck == nil) || (theJobGroupCheck != fCurrentJobGroup))
+    {
+        /* we need to make sure that we are not at the beginning of a queue and also that the job hasn't
+         * been cancelled
+         */
+        if ([[fCurrentJob jobGroup] destinationPath] && [fCurrentJobGroup status] != HBStatusCanceled)
+        {
+            /* send encode messages to fHBController. User prefs are grokked there. */
+            [fHBController showGrowlDoneNotification: [[fCurrentJob jobGroup] destinationPath]];
+            [fHBController sendToMetaX: [[fCurrentJob jobGroup] destinationPath]];
+        }
+    }
     [fCurrentJob release];
     fCurrentJob = currentJob;
 
@@ -1770,7 +1797,11 @@ static NSString*    HBQueuePauseResumeToolbarIdentifier       = @"HBQueuePauseRe
             // all other cases are assumed to be a successful encode. BTW, libhb
             // doesn't currently report errors back to the GUI.
             if ([fCurrentJobGroup status] != HBStatusCanceled)
+            {
                 [fCurrentJobGroup setStatus:HBStatusCompleted];
+            }
+            
+            
         }
         
         // Set the new group