diff options
author | ritsuka <[email protected]> | 2014-12-27 12:29:00 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2014-12-27 12:29:00 +0000 |
commit | 7f6ec5084e21a88d662fa453be6186724658bc9b (patch) | |
tree | 58f56dd5274c218b7d22b7f9a6152aef6ece94df /macosx | |
parent | 25d0cf9b7f554c3899ce0173f5a29a6092ad7cd7 (diff) |
MacGui: remove redundant "enabled" property in a few view controller. Cosmetics in HBController.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6660 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/Controller.h | 10 | ||||
-rw-r--r-- | macosx/Controller.m | 73 | ||||
-rw-r--r-- | macosx/English.lproj/Audio.xib | 32 | ||||
-rw-r--r-- | macosx/English.lproj/Subtitles.xib | 33 | ||||
-rw-r--r-- | macosx/English.lproj/Video.xib | 60 | ||||
-rw-r--r-- | macosx/HBAudioController.h | 3 | ||||
-rw-r--r-- | macosx/HBAudioController.m | 14 | ||||
-rw-r--r-- | macosx/HBSubtitlesController.h | 3 | ||||
-rw-r--r-- | macosx/HBSubtitlesController.m | 18 | ||||
-rw-r--r-- | macosx/HBVideoController.h | 5 | ||||
-rw-r--r-- | macosx/HBVideoController.m | 14 |
11 files changed, 154 insertions, 111 deletions
diff --git a/macosx/Controller.h b/macosx/Controller.h index 8fdbdb155..c8292fcda 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -25,7 +25,7 @@ @class HBPresetsManager; @class HBDockTile; -@interface HBController : NSObject <NSApplicationDelegate, GrowlApplicationBridgeDelegate, HBPictureControllerDelegate, NSDrawerDelegate> +@interface HBController : NSObject <NSApplicationDelegate, NSDrawerDelegate, GrowlApplicationBridgeDelegate> { IBOutlet NSWindow * fWindow; @@ -196,8 +196,7 @@ - (void) processNewQueueEncode; - (void) clearQueueEncodedItems; /* Queue Editing */ -- (IBAction)rescanQueueItemToMainWindow:(NSUInteger) selectedQueueItem; - +- (void)rescanQueueItemToMainWindow:(NSUInteger) selectedQueueItem; - (void) removeQueueFileItem:(NSUInteger) queueItemToRemove; - (void) clearQueueAllItems; @@ -235,11 +234,6 @@ - (IBAction) showAddPresetPanel: (id) sender; - (IBAction)selectDefaultPreset:(id)sender; - (IBAction)addFactoryPresets:(id)sender; - --(void)sendToMetaX:(NSString *) filePath; -// Growl methods -- (NSDictionary *) registrationDictionaryForGrowl; --(void)showGrowlDoneNotification:(NSString *) filePath; - (IBAction)showDebugOutputPanel:(id)sender; - (void) remindUserOfSleepOrShutdown; diff --git a/macosx/Controller.m b/macosx/Controller.m index 9aa015781..a31a522a1 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -25,7 +25,7 @@ // DockTile update freqency in total percent increment #define dockTileUpdateFrequency 0.1f -@interface HBController () <HBPresetsViewControllerDelegate, HBPreviewControllerDelegate> +@interface HBController () <HBPresetsViewControllerDelegate, HBPreviewControllerDelegate, HBPictureControllerDelegate> @property (nonatomic, copy) NSString *browsedSourceDisplayName; @@ -680,9 +680,6 @@ } fPresetsView.enabled = b; - fVideoController.enabled = b; - fAudioController.enabled = b; - fSubtitlesViewController.enabled = b; } /** @@ -949,10 +946,8 @@ // to determine if we should check for encode done notifications. if (fEncodeState != 2) { - NSString *pathOfFinishedEncode; // Get the output file name for the finished encode HBJob *finishedJob = QueueFileArray[currentQueueEncodeIndex]; - pathOfFinishedEncode = finishedJob.destURL.path; // Both the Growl Alert and Sending to tagger can be done as encodes roll off the queue if ([[[NSUserDefaults standardUserDefaults] stringForKey:@"AlertWhenDone"] isEqualToString: @"Growl Notification"] || @@ -963,11 +958,11 @@ { NSBeep(); } - [self showGrowlDoneNotification:pathOfFinishedEncode]; + [self showGrowlDoneNotification:finishedJob.destURL]; } // Send to tagger - [self sendToMetaX:pathOfFinishedEncode]; + [self sendToExternalApp:finishedJob.destURL]; // since we have successfully completed an encode, we increment the queue counter [self incrementQueueItemDone:currentQueueEncodeIndex]; @@ -1173,50 +1168,46 @@ #pragma mark - #pragma mark Encode Done Actions -// register a test notification and make -// it enabled by default + #define SERVICE_NAME @"Encode Done" + +/** + * Register a test notification and make + * it enabled by default + */ - (NSDictionary *)registrationDictionaryForGrowl { - NSDictionary *registrationDictionary = [NSDictionary dictionaryWithObjectsAndKeys: - [NSArray arrayWithObjects:SERVICE_NAME,nil], GROWL_NOTIFICATIONS_ALL, - [NSArray arrayWithObjects:SERVICE_NAME,nil], GROWL_NOTIFICATIONS_DEFAULT, - nil]; - - return registrationDictionary; -} - --(void)showGrowlDoneNotification:(NSString *) filePath -{ - /* This end of encode action is called as each encode rolls off of the queue */ - /* Setup the Growl stuff */ - NSString * finishedEncode = filePath; - /* strip off the path to just show the file name */ - finishedEncode = [finishedEncode lastPathComponent]; - NSString * growlMssg = [NSString stringWithFormat: @"your HandBrake encode %@ is done!",finishedEncode]; - [GrowlApplicationBridge - notifyWithTitle:@"Put down that cocktail…" - description:growlMssg - notificationName:SERVICE_NAME - iconData:nil - priority:0 - isSticky:1 - clickContext:nil]; -} --(void)sendToMetaX:(NSString *) filePath -{ - /* This end of encode action is called as each encode rolls off of the queue */ + return @{GROWL_NOTIFICATIONS_ALL: @[SERVICE_NAME], + GROWL_NOTIFICATIONS_DEFAULT: @[SERVICE_NAME]}; +} + +- (void)showGrowlDoneNotification:(NSURL *)fileURL +{ + // This end of encode action is called as each encode rolls off of the queue + // Setup the Growl stuff + NSString *growlMssg = [NSString stringWithFormat:@"your HandBrake encode %@ is done!", fileURL.lastPathComponent]; + [GrowlApplicationBridge notifyWithTitle:@"Put down that cocktail…" + description:growlMssg + notificationName:SERVICE_NAME + iconData:nil + priority:0 + isSticky:1 + clickContext:nil]; +} + +- (void)sendToExternalApp:(NSURL *)fileURL +{ + // This end of encode action is called as each encode rolls off of the queue if([[NSUserDefaults standardUserDefaults] boolForKey: @"sendToMetaX"] == YES) { - NSString *sendToApp = [[NSUserDefaults standardUserDefaults] objectForKey: @"SendCompletedEncodeToApp"]; + NSString *sendToApp = [[NSUserDefaults standardUserDefaults] objectForKey:@"SendCompletedEncodeToApp"]; if (![sendToApp isEqualToString:@"None"]) { [HBUtilities writeToActivityLog: "trying to send encode to: %s", [sendToApp UTF8String]]; - NSAppleScript *myScript = [[NSAppleScript alloc] initWithSource: [NSString stringWithFormat: @"%@%@%@%@%@", @"tell application \"",sendToApp,@"\" to open (POSIX file \"", filePath, @"\")"]]; + NSAppleScript *myScript = [[NSAppleScript alloc] initWithSource: [NSString stringWithFormat: @"%@%@%@%@%@", @"tell application \"",sendToApp,@"\" to open (POSIX file \"", fileURL.path, @"\")"]]; [myScript executeAndReturnError: nil]; [myScript release]; } - } } diff --git a/macosx/English.lproj/Audio.xib b/macosx/English.lproj/Audio.xib index 51e62d99e..6c3d5cb86 100644 --- a/macosx/English.lproj/Audio.xib +++ b/macosx/English.lproj/Audio.xib @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="14A329r" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6254" systemVersion="14C81f" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> - <deployment version="1060" defaultVersion="1060" identifier="macosx"/> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/> + <deployment version="1060" identifier="macosx"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6254"/> </dependencies> <objects> <customObject id="-2" userLabel="File's Owner" customClass="HBAudioController"> @@ -15,7 +15,7 @@ </connections> </customObject> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> - <customObject id="-3" userLabel="Application"/> + <customObject id="-3" userLabel="Application" customClass="NSObject"/> <arrayController id="iWY-gv-3ab" userLabel="Audio Inputs"> <declaredKeys> <string>keyAudioTrackName</string> @@ -66,7 +66,7 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" columnReordering="NO" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="25" headerView="GLD-lI-qeh" id="LlC-ua-mth"> - <rect key="frame" x="0.0" y="0.0" width="884" height="248"/> + <rect key="frame" x="0.0" y="0.0" width="884" height="27"/> <autoresizingMask key="autoresizingMask"/> <size key="intercellSpacing" width="3" height="2"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> @@ -273,6 +273,11 @@ </tableColumn> </tableColumns> <connections> + <binding destination="-2" name="enabled" keyPath="self.job" id="FGZ-gP-H5Y"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <outlet property="menu" destination="hyy-qd-qpe" id="e5W-aS-mPB"/> </connections> </tableView> @@ -301,6 +306,11 @@ </buttonCell> <connections> <action selector="showSettingsSheet:" target="-2" id="D9K-M3-zHd"/> + <binding destination="-2" name="enabled" keyPath="self.job" id="VMC-Xv-X3R"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> </connections> </button> <button verticalHuggingPriority="750" id="wcL-rL-aYS"> @@ -312,6 +322,11 @@ </buttonCell> <connections> <action selector="reloadDefaults:" target="-2" id="k9I-I9-T2U"/> + <binding destination="-2" name="enabled" keyPath="self.job" id="rta-fa-Ezd"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> </connections> </button> <popUpButton verticalHuggingPriority="750" id="jrP-M5-2Rq"> @@ -337,6 +352,13 @@ </items> </menu> </popUpButtonCell> + <connections> + <binding destination="-2" name="enabled" keyPath="self.job" id="FGP-3D-g2t"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> + </connections> </popUpButton> </subviews> </view> diff --git a/macosx/English.lproj/Subtitles.xib b/macosx/English.lproj/Subtitles.xib index ee41c8524..9d971f5ba 100644 --- a/macosx/English.lproj/Subtitles.xib +++ b/macosx/English.lproj/Subtitles.xib @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F14" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6254" systemVersion="14C81f" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> - <deployment version="1060" defaultVersion="1060" identifier="macosx"/> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/> + <deployment version="1060" identifier="macosx"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6254"/> </dependencies> <objects> <customObject id="-2" userLabel="File's Owner" customClass="HBSubtitlesController"> @@ -15,7 +15,7 @@ </connections> </customObject> <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> - <customObject id="-3" userLabel="Application"/> + <customObject id="-3" userLabel="Application" customClass="NSObject"/> <customView id="Hz6-mo-xeY"> <rect key="frame" x="0.0" y="0.0" width="926" height="322"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> @@ -28,7 +28,7 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" columnReordering="NO" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="25" headerView="IiW-3a-Drv" id="0yM-wE-D2x"> - <rect key="frame" x="0.0" y="0.0" width="884" height="248"/> + <rect key="frame" x="0.0" y="0.0" width="884" height="27"/> <autoresizingMask key="autoresizingMask"/> <size key="intercellSpacing" width="3" height="2"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> @@ -133,6 +133,11 @@ </tableColumn> </tableColumns> <connections> + <binding destination="-2" name="enabled" keyPath="self.job" id="PJP-qc-FJe"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <outlet property="dataSource" destination="-2" id="DH5-v0-2ba"/> <outlet property="delegate" destination="-2" id="Dfm-tw-89m"/> <outlet property="menu" destination="KgC-dn-Hq2" id="Iff-7t-kdg"/> @@ -146,7 +151,6 @@ <autoresizingMask key="autoresizingMask"/> </scroller> <scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="GfM-TU-Tmr"> - <rect key="frame" x="-15" y="17" width="16" height="0.0"/> <autoresizingMask key="autoresizingMask"/> </scroller> <tableHeaderView key="headerView" id="IiW-3a-Drv"> @@ -182,6 +186,13 @@ </items> </menu> </popUpButtonCell> + <connections> + <binding destination="-2" name="enabled" keyPath="self.job" id="FLd-lw-rWb"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> + </connections> </popUpButton> <button verticalHuggingPriority="750" id="QsM-28-Pya"> <rect key="frame" x="110" y="288" width="140" height="28"/> @@ -192,6 +203,11 @@ </buttonCell> <connections> <action selector="showSettingsSheet:" target="-2" id="OAA-S8-tfS"/> + <binding destination="-2" name="enabled" keyPath="self.job" id="Nuv-KK-HdK"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> </connections> </button> <button verticalHuggingPriority="750" id="Vxx-gk-9kY"> @@ -203,6 +219,11 @@ </buttonCell> <connections> <action selector="addTracksFromDefaults:" target="-2" id="GOz-FT-Atg"/> + <binding destination="-2" name="enabled" keyPath="self.job" id="Mxg-ln-sW9"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> </connections> </button> </subviews> diff --git a/macosx/English.lproj/Video.xib b/macosx/English.lproj/Video.xib index 3ef74c34f..06c9a60b1 100644 --- a/macosx/English.lproj/Video.xib +++ b/macosx/English.lproj/Video.xib @@ -48,12 +48,13 @@ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/> </textFieldCell> <connections> - <binding destination="-2" name="enabled2" keyPath="self.enabled" previousBinding="mjs-X8-KV8" id="Gpe-Tm-7wn"> + <binding destination="-2" name="enabled2" keyPath="self.video" previousBinding="mjs-X8-KV8" id="VTs-xH-tZg"> <dictionary key="options"> <integer key="NSMultipleValuesPlaceholder" value="-1"/> <integer key="NSNoSelectionPlaceholder" value="-1"/> <integer key="NSNotApplicablePlaceholder" value="-1"/> <integer key="NSNullPlaceholder" value="-1"/> + <string key="NSValueTransformerName">NSIsNotNil</string> </dictionary> </binding> <binding destination="-2" name="value" keyPath="self.video.avgBitrate" id="7eN-5J-5WV"/> @@ -115,7 +116,11 @@ </menu> </popUpButtonCell> <connections> - <binding destination="-2" name="enabled" keyPath="self.enabled" id="mpI-26-Ajl"/> + <binding destination="-2" name="enabled" keyPath="self.video" id="yN5-l3-JRJ"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <binding destination="-2" name="selectedValue" keyPath="self.video.frameRate" previousBinding="Heu-SS-Uwq" id="XC7-GV-Uae"> <dictionary key="options"> <bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/> @@ -133,12 +138,13 @@ <font key="font" metaFont="smallSystem"/> </buttonCell> <connections> - <binding destination="-2" name="enabled2" keyPath="self.enabled" previousBinding="7aV-7j-MzB" id="GSP-bg-aKw"> + <binding destination="-2" name="enabled2" keyPath="self.video" previousBinding="7aV-7j-MzB" id="c4g-dz-q05"> <dictionary key="options"> <integer key="NSMultipleValuesPlaceholder" value="-1"/> <integer key="NSNoSelectionPlaceholder" value="-1"/> <integer key="NSNotApplicablePlaceholder" value="-1"/> <integer key="NSNullPlaceholder" value="-1"/> + <string key="NSValueTransformerName">NSIsNotNil</string> </dictionary> </binding> <binding destination="-2" name="enabled" keyPath="self.video.qualityType" id="7aV-7j-MzB"> @@ -157,25 +163,26 @@ <font key="font" metaFont="smallSystem"/> </buttonCell> <connections> - <binding destination="-2" name="enabled2" keyPath="self.enabled" previousBinding="iZE-er-OQN" id="DQs-Z1-77T"> + <binding destination="-2" name="enabled2" keyPath="self.video" previousBinding="iZE-er-OQN" id="Fbv-qd-JTg"> <dictionary key="options"> <integer key="NSMultipleValuesPlaceholder" value="-1"/> <integer key="NSNoSelectionPlaceholder" value="-1"/> <integer key="NSNotApplicablePlaceholder" value="-1"/> <integer key="NSNullPlaceholder" value="-1"/> + <string key="NSValueTransformerName">NSIsNotNil</string> </dictionary> </binding> - <binding destination="-2" name="enabled" keyPath="self.video.qualityType" id="iZE-er-OQN"> + <binding destination="-2" name="hidden" keyPath="self.video.twoPass" previousBinding="Fbv-qd-JTg" id="jpH-IH-e0p"> <dictionary key="options"> <string key="NSValueTransformerName">NSNegateBoolean</string> </dictionary> </binding> - <binding destination="-2" name="value" keyPath="self.video.turboTwoPass" id="4A4-hg-qhy"/> - <binding destination="-2" name="hidden" keyPath="self.video.twoPass" previousBinding="DQs-Z1-77T" id="sfq-sw-XJu"> + <binding destination="-2" name="enabled" keyPath="self.video.qualityType" id="iZE-er-OQN"> <dictionary key="options"> <string key="NSValueTransformerName">NSNegateBoolean</string> </dictionary> </binding> + <binding destination="-2" name="value" keyPath="self.video.turboTwoPass" id="4A4-hg-qhy"/> </connections> </button> <popUpButton verticalHuggingPriority="750" id="xwK-Yu-a1e"> @@ -191,7 +198,11 @@ </menu> </popUpButtonCell> <connections> - <binding destination="-2" name="enabled" keyPath="self.enabled" id="kKW-qz-38E"/> + <binding destination="-2" name="enabled" keyPath="self.video" id="Dhc-7W-mCB"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <binding destination="-2" name="selectedValue" keyPath="self.video.encoder" previousBinding="PbS-nr-Hjk" id="h1y-Vg-Gyg"> <dictionary key="options"> <bool key="NSAllowsEditingMultipleValuesSelection" value="NO"/> @@ -248,7 +259,11 @@ </column> </cells> <connections> - <binding destination="-2" name="enabled" keyPath="self.enabled" id="RaB-VA-rgV"/> + <binding destination="-2" name="enabled" keyPath="self.video" id="Bhn-TM-mbV"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <binding destination="-2" name="selectedTag" keyPath="self.video.qualityType" id="Bpj-MC-Zf7"/> </connections> </matrix> @@ -275,7 +290,11 @@ </column> </cells> <connections> - <binding destination="-2" name="enabled" keyPath="self.enabled" id="7Cn-NH-MAP"/> + <binding destination="-2" name="enabled" keyPath="self.video" id="RUB-wC-Q0A"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <binding destination="-2" name="selectedIndex" keyPath="self.video.frameRateMode" id="tJr-26-Y2P"/> </connections> </matrix> @@ -296,12 +315,13 @@ <font key="font" metaFont="miniSystem"/> </sliderCell> <connections> - <binding destination="-2" name="enabled2" keyPath="self.enabled" previousBinding="wCA-ag-GHJ" id="EOE-Cw-D0K"> + <binding destination="-2" name="enabled2" keyPath="self.video" previousBinding="wCA-ag-GHJ" id="ywk-WQ-GNY"> <dictionary key="options"> <integer key="NSMultipleValuesPlaceholder" value="-1"/> <integer key="NSNoSelectionPlaceholder" value="-1"/> <integer key="NSNotApplicablePlaceholder" value="-1"/> <integer key="NSNullPlaceholder" value="-1"/> + <string key="NSValueTransformerName">NSIsNotNil</string> </dictionary> </binding> <binding destination="-2" name="value" keyPath="self.video.quality" previousBinding="nAO-gB-Jbd" id="C3d-pR-fJ2"> @@ -342,8 +362,12 @@ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> <connections> + <binding destination="-2" name="enabled" keyPath="self.video" id="Ph9-Gy-Sru"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <binding destination="-2" name="value" keyPath="pictureSettings" id="hem-VY-3fR"/> - <binding destination="-2" name="enabled" keyPath="self.enabled" id="uv0-Gi-gXH"/> <binding destination="-2" name="textColor" keyPath="self.labelColor" id="aVY-g8-jGq"/> </connections> </textField> @@ -356,8 +380,12 @@ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> </textFieldCell> <connections> + <binding destination="-2" name="enabled" keyPath="self.video" id="ckY-jh-UvA"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <binding destination="-2" name="value" keyPath="pictureFilters" id="Sr7-JI-M4y"/> - <binding destination="-2" name="enabled" keyPath="self.enabled" id="Joa-BW-Ekr"/> <binding destination="-2" name="textColor" keyPath="self.labelColor" id="FtS-pM-hKz"/> </connections> </textField> @@ -552,7 +580,11 @@ Set this if your device is struggling to play the output (dropped frames).</stri <font key="font" metaFont="smallSystem"/> </buttonCell> <connections> - <binding destination="-2" name="enabled" keyPath="self.enabled" id="eDg-nl-sf5"/> + <binding destination="-2" name="enabled" keyPath="self.video" id="GDV-uX-eAs"> + <dictionary key="options"> + <string key="NSValueTransformerName">NSIsNotNil</string> + </dictionary> + </binding> <binding destination="-2" name="value" keyPath="self.video.advancedOptions" id="sQg-ab-NdN"/> </connections> </button> diff --git a/macosx/HBAudioController.h b/macosx/HBAudioController.h index 2476bdfbb..775c6f32b 100644 --- a/macosx/HBAudioController.h +++ b/macosx/HBAudioController.h @@ -6,7 +6,6 @@ // #import <Cocoa/Cocoa.h> -#import "HBViewValidation.h" extern NSString *keyAudioTrackIndex; extern NSString *keyAudioTrackName; @@ -26,7 +25,7 @@ extern NSString *HBMixdownChangedNotification; * * Responds to HBContainerChangedNotification. */ -@interface HBAudioController : NSViewController <HBViewValidation> +@interface HBAudioController : NSViewController @property (nonatomic, readonly, retain) NSArray *masterTrackArray; @property (nonatomic, readonly) NSDictionary *noneTrack; diff --git a/macosx/HBAudioController.m b/macosx/HBAudioController.m index 0c1c49293..d657e773f 100644 --- a/macosx/HBAudioController.m +++ b/macosx/HBAudioController.m @@ -58,7 +58,6 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification"; @synthesize masterTrackArray; @synthesize noneTrack; @synthesize videoContainerTag; -@synthesize enabled = _enabled; - (instancetype)init { @@ -97,18 +96,9 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification"; [self switchingTrackFromNone:nil]; } -- (void)setEnabled:(BOOL)enabled -{ - _enabled = enabled; - [fTableView setEnabled:enabled]; - [self.trackPopup setEnabled:enabled]; - [self.configureDefaults setEnabled:enabled]; - [self.reloadDefaults setEnabled:enabled]; -} - - (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem { - return self.enabled; + return (self.job != nil); } #pragma mark - @@ -407,6 +397,7 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification"; if (job) { + _job = job; [audioArray release]; audioArray = [job.audioTracks retain]; self.settings = job.audioDefaults; @@ -431,6 +422,7 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification"; } else { + _job = nil; [audioArray release]; audioArray = nil; self.settings = nil; diff --git a/macosx/HBSubtitlesController.h b/macosx/HBSubtitlesController.h index 56fc0dcb8..1d681349e 100644 --- a/macosx/HBSubtitlesController.h +++ b/macosx/HBSubtitlesController.h @@ -5,7 +5,6 @@ It may be used under the terms of the GNU General Public License. */ #import <Cocoa/Cocoa.h> -#import "HBViewValidation.h" extern NSString *keySubTrackName; extern NSString *keySubTrackIndex; @@ -27,7 +26,7 @@ extern NSString *keySubTrackSrtCharCode; * HBSubtitlesController * Responds to HBContainerChangedNotification. */ -@interface HBSubtitlesController : NSViewController <HBViewValidation> +@interface HBSubtitlesController : NSViewController - (void)applySettingsFromPreset:(NSDictionary *)preset; diff --git a/macosx/HBSubtitlesController.m b/macosx/HBSubtitlesController.m index 590093f5a..5f836289c 100644 --- a/macosx/HBSubtitlesController.m +++ b/macosx/HBSubtitlesController.m @@ -68,8 +68,6 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex"; @implementation HBSubtitlesController -@synthesize enabled = _enabled; - - (instancetype)init { self = [super initWithNibName:@"Subtitles" bundle:nil]; @@ -93,15 +91,6 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex"; return self; } -- (void)setEnabled:(BOOL)enabled -{ - [self.trackPopUp setEnabled:enabled]; - [self.configureDefaults setEnabled:enabled]; - [self.reloadDefaults setEnabled:enabled]; - [self.fTableView setEnabled:enabled]; - _enabled = enabled; -} - - (void)setJob:(HBJob *)job { /* reset the subtitles arrays */ @@ -111,6 +100,7 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex"; if (job) { + _job = job; self.subtitleArray = job.subtitlesTracks; self.settings = job.subtitlesDefaults; self.subtitleSourceArray = [[job.title.subtitlesTracks mutableCopy] autorelease]; @@ -172,6 +162,10 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex"; // to display a "None" row in the table view [self.subtitleArray addObject:[self createSubtitleTrack]]; } + else + { + _job = nil; + } [self.fTableView reloadData]; } @@ -195,7 +189,7 @@ NSString *keySubTrackLanguageIndex = @"keySubTrackLanguageIndex"; - (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem { - return self.enabled; + return (self.job != nil); } /** diff --git a/macosx/HBVideoController.h b/macosx/HBVideoController.h index 3289b58ee..c0c572fa6 100644 --- a/macosx/HBVideoController.h +++ b/macosx/HBVideoController.h @@ -5,7 +5,6 @@ It may be used under the terms of the GNU General Public License. */ #import <Cocoa/Cocoa.h> -#import "HBViewValidation.h" @class HBController; @class HBAdvancedController; @@ -15,7 +14,7 @@ /** * HBVideoController */ -@interface HBVideoController : NSViewController <HBViewValidation> +@interface HBVideoController : NSViewController - (instancetype)initWithAdvancedController:(HBAdvancedController *)advancedController; @@ -25,6 +24,6 @@ @property (nonatomic, copy, readwrite) NSString *pictureSettings; @property (nonatomic, copy, readwrite) NSString *pictureFilters; -@property (nonatomic, readwrite, retain) HBVideo *video; +@property (nonatomic, readwrite, assign) HBVideo *video; @end diff --git a/macosx/HBVideoController.m b/macosx/HBVideoController.m index fa0bb192e..95a956bda 100644 --- a/macosx/HBVideoController.m +++ b/macosx/HBVideoController.m @@ -45,8 +45,6 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; @implementation HBVideoController -@synthesize enabled = _enabled; - - (instancetype)initWithAdvancedController:(HBAdvancedController *)advancedController { self = [self init]; @@ -62,6 +60,8 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; self = [super initWithNibName:@"Video" bundle:nil]; if (self) { + _labelColor = [[NSColor disabledControlTextColor] retain]; + // Observe the advanced tab pref shown/hided state. [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self forKeyPath:@"values.HBShowAdvancedTab" @@ -84,11 +84,11 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; return self; } -- (void)setEnabled:(BOOL)flag +- (void)setVideo:(HBVideo *)video { - _enabled = flag; + _video = video; - if (_enabled) + if (_video) { self.labelColor = [NSColor controlTextColor]; } @@ -97,7 +97,7 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; self.labelColor = [NSColor disabledControlTextColor]; } - [self enableEncoderOptionsWidgets:flag]; + [self enableEncoderOptionsWidgets:(video != nil)]; } #pragma mark - KVO @@ -151,7 +151,7 @@ static void *HBVideoControllerContext = &HBVideoControllerContext; } } // enable/disable, populate and update the various widgets - [self enableEncoderOptionsWidgets:self.enabled]; + [self enableEncoderOptionsWidgets:(self.video != nil)]; } else if ([keyPath isEqualToString:@"values.HBShowAdvancedTab"]) { |