]> granicus.if.org Git - handbrake/commitdiff
MacGui: hide the “Use advanced options panel” checkbox too when the advanced panel...
authorritsuka <damiog@gmail.com>
Wed, 17 Sep 2014 15:29:53 +0000 (15:29 +0000)
committerritsuka <damiog@gmail.com>
Wed, 17 Sep 2014 15:29:53 +0000 (15:29 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6411 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/English.lproj/Video.xib
macosx/HBVideoController.m

index 3e888854301f998d419d81add6945ffa50e54dc9..f3f5945ff839491aafa4f5702c3d0440f6a35588 100644 (file)
@@ -1,5 +1,5 @@
 <?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="5056" systemVersion="14A361c" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
     <dependencies>
         <deployment version="1060" defaultVersion="1060" identifier="macosx"/>
         <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
@@ -10,6 +10,7 @@
                 <outlet property="fDisplayPresetsAdditonalOptionsLabel" destination="ijg-ux-uvb" id="Zhw-D7-xOs"/>
                 <outlet property="fDisplayPresetsAdditonalOptionsTextField" destination="oJk-ur-wgc" id="TUr-Lt-UHQ"/>
                 <outlet property="fDisplayX264PresetsUnparseTextField" destination="wk1-2U-z4i" id="aIk-h1-bOP"/>
+                <outlet property="fDividerLine" destination="g5v-MD-kdo" id="jZS-ae-kGM"/>
                 <outlet property="fEncoderOptionsLabel" destination="mkM-81-g3d" id="eWq-95-kTO"/>
                 <outlet property="fFastDecodeCheck" destination="z7F-H2-Vfr" id="usU-aE-DUt"/>
                 <outlet property="fFramerateCfrCell" destination="ZRE-Ig-mhJ" id="vqQ-Pd-63o"/>
                     </cells>
                 </matrix>
                 <box autoresizesSubviews="NO" title="x264 Presets" borderType="none" titlePosition="noTitle" id="A4U-3F-pYq">
-                    <rect key="frame" x="0.0" y="56" width="923" height="134"/>
+                    <rect key="frame" x="0.0" y="63" width="923" height="134"/>
                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
                     <view key="contentView">
                         <rect key="frame" x="0.0" y="0.0" width="923" height="134"/>
                     <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
                     <font key="titleFont" metaFont="system"/>
                 </box>
-                <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="NtL-8e-tS7">
-                    <rect key="frame" x="20" y="198" width="880" height="5"/>
-                    <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
-                    <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
-                    <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
-                    <font key="titleFont" metaFont="system"/>
-                </box>
             </subviews>
         </view>
         <customView id="2dX-Hf-Hxl" userLabel="x264/x264 presets view">
@@ -447,7 +441,7 @@ Set this if your device is struggling to play the output (dropped frames).</stri
                     </textFieldCell>
                 </textField>
                 <textField verticalHuggingPriority="750" id="mkM-81-g3d">
-                    <rect key="frame" x="18" y="120" width="96" height="14"/>
+                    <rect key="frame" x="-2" y="120" width="116" height="14"/>
                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                     <textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Encoder Options:" id="XIe-8Z-tIF">
                         <font key="font" metaFont="smallSystem"/>
@@ -455,6 +449,13 @@ Set this if your device is struggling to play the output (dropped frames).</stri
                         <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                     </textFieldCell>
                 </textField>
+                <box appearanceType="aqua" verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="g5v-MD-kdo">
+                    <rect key="frame" x="120" y="124" width="780" height="5"/>
+                    <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
+                    <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
+                    <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+                    <font key="titleFont" metaFont="system"/>
+                </box>
             </subviews>
         </customView>
         <customView id="aRi-vN-oR0" userLabel="ffmpeg presets view">
index 8545eb6c3a997999f0c53db8d030486b2645b990..ab7c0edfe2557bccdc1b9d28e140f9db733893cd 100644 (file)
@@ -55,6 +55,7 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio
     NSArray                      * fPresetNames;
     NSUInteger                     fMediumPresetIndex;
     IBOutlet NSButton            * fX264UseAdvancedOptionsCheck;
+    IBOutlet NSBox               * fDividerLine;
     IBOutlet NSBox               * fPresetsBox;
     IBOutlet NSSlider            * fPresetsSlider;
     IBOutlet NSTextField         * fPresetSliderLabel;
@@ -127,6 +128,12 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio
         /* register that we are interested in changes made to the video container */
         [center addObserver:self selector: @selector(containerChanged:) name:HBContainerChangedNotification object:nil];
         [center addObserver:self selector: @selector(titleChanged:) name:HBTitleChangedNotification object:nil];
+
+        // Observe the andvanced tab preference.
+        [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self
+                                                                  forKeyPath:@"values.HBShowAdvancedTab"
+                                                                     options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial
+                                                                     context:NULL];
     }
 
     return self;
