]> granicus.if.org Git - handbrake/commitdiff
MacGui: Remove the "Reload queue" alert. The queue is always reloaded and the queue...
authorritsuka <damiog@gmail.com>
Wed, 22 Apr 2015 16:58:07 +0000 (16:58 +0000)
committerritsuka <damiog@gmail.com>
Wed, 22 Apr 2015 16:58:07 +0000 (16:58 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7113 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/HBAppDelegate.m
macosx/HBQueueController.h
macosx/HBQueueController.m

index 4f998ce2df4be96b0ddbac6c4aead2219b6c8b5f..23ddf3d014630280c3558dfdb820073b907929c8 100644 (file)
     if ([[NSUserDefaults standardUserDefaults] boolForKey:@"OutputPanelIsOpen"])
         [self showOutputPanel:nil];
 
-    // Open queue window now if it was visible when HB was closed
-    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"QueueWindowIsOpen"])
-        [self showQueueWindow:nil];
-
-    [self showMainWindow:self];
-
     // Now we re-check the queue array to see if there are
-    // any remaining encodes to be done in it and ask the
-    // user if they want to reload the queue
+    // any remaining encodes to be done
     if (self.queueController.count)
     {
         // On Screen Notification
         }
         else
         {
-            if (self.queueController.workingItemsCount > 0 || self.queueController.pendingItemsCount > 0)
-            {
-                NSString *alertTitle;
-
-                if (self.queueController.workingItemsCount > 0)
-                {
-                    alertTitle = [NSString stringWithFormat:
-                                  NSLocalizedString(@"HandBrake Has Detected %d Previously Encoding Item(s) and %d Pending Item(s) In Your Queue.", @""),
-                                  self.queueController.workingItemsCount, self.queueController.pendingItemsCount];
-                }
-                else
-                {
-                    alertTitle = [NSString stringWithFormat:
-                                  NSLocalizedString(@"HandBrake Has Detected %d Pending Item(s) In Your Queue.", @""),
-                                  self.queueController.pendingItemsCount];
-                }
-
-                alert = [[NSAlert alloc] init];
-                [alert setMessageText:alertTitle];
-                [alert setInformativeText:NSLocalizedString(@"Do you want to reload them ?", nil)];
-                [alert addButtonWithTitle:NSLocalizedString(@"Reload Queue", nil)];
-                [alert addButtonWithTitle:NSLocalizedString(@"Empty Queue", nil)];
-                [alert setAlertStyle:NSCriticalAlertStyle];
-            }
-            else
-            {
-                // 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.queueController removeAllJobs];
-                [self.mainController launchAction];
-            }
-        }
-
-        if (alert)
-        {
-            NSModalResponse response = [alert runModal];
-
-            if (response == NSAlertSecondButtonReturn)
-            {
-                [HBUtilities writeToActivityLog:"didDimissReloadQueue NSAlertSecondButtonReturn Chosen"];
-                [self.queueController removeAllJobs];
-                [self.mainController launchAction];
-            }
-            else
-            {
-                [HBUtilities writeToActivityLog:"didDimissReloadQueue NSAlertFirstButtonReturn Chosen"];
-                if (instances == 1)
-                {
-                    [self.queueController setEncodingJobsAsPending];
-                }
-
-                [self showQueueWindow:nil];
-            }
-
+            [self.queueController setEncodingJobsAsPending];
+            [self.queueController removeCompletedJobs];
         }
+        [self showMainWindow:self];
+        [self showQueueWindow:self];
     }
     else
     {
+        // Open queue window now if it was visible when HB was closed
+        if ([[NSUserDefaults standardUserDefaults] boolForKey:@"QueueWindowIsOpen"])
+            [self showQueueWindow:nil];
+
+        [self showMainWindow:self];
         [self.mainController launchAction];
     }
 
         }
     }
 
-    // Warn if items still in the queue
-    else if (self.queueController.pendingItemsCount > 0)
-    {
-        NSAlert *alert = [[NSAlert alloc] init];
-        [alert setMessageText:NSLocalizedString(@"Are you sure you want to quit HandBrake?", nil)];
-        [alert setInformativeText:NSLocalizedString(@"There are pending encodes in your queue. Do you want to quit anyway?",nil)];
-        [alert addButtonWithTitle:NSLocalizedString(@"Quit", nil)];
-        [alert addButtonWithTitle:NSLocalizedString(@"Don't Quit", nil)];
-        [alert setAlertStyle:NSCriticalAlertStyle];
-        NSInteger result = [alert runModal];
-        if (result == NSAlertFirstButtonReturn)
-        {
-            return NSTerminateNow;
-        }
-        else
-        {
-            return NSTerminateCancel;
-        }
-    }
-
     return NSTerminateNow;
 }
 
index 8ef32b1ae557b48f7b501440e28ba641fab62bca..9e497d8c5f593230b1cdd0ccb5a04e0dd3e2e855 100644 (file)
@@ -31,6 +31,8 @@
 - (BOOL)jobExistAtURL:(NSURL *)url;
 
 - (void)removeAllJobs;
+- (void)removeCompletedJobs;
+
 - (void)setEncodingJobsAsPending;
 
 - (IBAction)rip:(id)sender;
index 13261cf6705ee220e7279b6f1e04c455776157d0..54d154a791aff6153d6d85f8e01b2a1eec16edcb 100644 (file)
  * This method will clear the queue of any encodes that are not still pending
  * this includes both successfully completed encodes as well as cancelled encodes
  */
-- (void)clearEncodedJobs
+- (void)removeCompletedJobs
 {
     [self.jobs beginTransaction];
     [self removeItemsUsingBlock:^BOOL(HBJob *item) {