]> granicus.if.org Git - handbrake/commitdiff
MacGui: prevent sleep at queue start, and reallow it at the end of the queue..
authorDamiano Galassi <damiog@gmail.com>
Thu, 5 Jan 2017 09:14:58 +0000 (10:14 +0100)
committerDamiano Galassi <damiog@gmail.com>
Mon, 9 Jan 2017 07:50:17 +0000 (08:50 +0100)
(cherry picked from commit 62f25f927c61969deb6a063448b9fb2c2295391a)

macosx/HBQueueController.m

index 31823371430910fdd86d03e31c445156b928e049..190749d556c4049a80c98671cb4708449d42e449 100644 (file)
@@ -70,6 +70,7 @@
 
         // Init a separate instance of libhb for the queue
         _core = [[HBCore alloc] initWithLogLevel:loggingLevel name:@"QueueCore"];
+        _core.automaticallyPreventSleep = NO;
 
         // Load the queue from disk.
         _jobs = [[HBDistributedArray alloc] initWithURL:queueURL];
     // since we have completed an encode, we go to the next
     if (self.stop)
     {
+        [HBUtilities writeToActivityLog:"Queue manually stopped"];
+
         self.stop = NO;
+        [self.core allowSleep];
     }
     else
     {
             // Since there are no more items to encode, go to queueCompletedAlerts
             // for user specified alerts after queue completed
             [self queueCompletedAlerts];
+
+            [self.core allowSleep];
         }
     }
     [self.jobs commit];
         // or shut down when encoding is finished
         [self remindUserOfSleepOrShutdown];
 
+        [self.core preventSleep];
         [self encodeNextQueueItem];
     }
 }
     if (s == HBStatePaused)
     {
         [self.core resume];
+        [self.core preventSleep];
     }
     else if (s == HBStateWorking || s == HBStateMuxing)
     {
         [self.core pause];
+        [self.core allowSleep];
     }
 }