@@ -277,6 +284,37 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio
     [fVidRatePopUp selectItemAtIndex: 0];
 }
 
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+    if (context == NULL)
+    {
+        if ([keyPath isEqualToString:@"values.HBShowAdvancedTab"])
+        {
+            [self validateAdvancedOptionsCheckBoxForEncoder:self.codec];
+        }
+    }
+    else
+    {
+        [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
+    }
+}
+
+- (void)validateAdvancedOptionsCheckBoxForEncoder:(int)encoder
+{
+    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HBShowAdvancedTab"] && (encoder == HB_VCODEC_X264))
+    {
+        [fX264UseAdvancedOptionsCheck setHidden:NO];
+        [fDividerLine setHidden:YES];
+        [fEncoderOptionsLabel setStringValue:NSLocalizedString(@"Encoder Options:", @"")];
+    }
+    else
+    {
+        [fX264UseAdvancedOptionsCheck setHidden:YES];
+        [fDividerLine setHidden:NO];
+        [fEncoderOptionsLabel setStringValue:NSLocalizedString(@"Encoder Options", @"")];
+    }
+}
+
 #pragma mark - apply settings
 
 - (void)applyVideoSettingsFromQueue:(NSDictionary *)queueToApply
@@ -409,26 +447,37 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio
             }
             else
             {
-                [self.fAdvancedOptions setOptions:        @""];
-                [self             setOptionExtra:nil];
+                [self.fAdvancedOptions setOptions:@""];
+                [self setOptionExtra:nil];
             }
             /* preset does not use the x264 preset system, reset the widgets */
             [self setPreset: nil];
             [self setTune:   nil];
             [self setProfile:nil];
             [self setLevel:  nil];
+
             /* we enable the advanced panel and update the widgets */
-            [fX264UseAdvancedOptionsCheck setState:NSOnState];
+            if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HBShowAdvancedTab"])
+            {
+                [fX264UseAdvancedOptionsCheck setState:NSOnState];
+            }
+            else
+            {
+                [fX264UseAdvancedOptionsCheck setState:NSOffState];
+            }
             [self updateEncoderOptionsWidgets:nil];
         }
         else
         {
-            /*
-             * x264UseAdvancedOptions is set to 0 (disabled),
-             * so we use the x264 preset system
-             */
+            // x264UseAdvancedOptions is set to 0 (disabled),
+            // so we use the new preset system and
+            // disable the advanced panel
+            [self.fAdvancedOptions setOptions:@""];
+            [fX264UseAdvancedOptionsCheck setState:NSOffState];
+
             if (preset[@"x264Preset"])
             {
+                // Read the old x264 preset keys
                 [self setPreset:     preset[@"x264Preset"]];
                 [self setTune:       preset[@"x264Tune"]];
                 [self setOptionExtra:preset[@"x264OptionExtra"]];
@@ -437,16 +486,14 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio
             }
             else
             {
+                // Read the new preset keys (0.10)
                 [self setPreset:     preset[@"VideoPreset"]];
                 [self setTune:       preset[@"VideoTune"]];
                 [self setOptionExtra:preset[@"VideoOptionExtra"]];
                 [self setProfile:    preset[@"VideoProfile"]];
                 [self setLevel:      preset[@"VideoLevel"]];
             }
-            /* preset does not use the advanced panel, reset it */
-            [self.fAdvancedOptions setOptions:@""];
-            /* we disable the advanced panel and update the widgets */
-            [fX264UseAdvancedOptionsCheck setState:NSOffState];
+
             [self updateEncoderOptionsWidgets:nil];
         }
     }
@@ -1016,15 +1063,14 @@ NSString *HBVideoEncoderChangedNotification = @"HBVideoEncoderChangedNotificatio
 
 - (void) setupPresetsWidgetsForEncoder:(int)encoder
 {
+    [self validateAdvancedOptionsCheckBoxForEncoder:(int)encoder];
 
     if (encoder == HB_VCODEC_X264)
     {
-        [fX264UseAdvancedOptionsCheck setHidden:NO];
         [fFastDecodeCheck setHidden:NO];
     }
     else
     {
-        [fX264UseAdvancedOptionsCheck setHidden:YES];
         [fFastDecodeCheck setHidden:YES];
     }