diff options
author | Damiano Galassi <[email protected]> | 2018-11-03 14:22:40 +0100 |
---|---|---|
committer | Damiano Galassi <[email protected]> | 2018-11-03 14:22:40 +0100 |
commit | 31fed77146181737c5c528532a9cf49aab712f8a (patch) | |
tree | 2fdaca344b6ab1583faf42ce60fcfbcb653f4d2f | |
parent | 590452174392f323adbaf57aa359aa2cc30ecaab (diff) |
MacGui: more safe kvo removal, use libhb function to get the quaility name, fix some buttons enable state in Video.xib.
-rw-r--r-- | macosx/Base.lproj/Video.xib | 24 | ||||
-rw-r--r-- | macosx/HBSummaryViewController.m | 26 | ||||
-rw-r--r-- | macosx/HBVideo+UIAdditions.m | 15 |
3 files changed, 36 insertions, 29 deletions
diff --git a/macosx/Base.lproj/Video.xib b/macosx/Base.lproj/Video.xib index f216a228c..8f69b26bb 100644 --- a/macosx/Base.lproj/Video.xib +++ b/macosx/Base.lproj/Video.xib @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.30.1" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <dependencies> <deployment identifier="macosx"/> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.30.1"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> @@ -289,6 +289,11 @@ x264 is lossless at RF 0.</string> <font key="font" metaFont="smallSystem"/> </buttonCell> <connections> + <binding destination="-2" name="enabled" keyPath="self.video" id="Ewd-OO-T3Z"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <binding destination="-2" name="value" keyPath="self.video.qualityType" id="X1H-PE-sRI"/> </connections> </button> @@ -299,6 +304,11 @@ x264 is lossless at RF 0.</string> <font key="font" metaFont="smallSystem"/> </buttonCell> <connections> + <binding destination="-2" name="enabled" keyPath="self.video" id="Lf0-yc-zAF"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <binding destination="-2" name="value" keyPath="self.video.qualityType" id="SE7-YP-gRu"> <dictionary key="options"> <string key="NSValueTransformerName">NSNegateBoolean</string> @@ -313,6 +323,11 @@ x264 is lossless at RF 0.</string> <font key="font" metaFont="smallSystem"/> </buttonCell> <connections> + <binding destination="-2" name="enabled" keyPath="self.video" id="CRn-MS-g4d"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <binding destination="-2" name="value" keyPath="self.video.frameRateMode" id="Jy2-df-VQy"> <dictionary key="options"> <string key="NSValueTransformerName">NSNegateBoolean</string> @@ -327,6 +342,11 @@ x264 is lossless at RF 0.</string> <font key="font" metaFont="smallSystem"/> </buttonCell> <connections> + <binding destination="-2" name="enabled" keyPath="self.video" id="pSp-Yq-ng6"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <binding destination="-2" name="value" keyPath="self.video.frameRateMode" id="aEW-Di-Bkn"/> </connections> </button> diff --git a/macosx/HBSummaryViewController.m b/macosx/HBSummaryViewController.m index 443767725..21128a38c 100644 --- a/macosx/HBSummaryViewController.m +++ b/macosx/HBSummaryViewController.m @@ -154,8 +154,8 @@ static void *HBSummaryViewControllerSubsContext = &HBSummaryViewControllerSubsCo { for (HBAudioTrack *track in tracks) { - [track removeObserver:self forKeyPath:@"encoder"]; - [track removeObserver:self forKeyPath:@"mixdown"]; + [track removeObserver:self forKeyPath:@"encoder" context:HBSummaryViewControllerAudioContext]; + [track removeObserver:self forKeyPath:@"mixdown" context:HBSummaryViewControllerAudioContext]; } } @@ -171,7 +171,7 @@ static void *HBSummaryViewControllerSubsContext = &HBSummaryViewControllerSubsCo { for (HBSubtitlesTrack *track in tracks) { - [track removeObserver:self forKeyPath:@"burnedIn"]; + [track removeObserver:self forKeyPath:@"burnedIn" context:HBSummaryViewControllerSubsContext]; } } @@ -205,16 +205,16 @@ static void *HBSummaryViewControllerSubsContext = &HBSummaryViewControllerSubsCo [[NSNotificationCenter defaultCenter] removeObserver:self name:HBPictureChangedNotification object:_job.picture]; [[NSNotificationCenter defaultCenter] removeObserver:self name:HBFiltersChangedNotification object:_job.filters]; - [_job removeObserver:self forKeyPath:@"container"]; - [_job removeObserver:self forKeyPath:@"chaptersEnabled"]; - [_job removeObserver:self forKeyPath:@"video.encoder"]; - [_job removeObserver:self forKeyPath:@"video.frameRate"]; - [_job removeObserver:self forKeyPath:@"video.frameRateMode"]; - [_job removeObserver:self forKeyPath:@"filters.deinterlace"]; - [_job removeObserver:self forKeyPath:@"filters.rotate"]; - [_job removeObserver:self forKeyPath:@"filters.flip"]; - [_job removeObserver:self forKeyPath:@"audio.tracks"]; - [_job removeObserver:self forKeyPath:@"subtitles.tracks"]; + [_job removeObserver:self forKeyPath:@"container" context:HBSummaryViewControllerContainerContext]; + [_job removeObserver:self forKeyPath:@"chaptersEnabled" context:HBSummaryViewControllerVideoContext]; + [_job removeObserver:self forKeyPath:@"video.encoder" context:HBSummaryViewControllerVideoContext]; + [_job removeObserver:self forKeyPath:@"video.frameRate" context:HBSummaryViewControllerVideoContext]; + [_job removeObserver:self forKeyPath:@"video.frameRateMode" context:HBSummaryViewControllerVideoContext]; + [_job removeObserver:self forKeyPath:@"filters.deinterlace" context:HBSummaryViewControllerFiltersContext]; + [_job removeObserver:self forKeyPath:@"filters.rotate" context:HBSummaryViewControllerFiltersContext]; + [_job removeObserver:self forKeyPath:@"filters.flip" context:HBSummaryViewControllerFiltersContext]; + [_job removeObserver:self forKeyPath:@"audio.tracks" context:HBSummaryViewControllerAudioContext]; + [_job removeObserver:self forKeyPath:@"subtitles.tracks" context:HBSummaryViewControllerSubsContext]; [self removeAudioTracksObservers:_job.audio.tracks]; [self removeSubtitlesTracksObservers:_job.subtitles.tracks]; diff --git a/macosx/HBVideo+UIAdditions.m b/macosx/HBVideo+UIAdditions.m index f330e3526..e23c1ab72 100644 --- a/macosx/HBVideo+UIAdditions.m +++ b/macosx/HBVideo+UIAdditions.m @@ -111,20 +111,7 @@ - (NSString *)constantQualityLabel { - if ((self.encoder & HB_VCODEC_X264_MASK) || - (self.encoder & HB_VCODEC_X265_MASK)) - { - return @"RF:"; - } - else if (self.encoder == HB_VCODEC_FFMPEG_VP8 || - self.encoder == HB_VCODEC_FFMPEG_VP9) - { - return @"CQ:"; - } - else - { - return @"QP:"; - } + return @(hb_video_quality_get_name(self.encoder)); } + (NSSet<NSString *> *)keyPathsForValuesAffectingUnparseOptions |