From: Damiano Galassi Date: Thu, 5 Jan 2017 09:14:58 +0000 (+0100) Subject: MacGui: prevent sleep at queue start, and reallow it at the end of the queue.. X-Git-Tag: 1.0.2~31 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c2f0e643984ab65471deaf007b9d7560a00a22af;p=handbrake MacGui: prevent sleep at queue start, and reallow it at the end of the queue.. (cherry picked from commit 62f25f927c61969deb6a063448b9fb2c2295391a) --- diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m index 318233714..190749d55 100644 --- a/macosx/HBQueueController.m +++ b/macosx/HBQueueController.m @@ -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]; @@ -573,7 +574,10 @@ // 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 { @@ -617,6 +621,8 @@ // 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]; @@ -1125,6 +1131,7 @@ // or shut down when encoding is finished [self remindUserOfSleepOrShutdown]; + [self.core preventSleep]; [self encodeNextQueueItem]; } } @@ -1201,10 +1208,12 @@ if (s == HBStatePaused) { [self.core resume]; + [self.core preventSleep]; } else if (s == HBStateWorking || s == HBStateMuxing) { [self.core pause]; + [self.core allowSleep]; } }