diff options
author | Damiano Galassi <[email protected]> | 2019-08-11 13:16:44 +0200 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2019-08-11 13:16:44 +0200 |
commit | ae8703461f0d248352b71f4518f1a6bfef31acb9 (patch) | |
tree | ad230c2134b1da3b8de3611de440415217323ee2 | |
parent | 0269063fae2c1f23c36196df9741a846911217a4 (diff) |
MacGui: improve xpc crash recovery, set dvdnav option in the xpc service.
-rw-r--r-- | macosx/HBQueue.m | 4 | ||||
-rw-r--r-- | macosx/HBQueueItemWorkingView.m | 5 | ||||
-rw-r--r-- | macosx/HBRemoteCore.m | 18 | ||||
-rw-r--r-- | macosx/HandBrakeXPCService/HBRemoteCoreProtocol.h | 2 | ||||
-rw-r--r-- | macosx/HandBrakeXPCService/HandBrakeXPCService.m | 7 |
5 files changed, 26 insertions, 10 deletions
diff --git a/macosx/HBQueue.m b/macosx/HBQueue.m index c0e3d1b1c..bd6f74490 100644 --- a/macosx/HBQueue.m +++ b/macosx/HBQueue.m @@ -731,10 +731,6 @@ NSString * const HBQueueItemNotificationItemKey = @"HBQueueItemNotificationItemK NSParameterAssert(job); - HBStateFormatter *formatter = [[HBStateFormatter alloc] init]; - formatter.twoLines = NO; - //self.core.stateFormatter = formatter; - // Progress handler void (^progressHandler)(HBState state, HBProgress progress, NSString *info) = ^(HBState state, HBProgress progress, NSString *info) { diff --git a/macosx/HBQueueItemWorkingView.m b/macosx/HBQueueItemWorkingView.m index fcef24707..84118af94 100644 --- a/macosx/HBQueueItemWorkingView.m +++ b/macosx/HBQueueItemWorkingView.m @@ -72,9 +72,12 @@ - (void)setItem:(HBQueueItem *)item { - [super setItem:item]; [self removeObservers]; + self.progressField.stringValue = @""; + + [super setItem:item]; + if (item.state == HBQueueItemStateWorking) { [self setUpObservers]; diff --git a/macosx/HBRemoteCore.m b/macosx/HBRemoteCore.m index b239cbaab..a66879e1b 100644 --- a/macosx/HBRemoteCore.m +++ b/macosx/HBRemoteCore.m @@ -4,6 +4,7 @@ #import "HBRemoteCore.h" #import "HBRemoteCoreProtocol.h" +#import "HBPreferencesKeys.h" @import HandBrakeKit; @@ -68,18 +69,24 @@ - (void)handleInterruption { + [_proxy setUpWithLogLevel:self.level name:self.name]; + if (self.state != HBStateIdle) { [self forwardError:@"XPC Service did crash"]; + + HBCoreCompletionHandler handler = self.completionHandler; + self.progressHandler = nil; - if (self.completionHandler) - { - self.completionHandler(HBCoreResultFailed); - } self.completionHandler = nil; + self.state = HBStateIdle; + + if (handler) + { + handler(HBCoreResultFailed); + } } - [_proxy setUpWithLogLevel:self.level name:self.name]; } - (instancetype)initWithLogLevel:(NSInteger)level name:(NSString *)name @@ -89,6 +96,7 @@ { _level = level; _name = name; + [_proxy setDVDNav:[NSUserDefaults.standardUserDefaults boolForKey:HBUseDvdNav]]; [_proxy setUpWithLogLevel:level name:name]; } return self; diff --git a/macosx/HandBrakeXPCService/HBRemoteCoreProtocol.h b/macosx/HandBrakeXPCService/HBRemoteCoreProtocol.h index 5fd0805e0..e55d1ee04 100644 --- a/macosx/HandBrakeXPCService/HBRemoteCoreProtocol.h +++ b/macosx/HandBrakeXPCService/HBRemoteCoreProtocol.h @@ -8,6 +8,8 @@ @protocol HBRemoteCoreProtocol +- (void)setDVDNav:(BOOL)enabled; + - (void)setUpWithLogLevel:(NSInteger)level name:(NSString *)name; - (void)tearDown; diff --git a/macosx/HandBrakeXPCService/HandBrakeXPCService.m b/macosx/HandBrakeXPCService/HandBrakeXPCService.m index ffd910b55..7570f5fce 100644 --- a/macosx/HandBrakeXPCService/HandBrakeXPCService.m +++ b/macosx/HandBrakeXPCService/HandBrakeXPCService.m @@ -44,6 +44,13 @@ static void *HandBrakeXPCServiceContext = &HandBrakeXPCServiceContext; return self; } +- (void)setDVDNav:(BOOL)enabled +{ + dispatch_sync(_queue, ^{ + [HBCore setDVDNav:enabled]; + }); +} + - (void)setUpWithLogLevel:(NSInteger)level name:(NSString *)name { [HBCore initGlobal]; |