]> 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>
Thu, 5 Jan 2017 09:14:58 +0000 (10:14 +0100)
macosx/HBQueueController.m

index 8dfef4e2634a328ce86887a5294f2d1b2b72abfd..31320cacf3cec49ba0b14b2545140d67ad96783d 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 class:[HBJob class]];
     // 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];
     }
 }