summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--macosx/English.lproj/AddPreset.xib64
-rw-r--r--macosx/English.lproj/HBAddCategoryController.xib92
-rw-r--r--macosx/HBAddCategoryController.h22
-rw-r--r--macosx/HBAddCategoryController.m69
-rw-r--r--macosx/HBAddPresetController.h3
-rw-r--r--macosx/HBAddPresetController.m79
-rw-r--r--macosx/HBController.m8
-rw-r--r--macosx/HandBrake.xcodeproj/project.pbxproj42
8 files changed, 348 insertions, 31 deletions
diff --git a/macosx/English.lproj/AddPreset.xib b/macosx/English.lproj/AddPreset.xib
index eed7e0188..4cf65c9bf 100644
--- a/macosx/English.lproj/AddPreset.xib
+++ b/macosx/English.lproj/AddPreset.xib
@@ -1,15 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13122.17" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13770" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<development version="8000" identifier="xcode"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13122.17"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13770"/>
<capability name="box content view" minToolsVersion="7.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="HBAddPresetController">
<connections>
+ <outlet property="categories" destination="bma-pS-phM" id="H9g-7F-uan"/>
<outlet property="desc" destination="8kl-Sh-Gh7" id="Go1-hY-VFV"/>
<outlet property="name" destination="aKg-n4-OUS" id="FXa-ee-AN8"/>
<outlet property="picHeight" destination="Mga-dS-8BF" id="blD-Jx-MtN"/>
@@ -23,14 +24,14 @@
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="New Preset" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="dbZ-Wo-9nG" userLabel="AddPresetPanel">
<windowStyleMask key="styleMask" titled="YES" resizable="YES"/>
- <rect key="contentRect" x="421" y="536" width="480" height="229"/>
+ <rect key="contentRect" x="421" y="536" width="480" height="239"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
- <view key="contentView" id="AcO-9f-fnb">
- <rect key="frame" x="0.0" y="0.0" width="480" height="229"/>
+ <view key="contentView" misplaced="YES" id="AcO-9f-fnb">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="239"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="249" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="200" translatesAutoresizingMaskIntoConstraints="NO" id="Wy7-cF-tGv">
- <rect key="frame" x="18" y="193" width="75" height="14"/>
+ <rect key="frame" x="18" y="211" width="75" height="14"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Preset Name:" id="jhj-Et-ncF">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -62,7 +63,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="200" translatesAutoresizingMaskIntoConstraints="NO" id="zDq-QP-LAu">
- <rect key="frame" x="18" y="168" width="75" height="14"/>
+ <rect key="frame" x="18" y="186" width="75" height="14"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Description:" id="hc8-1h-Jye">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -96,7 +97,7 @@ Gw
</connections>
</button>
<textField horizontalHuggingPriority="249" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8kl-Sh-Gh7">
- <rect key="frame" x="99" y="144" width="361" height="38"/>
+ <rect key="frame" x="99" y="162" width="361" height="38"/>
<string key="toolTip">Enter a description for the new preset. The description will be shown when hovering the cursor over the preset in the presets list.</string>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="38" id="2sm-hv-l5W"/>
@@ -121,7 +122,7 @@ Gw
</connections>
</button>
<textField toolTip="Enter a name for the new preset. This name will be displayed in the presets list." verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="aKg-n4-OUS">
- <rect key="frame" x="99" y="190" width="361" height="19"/>
+ <rect key="frame" x="99" y="208" width="361" height="19"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="xe0-bj-f3Z">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -222,6 +223,42 @@ Source maximum uses the full dimensions of each source.</string>
<action selector="openUserGuide:" target="-2" id="CPW-1S-pHx"/>
</connections>
</button>
+ <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="200" translatesAutoresizingMaskIntoConstraints="NO" id="f1M-Sg-uDB">
+ <rect key="frame" x="18" y="138" width="75" height="14"/>
+ <textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Category:" id="IyE-Lz-32s">
+ <font key="font" metaFont="smallSystem"/>
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <popUpButton verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="bma-pS-phM">
+ <rect key="frame" x="96" y="133" width="175" height="22"/>
+ <string key="toolTip">Picture Size controls how video dimensions are applied when selecting the preset.
+
+None uses the currently set dimensions.
+
+Custom allows you to set a maximum width and/or height.
+
+Source maximum uses the full dimensions of each source.</string>
+ <popUpButtonCell key="cell" type="push" title="New Category…" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="Sf8-HP-mhE" id="mZR-uO-YA8">
+ <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="smallSystem"/>
+ <menu key="menu" title="OtherViews" id="tQ1-PN-kvh">
+ <items>
+ <menuItem title="New Category…" id="Sf8-HP-mhE">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="showNewCategoryWindow:" target="-2" id="a4V-O5-hXQ"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="WiF-0h-rb4"/>
+ </items>
+ </menu>
+ </popUpButtonCell>
+ <connections>
+ <accessibilityConnection property="title" destination="f1M-Sg-uDB" id="cMn-eW-Mml"/>
+ </connections>
+ </popUpButton>
</subviews>
<constraints>
<constraint firstItem="fLU-xs-0du" firstAttribute="baseline" secondItem="Y03-Ts-ZA4" secondAttribute="baseline" id="0EW-fw-JLy"/>
@@ -230,17 +267,21 @@ Source maximum uses the full dimensions of each source.</string>
<constraint firstItem="aez-2b-JXx" firstAttribute="top" secondItem="z6B-ig-ouq" secondAttribute="bottom" constant="10" id="4Z4-Zb-Xaa"/>
<constraint firstItem="H9n-64-GXz" firstAttribute="centerY" secondItem="z6B-ig-ouq" secondAttribute="centerY" constant="3" id="5tq-QZ-6b1"/>
<constraint firstItem="H9n-64-GXz" firstAttribute="leading" secondItem="z6B-ig-ouq" secondAttribute="trailing" constant="1" id="7Vw-nX-giB"/>
+ <constraint firstItem="f1M-Sg-uDB" firstAttribute="leading" secondItem="Wy7-cF-tGv" secondAttribute="leading" id="8Er-0i-D3o"/>
<constraint firstItem="Y03-Ts-ZA4" firstAttribute="top" secondItem="nWJ-0b-fUA" secondAttribute="bottom" constant="8" id="8xO-Rb-whc"/>
- <constraint firstItem="z6B-ig-ouq" firstAttribute="top" secondItem="8kl-Sh-Gh7" secondAttribute="bottom" constant="24" id="Ctr-hQ-r5q"/>
<constraint firstAttribute="trailing" secondItem="H9n-64-GXz" secondAttribute="trailing" constant="52" id="E4M-1Z-GXf"/>
<constraint firstAttribute="trailing" secondItem="aKg-n4-OUS" secondAttribute="trailing" constant="20" id="Hax-Id-7bg"/>
<constraint firstAttribute="bottom" secondItem="AWD-QF-ZQB" secondAttribute="bottom" constant="20" id="INj-Gy-SO5"/>
+ <constraint firstItem="bma-pS-phM" firstAttribute="top" secondItem="8kl-Sh-Gh7" secondAttribute="bottom" constant="8" id="JYL-Ce-WbQ"/>
+ <constraint firstItem="bma-pS-phM" firstAttribute="leading" secondItem="f1M-Sg-uDB" secondAttribute="trailing" constant="8" id="Jyh-Yw-1Z8"/>
<constraint firstItem="aKg-n4-OUS" firstAttribute="leading" secondItem="Wy7-cF-tGv" secondAttribute="trailing" constant="8" id="LmP-Ky-GD4"/>
+ <constraint firstItem="f1M-Sg-uDB" firstAttribute="width" secondItem="Wy7-cF-tGv" secondAttribute="width" id="Lnc-rr-Ctp"/>
<constraint firstItem="ubZ-rD-tIS" firstAttribute="baseline" secondItem="nWJ-0b-fUA" secondAttribute="baseline" id="M63-1o-d03"/>
<constraint firstItem="YVc-5E-NjK" firstAttribute="leading" secondItem="Wy7-cF-tGv" secondAttribute="leading" id="MIg-nV-B3M"/>
<constraint firstItem="gOg-oO-8ar" firstAttribute="leading" secondItem="z6B-ig-ouq" secondAttribute="trailing" constant="6" id="Mbf-ar-zbc"/>
<constraint firstItem="zDq-QP-LAu" firstAttribute="leading" secondItem="Wy7-cF-tGv" secondAttribute="leading" id="NgL-7U-KIJ"/>
<constraint firstItem="z6B-ig-ouq" firstAttribute="leading" secondItem="Wpk-WC-aVk" secondAttribute="trailing" constant="8" id="OwF-Ej-M37"/>
+ <constraint firstItem="bma-pS-phM" firstAttribute="baseline" secondItem="f1M-Sg-uDB" secondAttribute="baseline" id="PH8-7Q-ncB"/>
<constraint firstItem="aKg-n4-OUS" firstAttribute="baseline" secondItem="Wy7-cF-tGv" secondAttribute="baseline" id="PUN-iB-1NP"/>
<constraint firstAttribute="bottom" secondItem="fLU-xs-0du" secondAttribute="bottom" constant="20" id="S8Z-g9-Gqs"/>
<constraint firstItem="nWJ-0b-fUA" firstAttribute="top" secondItem="aez-2b-JXx" secondAttribute="bottom" constant="10" id="SxY-XJ-yut"/>
@@ -260,6 +301,7 @@ Source maximum uses the full dimensions of each source.</string>
<constraint firstItem="Wpk-WC-aVk" firstAttribute="width" secondItem="YVc-5E-NjK" secondAttribute="width" id="mF0-Ky-Lla"/>
<constraint firstItem="aez-2b-JXx" firstAttribute="leading" secondItem="YVc-5E-NjK" secondAttribute="trailing" constant="8" id="mcI-hC-pLd"/>
<constraint firstItem="8kl-Sh-Gh7" firstAttribute="trailing" secondItem="aKg-n4-OUS" secondAttribute="trailing" id="mfh-7S-iAZ"/>
+ <constraint firstItem="z6B-ig-ouq" firstAttribute="top" secondItem="bma-pS-phM" secondAttribute="bottom" constant="16" id="pqI-Ve-N4y"/>
<constraint firstItem="YVc-5E-NjK" firstAttribute="width" secondItem="ubZ-rD-tIS" secondAttribute="width" id="qKt-0Q-nbW"/>
<constraint firstItem="8kl-Sh-Gh7" firstAttribute="top" secondItem="aKg-n4-OUS" secondAttribute="bottom" constant="8" id="rE9-pC-SEc"/>
<constraint firstItem="zDq-QP-LAu" firstAttribute="top" secondItem="8kl-Sh-Gh7" secondAttribute="top" id="rek-Ct-2lN"/>
@@ -270,7 +312,7 @@ Source maximum uses the full dimensions of each source.</string>
<connections>
<outlet property="delegate" destination="-2" id="YgD-Uk-vtp"/>
</connections>
- <point key="canvasLocation" x="93" y="126"/>
+ <point key="canvasLocation" x="93" y="130.5"/>
</window>
</objects>
</document>
diff --git a/macosx/English.lproj/HBAddCategoryController.xib b/macosx/English.lproj/HBAddCategoryController.xib
new file mode 100644
index 000000000..5307c9beb
--- /dev/null
+++ b/macosx/English.lproj/HBAddCategoryController.xib
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13770" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+ <dependencies>
+ <deployment identifier="macosx"/>
+ <development version="8000" identifier="xcode"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13770"/>
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+ </dependencies>
+ <objects>
+ <customObject id="-2" userLabel="File's Owner" customClass="HBAddCategoryController">
+ <connections>
+ <outlet property="createButton" destination="WEv-SR-3sw" id="lRz-JT-RDG"/>
+ <outlet property="name" destination="UXm-yG-bgW" id="htS-T7-qP0"/>
+ <outlet property="window" destination="C4G-OG-ksc" id="oNS-V8-CBz"/>
+ </connections>
+ </customObject>
+ <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+ <window title="New Category" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="C4G-OG-ksc">
+ <windowStyleMask key="styleMask" titled="YES"/>
+ <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+ <rect key="contentRect" x="283" y="305" width="290" height="132"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
+ <view key="contentView" id="3oN-GT-JmW">
+ <rect key="frame" x="0.0" y="0.0" width="290" height="132"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="A8w-ij-o7q">
+ <rect key="frame" x="18" y="95" width="168" height="17"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Name of the new category:" id="Pe0-gr-Yv4">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="UXm-yG-bgW">
+ <rect key="frame" x="20" y="65" width="250" height="22"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" title="untitled category" drawsBackground="YES" id="NQn-fS-Rbd">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+ <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ <connections>
+ <outlet property="delegate" destination="-2" id="Iwm-TQ-ug8"/>
+ </connections>
+ </textField>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="HkI-lC-Q2A">
+ <rect key="frame" x="114" y="13" width="82" height="32"/>
+ <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="N2f-jz-YyX">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+ </buttonCell>
+ <connections>
+ <action selector="dismiss:" target="-2" id="LVI-0f-38c"/>
+ </connections>
+ </button>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="WEv-SR-3sw">
+ <rect key="frame" x="195" y="13" width="81" height="32"/>
+ <buttonCell key="cell" type="push" title="Create" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Z9M-dc-5Ml">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+ </buttonCell>
+ <connections>
+ <action selector="create:" target="-2" id="J4N-Rr-G9d"/>
+ </connections>
+ </button>
+ </subviews>
+ <constraints>
+ <constraint firstItem="UXm-yG-bgW" firstAttribute="trailing" secondItem="WEv-SR-3sw" secondAttribute="trailing" id="FMb-6L-akr"/>
+ <constraint firstItem="HkI-lC-Q2A" firstAttribute="baseline" secondItem="WEv-SR-3sw" secondAttribute="baseline" id="SxI-wa-yJV"/>
+ <constraint firstItem="A8w-ij-o7q" firstAttribute="leading" secondItem="UXm-yG-bgW" secondAttribute="leading" id="TKi-pl-2oX"/>
+ <constraint firstItem="A8w-ij-o7q" firstAttribute="leading" secondItem="3oN-GT-JmW" secondAttribute="leading" constant="20" symbolic="YES" id="Tnf-NN-kbG"/>
+ <constraint firstAttribute="bottom" secondItem="HkI-lC-Q2A" secondAttribute="bottom" constant="20" symbolic="YES" id="UNd-bY-NCa"/>
+ <constraint firstItem="A8w-ij-o7q" firstAttribute="top" secondItem="3oN-GT-JmW" secondAttribute="top" constant="20" symbolic="YES" id="ds6-hB-jKz"/>
+ <constraint firstItem="WEv-SR-3sw" firstAttribute="leading" secondItem="HkI-lC-Q2A" secondAttribute="trailing" constant="11" id="iPl-sl-4rt"/>
+ <constraint firstAttribute="trailing" secondItem="UXm-yG-bgW" secondAttribute="trailing" constant="20" symbolic="YES" id="nUT-Cq-nKu"/>
+ <constraint firstItem="UXm-yG-bgW" firstAttribute="top" secondItem="A8w-ij-o7q" secondAttribute="bottom" constant="8" symbolic="YES" id="y1i-GD-vKr"/>
+ </constraints>
+ </view>
+ <connections>
+ <outlet property="delegate" destination="-2" id="7b1-8k-MIb"/>
+ </connections>
+ <point key="canvasLocation" x="66" y="176"/>
+ </window>
+ </objects>
+</document>
diff --git a/macosx/HBAddCategoryController.h b/macosx/HBAddCategoryController.h
new file mode 100644
index 000000000..d6fe70e00
--- /dev/null
+++ b/macosx/HBAddCategoryController.h
@@ -0,0 +1,22 @@
+/* HBAddCategoryController.h
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+#import <Cocoa/Cocoa.h>
+
+@class HBPresetsManager;
+@class HBPreset;
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface HBAddCategoryController : NSWindowController
+
+- (instancetype)initWithPresetManager:(HBPresetsManager *)manager;
+
+@property (nonatomic, readonly, nullable) HBPreset *category;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/macosx/HBAddCategoryController.m b/macosx/HBAddCategoryController.m
new file mode 100644
index 000000000..41de50330
--- /dev/null
+++ b/macosx/HBAddCategoryController.m
@@ -0,0 +1,69 @@
+/* HBAddCategoryController.m
+
+ This file is part of the HandBrake source code.
+ Homepage: <http://handbrake.fr/>.
+ It may be used under the terms of the GNU General Public License. */
+
+#import "HBAddCategoryController.h"
+
+#import "HBPresetsManager.h"
+#import "HBPreset.h"
+
+@interface HBAddCategoryController () <NSTextFieldDelegate>
+
+@property (nonatomic, strong) IBOutlet NSTextField *name;
+@property (nonatomic, strong) IBOutlet NSButton *createButton;
+
+@property (nonatomic, strong) HBPresetsManager *manager;
+@property (nonatomic, readwrite) HBPreset *category;
+
+@end
+
+@implementation HBAddCategoryController
+
+- (instancetype)initWithPresetManager:(HBPresetsManager *)manager
+{
+ self = [super initWithWindowNibName:@"HBAddCategoryController"];
+ if (self)
+ {
+ NSParameterAssert(manager);
+ _manager = manager;
+ }
+ return self;
+}
+
+- (void)windowDidLoad
+{
+ [super windowDidLoad];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(controlTextDidChange:)
+ name:NSControlTextDidChangeNotification object:nil];
+}
+
+- (void)dealloc
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self name:NSControlTextDidChangeNotification object:nil];
+}
+
+- (void)controlTextDidChange:(NSNotification *)obj {
+ self.createButton.enabled = self.name.stringValue.length > 0 ? YES : NO;
+}
+
+- (IBAction)dismiss:(id)sender
+{
+ [self.window orderOut:nil];
+ [NSApp endSheet:self.window returnCode:NSModalResponseCancel];
+}
+
+- (IBAction)create:(id)sender
+{
+ self.category = [[HBPreset alloc] initWithCategoryName:self.name.stringValue builtIn:NO];
+ [self.manager addPreset:self.category];
+
+ [self.window orderOut:nil];
+ [NSApp endSheet:self.window returnCode:NSModalResponseOK];
+}
+
+
+@end
diff --git a/macosx/HBAddPresetController.h b/macosx/HBAddPresetController.h
index fe73e20fe..43dc1b646 100644
--- a/macosx/HBAddPresetController.h
+++ b/macosx/HBAddPresetController.h
@@ -9,10 +9,11 @@
NS_ASSUME_NONNULL_BEGIN
@class HBPreset;
+@class HBPresetsManager;
@interface HBAddPresetController : NSWindowController
-- (instancetype)initWithPreset:(HBPreset *)preset customWidth:(int)customWidth customHeight:(int)customHeight defaultToCustom:(BOOL)defaultToCustom;
+- (instancetype)initWithPreset:(HBPreset *)preset presetManager:(HBPresetsManager *)manager customWidth:(int)customWidth customHeight:(int)customHeight defaultToCustom:(BOOL)defaultToCustom;
@property (nonatomic, readonly) HBPreset *preset;
diff --git a/macosx/HBAddPresetController.m b/macosx/HBAddPresetController.m
index 3cdce5cb0..580673a27 100644
--- a/macosx/HBAddPresetController.m
+++ b/macosx/HBAddPresetController.m
@@ -6,9 +6,14 @@
#import "HBAddPresetController.h"
+#import "HBAddCategoryController.h"
+
#import "HBAudioDefaultsController.h"
#import "HBSubtitlesDefaultsController.h"
+#import "HBPresetsManager.h"
+#import "HBPreset.h"
+
@import HandBrakeKit;
typedef NS_ENUM(NSUInteger, HBAddPresetControllerMode) {
@@ -22,6 +27,8 @@ typedef NS_ENUM(NSUInteger, HBAddPresetControllerMode) {
@property (unsafe_unretained) IBOutlet NSTextField *name;
@property (unsafe_unretained) IBOutlet NSTextField *desc;
+@property (unsafe_unretained) IBOutlet NSPopUpButton *categories;
+
@property (unsafe_unretained) IBOutlet NSPopUpButton *picSettingsPopUp;
@property (unsafe_unretained) IBOutlet NSTextField *picWidth;
@property (unsafe_unretained) IBOutlet NSTextField *picHeight;
@@ -30,6 +37,10 @@ typedef NS_ENUM(NSUInteger, HBAddPresetControllerMode) {
@property (nonatomic, strong) HBPreset *preset;
@property (nonatomic, strong) HBMutablePreset *mutablePreset;
+@property (nonatomic, strong) HBPreset *selectedCategory;
+
+@property (nonatomic, strong) HBPresetsManager *manager;
+
@property (nonatomic) int width;
@property (nonatomic) int height;
@@ -42,13 +53,14 @@ typedef NS_ENUM(NSUInteger, HBAddPresetControllerMode) {
@implementation HBAddPresetController
-- (instancetype)initWithPreset:(HBPreset *)preset customWidth:(int)customWidth customHeight:(int)customHeight defaultToCustom:(BOOL)defaultToCustom
+- (instancetype)initWithPreset:(HBPreset *)preset presetManager:(HBPresetsManager *)manager customWidth:(int)customWidth customHeight:(int)customHeight defaultToCustom:(BOOL)defaultToCustom
{
self = [super initWithWindowNibName:@"AddPreset"];
if (self)
{
NSParameterAssert(preset);
_mutablePreset = [preset mutableCopy];
+ _manager = manager;
_width = customWidth;
_height = customHeight;
_defaultToCustom = defaultToCustom;
@@ -59,6 +71,17 @@ typedef NS_ENUM(NSUInteger, HBAddPresetControllerMode) {
- (void)windowDidLoad {
[super windowDidLoad];
+ // Build the categories menu, and select the first
+ [self buildCategoriesMenu];
+ if ([self.categories selectItemWithTag:2] == NO)
+ {
+ HBPreset *category = [[HBPreset alloc] initWithCategoryName:@"My Presets" builtIn:NO];
+ [self.manager addPreset:category];
+ NSMenuItem *item = [self buildMenuItemWithCategory:category];
+ [self.categories.menu insertItem:item atIndex:2];
+ [self.categories selectItemWithTag:2];
+ }
+
// Populate the preset picture settings popup.
// Use [NSMenuItem tag] to store preset values for each option.
@@ -87,6 +110,59 @@ typedef NS_ENUM(NSUInteger, HBAddPresetControllerMode) {
[self addPresetPicDropdownChanged:nil];
}
+/**
+ * Adds the presets list to the menu.
+ */
+- (void)buildCategoriesMenu
+{
+ for (HBPreset *preset in self.manager.root.children)
+ {
+ if (preset.isBuiltIn == NO && preset.isLeaf == NO)
+ {
+ [self.categories.menu addItem:[self buildMenuItemWithCategory:preset]];
+ }
+ }
+}
+
+- (NSMenuItem *)buildMenuItemWithCategory:(HBPreset *)preset
+{
+ NSMenuItem *item = [[NSMenuItem alloc] init];
+ item.title = preset.name;
+ item.toolTip = preset.presetDescription;
+ item.tag = 2;
+
+ item.action = @selector(selectCategoryFromMenu:);
+ item.representedObject = preset;
+
+ return item;
+}
+
+- (IBAction)showNewCategoryWindow:(id)sender
+{
+ HBAddCategoryController *addCategoryController = [[HBAddCategoryController alloc] initWithPresetManager:self.manager];
+
+ [NSApp beginSheet:addCategoryController.window modalForWindow:self.window modalDelegate:self didEndSelector:@selector(categorySheetDidEnd:returnCode:contextInfo:) contextInfo:(void *)CFBridgingRetain(addCategoryController)];
+}
+
+- (void)categorySheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
+{
+ HBAddCategoryController *addCategoryController = (HBAddCategoryController *)CFBridgingRelease(contextInfo);
+
+ if (returnCode == NSModalResponseOK)
+ {
+ NSMenuItem *item = [self buildMenuItemWithCategory:addCategoryController.category];
+ [self.categories.menu insertItem:item atIndex:2];
+ }
+
+ [self.categories selectItemWithTag:2];
+
+}
+
+- (IBAction)selectCategoryFromMenu:(NSMenuItem *)sender
+{
+ self.selectedCategory = sender.representedObject;
+}
+
- (IBAction)addPresetPicDropdownChanged:(id)sender
{
if (self.picSettingsPopUp.selectedItem.tag == HBAddPresetControllerModeCustom)
@@ -175,6 +251,7 @@ typedef NS_ENUM(NSUInteger, HBAddPresetControllerMode) {
[newPreset cleanUp];
self.preset = [newPreset copy];
+ [self.selectedCategory insertObject:self.preset inChildrenAtIndex:0];
[self.window orderOut:nil];
[NSApp endSheet:self.window returnCode:NSModalResponseContinue];
diff --git a/macosx/HBController.m b/macosx/HBController.m
index c2b7b3caf..3a7105b2c 100644
--- a/macosx/HBController.m
+++ b/macosx/HBController.m
@@ -1424,6 +1424,7 @@
// Show the add panel
HBAddPresetController *addPresetController = [[HBAddPresetController alloc] initWithPreset:[self createPresetFromCurrentSettings]
+ presetManager:presetManager
customWidth:self.job.picture.width
customHeight:self.job.picture.height
defaultToCustom:defaultToCustom];
@@ -1433,12 +1434,7 @@
- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
- HBAddPresetController *addPresetController = (HBAddPresetController *)CFBridgingRelease(contextInfo);
-
- if (returnCode == NSModalResponseContinue)
- {
- [presetManager addPreset:addPresetController.preset];
- }
+ __unused HBAddPresetController *addPresetController = (HBAddPresetController *)CFBridgingRelease(contextInfo);
}
- (HBPreset *)createPresetFromCurrentSettings
diff --git a/macosx/HandBrake.xcodeproj/project.pbxproj b/macosx/HandBrake.xcodeproj/project.pbxproj
index 6afc04ba7..74b3906db 100644
--- a/macosx/HandBrake.xcodeproj/project.pbxproj
+++ b/macosx/HandBrake.xcodeproj/project.pbxproj
@@ -85,6 +85,9 @@
A916C9991C8449E200C7B560 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = 273F20BD14ADC09F0021BE6D /* main.mm */; };
A916C99A1C8449FB00C7B560 /* HBHUDView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9C9F88819A733FE00DC8923 /* HBHUDView.m */; };
A916C99B1C844A0800C7B560 /* HBQueueOutlineView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9EA43671A2210C400785E95 /* HBQueueOutlineView.m */; };
+ A91AD3401FB5D2FC00AEA822 /* HBAddCategoryController.m in Sources */ = {isa = PBXBuildFile; fileRef = A91AD33E1FB5D2FC00AEA822 /* HBAddCategoryController.m */; };
+ A91AD3441FB5D9A500AEA822 /* HBAddCategoryController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A91AD3421FB5D9A500AEA822 /* HBAddCategoryController.xib */; };
+ A91AD3471FB5D9AA00AEA822 /* AddPreset.xib in Resources */ = {isa = PBXBuildFile; fileRef = A91AD3451FB5D9AA00AEA822 /* AddPreset.xib */; };
A91AFD0C1A948827009BECED /* HBOutputFileWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = A91AFD0B1A948827009BECED /* HBOutputFileWriter.m */; };
A91CE27D1C7DA7320068F46F /* HBCore.m in Sources */ = {isa = PBXBuildFile; fileRef = A9DEC8731A23C87500C79B48 /* HBCore.m */; };
A91CE27F1C7DA7320068F46F /* HBTitle.m in Sources */ = {isa = PBXBuildFile; fileRef = A971281E1A2C75180088C076 /* HBTitle.m */; };
@@ -237,7 +240,6 @@
A9E1468216BC2AD800C307BC /* PlayTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = A9E1467E16BC2AD800C307BC /* PlayTemplate.pdf */; };
A9E1468316BC2AD800C307BC /* PrevTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = A9E1467F16BC2AD800C307BC /* PrevTemplate.pdf */; };
A9E165521C523016003EF30E /* libavfilter.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A9E165511C523016003EF30E /* libavfilter.a */; };
- A9E2FD2B1A21BC6F000E8D3F /* AddPreset.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9E2FD291A21BC6F000E8D3F /* AddPreset.xib */; };
A9F217E61E2F934C00C10C6E /* container-migration.plist in Resources */ = {isa = PBXBuildFile; fileRef = A9F217E51E2F934C00C10C6E /* container-migration.plist */; };
A9F2EB6F196F12C800066546 /* Audio.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9F2EB6D196F12C800066546 /* Audio.xib */; };
A9F472891976B7F30009EC65 /* HBSubtitlesDefaultsController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9F472871976B7F30009EC65 /* HBSubtitlesDefaultsController.m */; };
@@ -418,6 +420,10 @@
A91806701A4807B000FC9BED /* HBRange.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBRange.m; sourceTree = "<group>"; };
A9181CB01BD76F8400E5C8B0 /* HBSubtitlesTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBSubtitlesTrack.h; sourceTree = "<group>"; };
A9181CB11BD76F8400E5C8B0 /* HBSubtitlesTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBSubtitlesTrack.m; sourceTree = "<group>"; };
+ A91AD33D1FB5D2FC00AEA822 /* HBAddCategoryController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HBAddCategoryController.h; sourceTree = "<group>"; };
+ A91AD33E1FB5D2FC00AEA822 /* HBAddCategoryController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HBAddCategoryController.m; sourceTree = "<group>"; };
+ A91AD3431FB5D9A500AEA822 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/HBAddCategoryController.xib; sourceTree = "<group>"; };
+ A91AD3461FB5D9AA00AEA822 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/AddPreset.xib; sourceTree = "<group>"; };
A91AFD0A1A948827009BECED /* HBOutputFileWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBOutputFileWriter.h; sourceTree = "<group>"; };
A91AFD0B1A948827009BECED /* HBOutputFileWriter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBOutputFileWriter.m; sourceTree = "<group>"; };
A91AFD0D1A949472009BECED /* HBJobOutputFileWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBJobOutputFileWriter.h; sourceTree = "<group>"; };
@@ -571,7 +577,6 @@
A9E165511C523016003EF30E /* libavfilter.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavfilter.a; path = external/contrib/lib/libavfilter.a; sourceTree = BUILT_PRODUCTS_DIR; };
A9E2FD241A21BC4A000E8D3F /* HBAddPresetController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBAddPresetController.h; sourceTree = "<group>"; };
A9E2FD251A21BC4A000E8D3F /* HBAddPresetController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBAddPresetController.m; sourceTree = "<group>"; };
- A9E2FD2A1A21BC6F000E8D3F /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = AddPreset.xib; sourceTree = "<group>"; };
A9E66D6E1A67A2A8007B641D /* HBDistributedArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HBDistributedArray.h; path = ../HBDistributedArray.h; sourceTree = "<group>"; };
A9E66D6F1A67A2A8007B641D /* HBDistributedArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = HBDistributedArray.m; path = ../HBDistributedArray.m; sourceTree = "<group>"; };
A9EA43661A2210C400785E95 /* HBQueueOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBQueueOutlineView.h; sourceTree = "<group>"; };
@@ -867,7 +872,6 @@
A92268791A6E569B00A8D5C5 /* MainWindow.xib */,
A9C1839B1A716BCC00C897C2 /* HBTitleSelection.xib */,
A9CF25EF1990D62C0023F727 /* Presets.xib */,
- A9E2FD291A21BC6F000E8D3F /* AddPreset.xib */,
A99F40D11B624EA500750170 /* HBPictureViewController.xib */,
A91485FA1F61291F00374C12 /* HBFiltersViewController.xib */,
A93E0ED51972958C00FD67FB /* Video.xib */,
@@ -1171,6 +1175,10 @@
A901C2411BC7CFFD00D77735 /* Preview */,
A9E2FD241A21BC4A000E8D3F /* HBAddPresetController.h */,
A9E2FD251A21BC4A000E8D3F /* HBAddPresetController.m */,
+ A91AD3451FB5D9AA00AEA822 /* AddPreset.xib */,
+ A91AD33D1FB5D2FC00AEA822 /* HBAddCategoryController.h */,
+ A91AD33E1FB5D2FC00AEA822 /* HBAddCategoryController.m */,
+ A91AD3421FB5D9A500AEA822 /* HBAddCategoryController.xib */,
273F209B14ADBE670021BE6D /* HBOutputPanelController.h */,
273F209C14ADBE670021BE6D /* HBOutputPanelController.m */,
273F209F14ADBE670021BE6D /* HBPreferencesController.h */,
@@ -1457,7 +1465,6 @@
A9F2EB6F196F12C800066546 /* Audio.xib in Resources */,
A9CF25F11990D62C0023F727 /* Presets.xib in Resources */,
A9C1839D1A716BCC00C897C2 /* HBTitleSelection.xib in Resources */,
- A9E2FD2B1A21BC6F000E8D3F /* AddPreset.xib in Resources */,
273F218A14ADDDA10021BE6D /* AdvancedView.xib in Resources */,
273F218B14ADDDA10021BE6D /* InfoPlist.strings in Resources */,
A932E26C1988334B0047D13E /* AudioDefaults.xib in Resources */,
@@ -1474,7 +1481,9 @@
3490BCB41614CF8D002A5AD7 /* HandBrake.icns in Resources */,
A9E1468016BC2AD800C307BC /* NextTemplate.pdf in Resources */,
A9E1468116BC2AD800C307BC /* PauseTemplate.pdf in Resources */,
+ A91AD3471FB5D9AA00AEA822 /* AddPreset.xib in Resources */,
A9E1468216BC2AD800C307BC /* PlayTemplate.pdf in Resources */,
+ A91AD3441FB5D9A500AEA822 /* HBAddCategoryController.xib in Resources */,
A96664BB1CCE493D00DA4A57 /* HBEncodingProgressHUDController.xib in Resources */,
A9E1468316BC2AD800C307BC /* PrevTemplate.pdf in Resources */,
A937EECB1C6C7C0300EEAE6D /* dsa_pub.pem in Resources */,
@@ -1551,6 +1560,7 @@
A9BB0F2719A0ECE40079F1C1 /* HBHUDButtonCell.m in Sources */,
A9706CB71AC1437800BAEAA8 /* HBExceptionAlertController.m in Sources */,
A93B49221DA3AA6900DD70A3 /* HBToolbarBadgedItem.m in Sources */,
+ A91AD3401FB5D2FC00AEA822 /* HBAddCategoryController.m in Sources */,
A92268781A6E555500A8D5C5 /* HBAppDelegate.m in Sources */,
A98036CD1CCA91DD007661AA /* HBAVPlayer.m in Sources */,
A9BC24C91A69293E007DC41A /* HBAttributedStringAdditions.m in Sources */,
@@ -1727,6 +1737,22 @@
name = HBFiltersViewController.xib;
sourceTree = "<group>";
};
+ A91AD3421FB5D9A500AEA822 /* HBAddCategoryController.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ A91AD3431FB5D9A500AEA822 /* English */,
+ );
+ name = HBAddCategoryController.xib;
+ sourceTree = "<group>";
+ };
+ A91AD3451FB5D9AA00AEA822 /* AddPreset.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ A91AD3461FB5D9AA00AEA822 /* English */,
+ );
+ name = AddPreset.xib;
+ sourceTree = "<group>";
+ };
A92268791A6E569B00A8D5C5 /* MainWindow.xib */ = {
isa = PBXVariantGroup;
children = (
@@ -1807,14 +1833,6 @@
name = Subtitles.xib;
sourceTree = "<group>";
};
- A9E2FD291A21BC6F000E8D3F /* AddPreset.xib */ = {
- isa = PBXVariantGroup;
- children = (
- A9E2FD2A1A21BC6F000E8D3F /* English */,
- );
- name = AddPreset.xib;
- sourceTree = "<group>";
- };
A9F2EB6D196F12C800066546 /* Audio.xib */ = {
isa = PBXVariantGroup;
children = (