summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2018-10-08 16:27:16 +0200
committerDamiano Galassi <[email protected]>2018-10-08 16:27:16 +0200
commita3fb08633e62775c251886aa6dff15e5f91f60e4 (patch)
treef0519e497d8f6b8ae7c472313cc4f61f647f50fa
parent44623d61875d93f9f94ee027a25e384604c5ef27 (diff)
MacGui: add touch bars to main and queue windows.
-rw-r--r--macosx/Base.lproj/HBFiltersViewController.xib26
-rw-r--r--macosx/Base.lproj/HBPictureViewController.xib28
-rw-r--r--macosx/Base.lproj/MainWindow.xib73
-rw-r--r--macosx/Base.lproj/Queue.xib6
-rw-r--r--macosx/Base.lproj/Video.xib8
-rw-r--r--macosx/HBAppDelegate.m4
-rw-r--r--macosx/HBController.m369
-rw-r--r--macosx/HBCore.m5
-rw-r--r--macosx/HBQueueController.m174
9 files changed, 517 insertions, 176 deletions
diff --git a/macosx/Base.lproj/HBFiltersViewController.xib b/macosx/Base.lproj/HBFiltersViewController.xib
index 073c58741..aa4f8668d 100644
--- a/macosx/Base.lproj/HBFiltersViewController.xib
+++ b/macosx/Base.lproj/HBFiltersViewController.xib
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14306.4" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.23.1" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14306.4"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.23.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -71,7 +71,7 @@
<outlet property="nextKeyView" destination="ipJ-z3-XnJ" id="fgB-Yd-xLt"/>
</connections>
</popUpButton>
- <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ipJ-z3-XnJ">
+ <textField verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ipJ-z3-XnJ">
<rect key="frame" x="332" y="300" width="180" height="19"/>
<string key="toolTip">Custom Detelecine parameters.
@@ -213,7 +213,7 @@ Decomb switches between multiple interpolation algorithms for speed and quality.
<binding destination="-2" name="contentValues" keyPath="self.filters.deinterlaceTypes" id="1XG-JZ-nFn"/>
</connections>
</popUpButton>
- <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="r64-vI-ymx">
+ <textField verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="r64-vI-ymx">
<rect key="frame" x="539" y="234" width="180" height="19"/>
<string key="toolTip">Custom Deinterlace parameters.
@@ -296,7 +296,7 @@ Bob attempts to better preserve motion for a slight penalty to perceived resolut
</connections>
</popUpButton>
<popUpButton toolTip="Rotate the picture clockwise in 90 degree increments." verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dsH-ZQ-dBs">
- <rect key="frame" x="119" y="165" width="59" height="22"/>
+ <rect key="frame" x="119" y="165" width="61" height="22"/>
<popUpButtonCell key="cell" type="push" title="0°" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="eZj-V7-e0o" id="ee3-w2-XRX">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -320,7 +320,7 @@ Bob attempts to better preserve motion for a slight penalty to perceived resolut
</connections>
</popUpButton>
<button toolTip="Flips (mirrors) the picture on the horizontal axis." translatesAutoresizingMaskIntoConstraints="NO" id="IWV-25-FSC">
- <rect key="frame" x="180" y="168" width="41" height="18"/>
+ <rect key="frame" x="182" y="168" width="41" height="18"/>
<buttonCell key="cell" type="check" title="Flip" bezelStyle="regularSquare" imagePosition="left" controlSize="small" state="on" inset="2" id="Tvl-40-1Tc">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -387,7 +387,7 @@ Bob attempts to better preserve motion for a slight penalty to perceived resolut
<outlet property="nextKeyView" destination="rPg-F2-gtl" id="46r-ZD-dTe"/>
</connections>
</popUpButton>
- <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rPg-F2-gtl">
+ <textField verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rPg-F2-gtl">
<rect key="frame" x="332" y="260" width="180" height="19"/>
<string key="toolTip">Custom Interlace Detection parameters.
@@ -403,14 +403,14 @@ Default: mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
- <binding destination="-2" name="hidden" keyPath="self.filters.customCombDetectionSelected" id="avq-Zl-5gA">
+ <binding destination="-2" name="value" keyPath="self.filters.combDetectionCustomString" id="r46-bK-tom">
<dictionary key="options">
- <string key="NSValueTransformerName">NSNegateBoolean</string>
+ <bool key="NSValidatesImmediately" value="YES"/>
</dictionary>
</binding>
- <binding destination="-2" name="value" keyPath="self.filters.combDetectionCustomString" id="r46-bK-tom">
+ <binding destination="-2" name="hidden" keyPath="self.filters.customCombDetectionSelected" id="avq-Zl-5gA">
<dictionary key="options">
- <bool key="NSValidatesImmediately" value="YES"/>
+ <string key="NSValueTransformerName">NSNegateBoolean</string>
</dictionary>
</binding>
</connections>
@@ -665,7 +665,7 @@ Sprite is useful for 1-/4-/8-/16-bit 2-dimensional games. Sprite is not designed
<binding destination="-2" name="textColor" keyPath="self.labelColor" id="s0f-8C-cZp"/>
</connections>
</textField>
- <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZR9-YG-pfn">
+ <textField verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZR9-YG-pfn">
<rect key="frame" x="540" y="95" width="180" height="19"/>
<string key="toolTip">Custom Denoise parameters.
@@ -767,7 +767,7 @@ Lapsharp's Sprite tune is useful for 1-/4-/8-/16-bit 2-dimensional games. Sprite
<binding destination="-2" name="textColor" keyPath="self.labelColor" id="C4H-qZ-HMZ"/>
</connections>
</textField>
- <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="150" translatesAutoresizingMaskIntoConstraints="NO" id="Hht-Rt-VA0">
+ <textField verticalHuggingPriority="750" preferredMaxLayoutWidth="150" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hht-Rt-VA0">
<rect key="frame" x="540" y="69" width="180" height="19"/>
<string key="toolTip">Custom Sharpen parameters.
diff --git a/macosx/Base.lproj/HBPictureViewController.xib b/macosx/Base.lproj/HBPictureViewController.xib
index 5698f9628..1694f9fa0 100644
--- a/macosx/Base.lproj/HBPictureViewController.xib
+++ b/macosx/Base.lproj/HBPictureViewController.xib
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14269.12" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.23.1" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14269.12"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.23.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -151,7 +151,7 @@ Custom allows for manual settings.</string>
<binding destination="-2" name="textColor" keyPath="self.labelColor" id="fkJ-hW-R19"/>
</connections>
</textField>
- <textField toolTip="Right edge cropping amount in pixels." verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="36" translatesAutoresizingMaskIntoConstraints="NO" id="wsq-TS-cC6">
+ <textField toolTip="Right edge cropping amount in pixels." verticalHuggingPriority="750" preferredMaxLayoutWidth="36" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wsq-TS-cC6">
<rect key="frame" x="213" y="47" width="36" height="19"/>
<constraints>
<constraint firstAttribute="width" constant="36" id="FKh-P6-rGY"/>
@@ -210,7 +210,7 @@ Custom allows for manual settings.</string>
<binding destination="-2" name="maxValue" keyPath="self.picture.maxRightCrop" id="X5t-bh-W3a"/>
</connections>
</stepper>
- <textField toolTip="Bottom edge cropping amount in pixels." verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="36" translatesAutoresizingMaskIntoConstraints="NO" id="1Z0-JT-vst">
+ <textField toolTip="Bottom edge cropping amount in pixels." verticalHuggingPriority="750" preferredMaxLayoutWidth="36" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1Z0-JT-vst">
<rect key="frame" x="157" y="24" width="36" height="19"/>
<constraints>
<constraint firstAttribute="width" constant="36" id="3ia-1j-BcT"/>
@@ -244,7 +244,7 @@ Custom allows for manual settings.</string>
</binding>
</connections>
</textField>
- <textField toolTip="Top edge cropping amount in pixels." verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="36" translatesAutoresizingMaskIntoConstraints="NO" id="41c-48-2XJ">
+ <textField toolTip="Top edge cropping amount in pixels." verticalHuggingPriority="750" preferredMaxLayoutWidth="36" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="41c-48-2XJ">
<rect key="frame" x="157" y="70" width="36" height="19"/>
<constraints>
<constraint firstAttribute="width" constant="36" id="iB8-cV-2Mf"/>
@@ -278,7 +278,7 @@ Custom allows for manual settings.</string>
</binding>
</connections>
</textField>
- <textField toolTip="Left edge cropping amount in pixels." verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="36" translatesAutoresizingMaskIntoConstraints="NO" id="LTu-ic-Ty9">
+ <textField toolTip="Left edge cropping amount in pixels." verticalHuggingPriority="750" preferredMaxLayoutWidth="36" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LTu-ic-Ty9">
<rect key="frame" x="99" y="47" width="36" height="19"/>
<constraints>
<constraint firstAttribute="width" constant="36" id="g6w-uS-3jp"/>
@@ -340,7 +340,7 @@ Custom allows for manual settings.</string>
</constraints>
<accessibility description="Cropping"/>
</customView>
- <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="200" translatesAutoresizingMaskIntoConstraints="NO" id="LWv-Y9-b0S">
+ <textField verticalHuggingPriority="750" preferredMaxLayoutWidth="200" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LWv-Y9-b0S">
<rect key="frame" x="98" y="246" width="54" height="19"/>
<string key="toolTip">Display width. This is the number of pixels wide your video will appear to be at its native resolution, and is the result of scaling the storage dimensions by the pixel aspect.</string>
<constraints>
@@ -364,7 +364,7 @@ Custom allows for manual settings.</string>
<outlet property="nextKeyView" destination="JC3-5O-BXA" id="oN1-b9-dyt"/>
</connections>
</textField>
- <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="200" translatesAutoresizingMaskIntoConstraints="NO" id="nQe-Vq-Og2">
+ <textField verticalHuggingPriority="750" preferredMaxLayoutWidth="200" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nQe-Vq-Og2">
<rect key="frame" x="180" y="246" width="54" height="19"/>
<string key="toolTip">Display height. This is the number of pixels tall your video will appear to be at its native resolution, and is the result of scaling the storage dimensions by the pixel aspect.</string>
<constraints>
@@ -387,7 +387,7 @@ Custom allows for manual settings.</string>
<outlet property="nextKeyView" destination="JC3-5O-BXA" id="Ly3-4t-fIs"/>
</connections>
</textField>
- <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="200" translatesAutoresizingMaskIntoConstraints="NO" id="JC3-5O-BXA">
+ <textField verticalHuggingPriority="750" preferredMaxLayoutWidth="200" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JC3-5O-BXA">
<rect key="frame" x="98" y="219" width="54" height="19"/>
<string key="toolTip">Pixel Aspect Ratio defines the shape of the storage pixels, or how to scale anamorphic video to create the correct display aspect and dimensions. Non-anamorphic video (1:1 PAR) is not scaled during playback.</string>
<constraints>
@@ -425,7 +425,7 @@ Custom allows for manual settings.</string>
</textField>
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FwZ-6T-zJe">
<rect key="frame" x="153" y="298" width="15" height="22"/>
- <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="64" id="NP7-P2-Qga">
+ <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="59" id="NP7-P2-Qga">
<font key="font" metaFont="smallSystem"/>
</stepperCell>
<accessibility description="Storage Width"/>
@@ -468,7 +468,7 @@ Custom allows for manual settings.</string>
<binding destination="-2" name="selectedValue" keyPath="self.picture.modulus" id="lCQ-i3-hQ0"/>
</connections>
</popUpButton>
- <textField verticalHuggingPriority="751" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="200" translatesAutoresizingMaskIntoConstraints="NO" id="9hH-As-JSa">
+ <textField verticalHuggingPriority="751" preferredMaxLayoutWidth="200" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9hH-As-JSa">
<rect key="frame" x="98" y="300" width="56" height="19"/>
<string key="toolTip">Video storage width. This is the number of pixels wide to be encoded. Storage width may differ from display width depending on anamorphic settings.</string>
<constraints>
@@ -602,7 +602,7 @@ Custom allows manually setting all parameters. Useful for correcting an incorrec
<binding destination="-2" name="textColor" keyPath="self.labelColor" id="Ghz-q6-1Y1"/>
</connections>
</textField>
- <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="200" translatesAutoresizingMaskIntoConstraints="NO" id="Hkl-7Z-J2e">
+ <textField verticalHuggingPriority="750" preferredMaxLayoutWidth="200" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hkl-7Z-J2e">
<rect key="frame" x="187" y="300" width="56" height="19"/>
<string key="toolTip">Video storage height. This is the number of pixels tall to be encoded. Storage height may differ from display height depending on anamorphic settings.</string>
<constraints>
@@ -630,7 +630,7 @@ Custom allows manually setting all parameters. Useful for correcting an incorrec
<outlet property="nextKeyView" destination="2s0-5k-fjU" id="D8H-ff-R52"/>
</connections>
</textField>
- <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="200" translatesAutoresizingMaskIntoConstraints="NO" id="rFi-0b-3BX">
+ <textField verticalHuggingPriority="750" preferredMaxLayoutWidth="200" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rFi-0b-3BX">
<rect key="frame" x="180" y="219" width="54" height="19"/>
<string key="toolTip">Pixel Aspect Ratio defines the shape of the storage pixels, or how to scale anamorphic video to create the correct display aspect and dimensions. Non-anamorphic video (1:1 PAR) is not scaled during playback.</string>
<constraints>
@@ -655,7 +655,7 @@ Custom allows manually setting all parameters. Useful for correcting an incorrec
</textField>
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2s0-5k-fjU">
<rect key="frame" x="242" y="298" width="15" height="22"/>
- <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="64" id="MwK-aS-Oaf">
+ <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="59" id="MwK-aS-Oaf">
<font key="font" metaFont="smallSystem"/>
</stepperCell>
<accessibility description="Storage Height"/>
diff --git a/macosx/Base.lproj/MainWindow.xib b/macosx/Base.lproj/MainWindow.xib
index cd9032cc2..fd577a809 100644
--- a/macosx/Base.lproj/MainWindow.xib
+++ b/macosx/Base.lproj/MainWindow.xib
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14313.3.2" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.23.1" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.3.2"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.23.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -23,9 +23,12 @@
<outlet property="fStatusField" destination="1123" id="mPD-cg-5dk"/>
<outlet property="fSubtitlesTab" destination="5194" id="PF0-qx-Iu4"/>
<outlet property="fVideoTab" destination="1477" id="hFY-kK-afW"/>
+ <outlet property="openSourceToolbarItem" destination="8r8-nZ-dYs" id="cEL-nv-D9F"/>
<outlet property="openTitleView" destination="lZQ-gl-3wX" id="Wh6-fB-pWi"/>
+ <outlet property="pauseToolbarItem" destination="wTQ-KF-5KW" id="htw-tK-A0X"/>
<outlet property="presetsItem" destination="qhv-9l-2FH" id="bEZ-nH-M9d"/>
<outlet property="presetsPopup" destination="bWH-Lp-mKY" id="vot-gQ-hLV"/>
+ <outlet property="ripToolbarItem" destination="byg-kj-sEM" id="C7B-wO-F1Q"/>
<outlet property="showQueueToolbarItem" destination="HCx-ku-nF7" id="CC6-Yu-j7N"/>
<outlet property="summaryTab" destination="BA0-eg-2Ka" id="wh5-Js-weO"/>
<outlet property="window" destination="21" id="qib-ZH-aNm"/>
@@ -44,14 +47,14 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tabView controlSize="small" translatesAutoresizingMaskIntoConstraints="NO" id="1474" customClass="HBTabView">
- <rect key="frame" x="13" y="116" width="859" height="381"/>
+ <rect key="frame" x="13" y="116" width="859" height="382"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="334" id="Jdl-tV-liS"/>
</constraints>
<tabViewItems>
<tabViewItem label="Summary" identifier="" id="BA0-eg-2Ka">
<view key="view" id="BjX-E2-6tb">
- <rect key="frame" x="10" y="25" width="839" height="343"/>
+ <rect key="frame" x="10" y="29" width="839" height="340"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
</tabViewItem>
@@ -103,7 +106,7 @@
</connections>
</tabView>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="100" translatesAutoresizingMaskIntoConstraints="NO" id="1538">
- <rect key="frame" x="18" y="569" width="48" height="15"/>
+ <rect key="frame" x="18" y="570" width="48" height="14"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Source:" id="4905">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -115,7 +118,7 @@
</connections>
</textField>
<textField horizontalHuggingPriority="1000" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="100" translatesAutoresizingMaskIntoConstraints="NO" id="1540">
- <rect key="frame" x="18" y="538" width="33" height="15"/>
+ <rect key="frame" x="18" y="540" width="33" height="14"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Title:" id="4907">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -126,7 +129,7 @@
</connections>
</textField>
<popUpButton toolTip="Source range selection. By default, all chapters are selected and the entire source is encoded." horizontalHuggingPriority="1000" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5513">
- <rect key="frame" x="526" y="535" width="84" height="22"/>
+ <rect key="frame" x="526" y="536" width="84" height="22"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="78" id="Zs8-pX-H7V"/>
</constraints>
@@ -148,7 +151,7 @@
</connections>
</popUpButton>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="100" translatesAutoresizingMaskIntoConstraints="NO" id="1552">
- <rect key="frame" x="18" y="94" width="52" height="15"/>
+ <rect key="frame" x="18" y="94" width="52" height="14"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" title="Save As:" id="4913">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -159,7 +162,7 @@
</connections>
</textField>
<textField horizontalHuggingPriority="1000" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="100" translatesAutoresizingMaskIntoConstraints="NO" id="1553">
- <rect key="frame" x="754" y="538" width="57" height="15"/>
+ <rect key="frame" x="754" y="540" width="57" height="14"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Duration:" id="4914">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -174,7 +177,7 @@
</connections>
</textField>
<textField toolTip="Duration of the selected source range in Hours:Minutes:Seconds." verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="100" translatesAutoresizingMaskIntoConstraints="NO" id="1554">
- <rect key="frame" x="811" y="538" width="56" height="15"/>
+ <rect key="frame" x="811" y="540" width="56" height="14"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="52" id="YAI-9M-gNt"/>
</constraints>
@@ -195,7 +198,7 @@
</connections>
</textField>
<textField toolTip="Source file name." verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1539">
- <rect key="frame" x="70" y="569" width="44" height="14"/>
+ <rect key="frame" x="70" y="570" width="44" height="14"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="40" id="xNw-RS-Hhf"/>
</constraints>
@@ -208,7 +211,7 @@
<accessibilityConnection property="title" destination="1538" id="rra-Xj-yD0"/>
</connections>
</textField>
- <textField toolTip="File name. This is what your new video will be named." verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="1561">
+ <textField toolTip="File name. This is what your new video will be named." verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1561">
<rect key="frame" x="76" y="91" width="347" height="19"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" continuous="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="4919">
<font key="font" metaFont="smallSystem"/>
@@ -230,7 +233,7 @@
</connections>
</textField>
<textField hidden="YES" toolTip="First second to encode." verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5491" userLabel="Time Start Encoding Field">
- <rect key="frame" x="615" y="535" width="54" height="19"/>
+ <rect key="frame" x="615" y="537" width="54" height="19"/>
<constraints>
<constraint firstAttribute="width" constant="54" id="siy-Fa-XFI"/>
</constraints>
@@ -258,7 +261,7 @@
</connections>
</textField>
<textField hidden="YES" toolTip="First frame to encode." verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5521" userLabel="Frame Start Encoding Field">
- <rect key="frame" x="615" y="535" width="54" height="19"/>
+ <rect key="frame" x="615" y="537" width="54" height="19"/>
<constraints>
<constraint firstAttribute="width" constant="54" id="uYc-eu-FMx"/>
</constraints>
@@ -286,7 +289,7 @@
</connections>
</textField>
<textField hidden="YES" toolTip="Last second to encode." verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5493" userLabel="Time End Encoding Field">
- <rect key="frame" x="687" y="535" width="54" height="19"/>
+ <rect key="frame" x="687" y="537" width="54" height="19"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="5494">
<numberFormatter key="formatter" formatterBehavior="default10_4" usesGroupingSeparator="NO" minimumIntegerDigits="0" maximumIntegerDigits="42" id="tD5-HN-B7h">
<real key="minimum" value="0.0"/>
@@ -311,7 +314,7 @@
</connections>
</textField>
<textField hidden="YES" toolTip="Last frame to encode." verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5523" userLabel="Frame End Encoding Field">
- <rect key="frame" x="687" y="535" width="54" height="19"/>
+ <rect key="frame" x="687" y="537" width="54" height="19"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" drawsBackground="YES" id="5524">
<numberFormatter key="formatter" formatterBehavior="default10_4" usesGroupingSeparator="NO" minimumIntegerDigits="0" maximumIntegerDigits="42" id="WrK-kN-ZN0">
<real key="minimum" value="0.0"/>
@@ -336,7 +339,7 @@
</connections>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="100" translatesAutoresizingMaskIntoConstraints="NO" id="1627">
- <rect key="frame" x="18" y="507" width="45" height="15"/>
+ <rect key="frame" x="18" y="510" width="45" height="14"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Preset:" id="4923">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -347,10 +350,10 @@
</connections>
</textField>
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="1628">
- <rect key="frame" x="470" y="514" width="395" height="5"/>
+ <rect key="frame" x="470" y="515" width="395" height="5"/>
</box>
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="3205">
- <rect key="frame" x="127" y="574" width="738" height="5"/>
+ <rect key="frame" x="127" y="575" width="738" height="5"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="20" id="8eM-Lw-0wS"/>
</constraints>
@@ -362,7 +365,7 @@
</constraints>
</progressIndicator>
<textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="100" translatesAutoresizingMaskIntoConstraints="NO" id="5505">
- <rect key="frame" x="671" y="538" width="14" height="15"/>
+ <rect key="frame" x="671" y="540" width="14" height="14"/>
<constraints>
<constraint firstAttribute="width" constant="10" id="oZA-uv-S2L"/>
</constraints>
@@ -380,7 +383,7 @@
</connections>
</textField>
<popUpButton toolTip="First chapter to encode." verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1545" userLabel="Chapter Start">
- <rect key="frame" x="612" y="535" width="60" height="22"/>
+ <rect key="frame" x="612" y="536" width="60" height="22"/>
<constraints>
<constraint firstAttribute="width" constant="54" id="LYd-Am-GKJ"/>
</constraints>
@@ -405,7 +408,7 @@
</connections>
</popUpButton>
<popUpButton toolTip="Last chapter to encode." verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1548" userLabel="Chapter End">
- <rect key="frame" x="684" y="535" width="60" height="22"/>
+ <rect key="frame" x="684" y="536" width="60" height="22"/>
<constraints>
<constraint firstAttribute="width" constant="54" id="zhJ-ur-lHA"/>
</constraints>
@@ -430,7 +433,7 @@
</connections>
</popUpButton>
<popUpButton toolTip="Video angle to encode. Only applicable to multi-angle DVD and Blu-ray." verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5181">
- <rect key="frame" x="426" y="535" width="44" height="22"/>
+ <rect key="frame" x="426" y="536" width="44" height="22"/>
<constraints>
<constraint firstAttribute="width" constant="38" id="xGF-g4-jWh"/>
</constraints>
@@ -466,7 +469,7 @@ IA
</connections>
</popUpButton>
<popUpButton verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="1541">
- <rect key="frame" x="54" y="535" width="318" height="22"/>
+ <rect key="frame" x="54" y="536" width="318" height="22"/>
<string key="toolTip">Title, or video clip, to encode. The longest title is selected by default.
Blu-ray and DVD sources often have multiple titles, the longest of which is typically the main feature.</string>
@@ -492,7 +495,7 @@ Blu-ray and DVD sources often have multiple titles, the longest of which is typi
</connections>
</popUpButton>
<pathControl verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="PJi-21-hie">
- <rect key="frame" x="471" y="92" width="328" height="20"/>
+ <rect key="frame" x="471" y="91" width="328" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="328" id="Q5R-FC-z1x"/>
</constraints>
@@ -506,7 +509,7 @@ Blu-ray and DVD sources often have multiple titles, the longest of which is typi
</connections>
</pathControl>
<button toolTip="Browse to select a new destination path for your encode." horizontalHuggingPriority="1000" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1562">
- <rect key="frame" x="796" y="88" width="74" height="27"/>
+ <rect key="frame" x="796" y="86" width="74" height="27"/>
<buttonCell key="cell" type="push" title="Browse…" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" inset="2" id="4920">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -522,7 +525,7 @@ Blu-ray and DVD sources often have multiple titles, the longest of which is typi
</connections>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="50" translatesAutoresizingMaskIntoConstraints="NO" id="gfs-4j-YSE">
- <rect key="frame" x="441" y="94" width="22" height="15"/>
+ <rect key="frame" x="441" y="94" width="22" height="14"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="left" title="To:" id="rfK-nQ-Aq2">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -568,7 +571,7 @@ Blu-ray and DVD sources often have multiple titles, the longest of which is typi
</constraints>
</box>
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bWH-Lp-mKY">
- <rect key="frame" x="66" y="504" width="210" height="22"/>
+ <rect key="frame" x="66" y="505" width="210" height="22"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="204" id="k4L-Sa-g4b"/>
</constraints>
@@ -595,7 +598,7 @@ Blu-ray and DVD sources often have multiple titles, the longest of which is typi
</connections>
</popUpButton>
<textField horizontalHuggingPriority="1000" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="100" translatesAutoresizingMaskIntoConstraints="NO" id="5180">
- <rect key="frame" x="382" y="538" width="41" height="15"/>
+ <rect key="frame" x="382" y="540" width="41" height="14"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Angle:" id="5185">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -611,7 +614,7 @@ Blu-ray and DVD sources often have multiple titles, the longest of which is typi
</connections>
</textField>
<textField horizontalHuggingPriority="1000" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="100" translatesAutoresizingMaskIntoConstraints="NO" id="4NG-AB-JWs">
- <rect key="frame" x="480" y="538" width="43" height="15"/>
+ <rect key="frame" x="480" y="540" width="43" height="14"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="left" title="Range:" id="IxV-PW-oYh">
<font key="font" metaFont="smallSystemBold"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@@ -622,7 +625,7 @@ Blu-ray and DVD sources often have multiple titles, the longest of which is typi
</connections>
</textField>
<button toolTip="Reload the encoding settings for the currently selected preset. Modifications will be discarded." verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="AhR-pK-Oz4">
- <rect key="frame" x="276" y="501" width="62" height="27"/>
+ <rect key="frame" x="276" y="502" width="62" height="27"/>
<buttonCell key="cell" type="push" title="Reload" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="cgS-BU-Nfd">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -638,7 +641,7 @@ Blu-ray and DVD sources often have multiple titles, the longest of which is typi
</connections>
</button>
<button toolTip="Save New Preset…" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2vD-zN-YMe">
- <rect key="frame" x="336" y="501" width="124" height="27"/>
+ <rect key="frame" x="336" y="502" width="124" height="27"/>
<buttonCell key="cell" type="push" title="Save New Preset…" bezelStyle="rounded" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="IOU-3L-nvB">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
@@ -768,7 +771,7 @@ Blu-ray and DVD sources often have multiple titles, the longest of which is typi
<popUpButton key="view" imageHugsTitle="YES" id="pJJ-0V-TQq">
<rect key="frame" x="28" y="14" width="58" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES"/>
- <popUpButtonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="addtitlestoqueue" alignment="center" lineBreakMode="truncatingTail" state="on" imageScaling="proportionallyDown" inset="2" pullsDown="YES" id="BAK-n3-eIN">
+ <popUpButtonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" alignment="center" lineBreakMode="truncatingTail" state="on" imageScaling="proportionallyDown" inset="2" pullsDown="YES" id="BAK-n3-eIN">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" id="QCi-1O-Msg">
@@ -845,7 +848,7 @@ Blu-ray and DVD sources often have multiple titles, the longest of which is typi
<connections>
<outlet property="delegate" destination="-2" id="M3v-Rc-7Ca"/>
</connections>
- <point key="canvasLocation" x="2182" y="-233"/>
+ <point key="canvasLocation" x="2460" y="-738"/>
</window>
<userDefaultsController representsSharedInstance="YES" id="5676"/>
<customView id="lZQ-gl-3wX" userLabel="Open Panel View">
@@ -866,7 +869,7 @@ Blu-ray and DVD sources often have multiple titles, the longest of which is typi
</connections>
</button>
<textField toolTip="Title to scan." verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3w9-Iu-3u2">
- <rect key="frame" x="136" y="11" width="52" height="23"/>
+ <rect key="frame" x="136" y="12" width="52" height="22"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="52" id="BGA-yJ-Apd"/>
</constraints>
diff --git a/macosx/Base.lproj/Queue.xib b/macosx/Base.lproj/Queue.xib
index 8c1906e35..b850fc152 100644
--- a/macosx/Base.lproj/Queue.xib
+++ b/macosx/Base.lproj/Queue.xib
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14313.13.2" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.23.1" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.13.2"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.23.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -10,7 +10,9 @@
<connections>
<outlet property="countTextField" destination="2511" id="7vs-Ty-tNx"/>
<outlet property="outlineView" destination="2597" id="dPQ-wg-8cy"/>
+ <outlet property="pauseToolbarItem" destination="s7o-pK-heI" id="SP7-Fq-gw9"/>
<outlet property="progressTextField" destination="2646" id="E60-Gv-b2q"/>
+ <outlet property="ripToolbarItem" destination="SX6-mq-Hck" id="va2-0n-3T0"/>
<outlet property="window" destination="2576" id="2645"/>
</connections>
</customObject>
diff --git a/macosx/Base.lproj/Video.xib b/macosx/Base.lproj/Video.xib
index 4fc9f01f5..c2b1c556a 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="14269.12" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.23.1" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14269.12"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.23.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -38,7 +38,7 @@
<binding destination="-2" name="textColor" keyPath="self.labelColor" id="pD7-5v-U6l"/>
</connections>
</textField>
- <textField toolTip="Average Bitrate varies quality to ensure the data rate remains relatively consistent throughout the video." verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="A3o-Zx-OfM">
+ <textField toolTip="Average Bitrate varies quality to ensure the data rate remains relatively consistent throughout the video." verticalHuggingPriority="750" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="A3o-Zx-OfM">
<rect key="frame" x="498" y="232" width="78" height="19"/>
<constraints>
<constraint firstAttribute="width" constant="78" id="EZ2-qD-5pb"/>
@@ -592,7 +592,7 @@ This setting is no longer supported and may be removed in a future version. Use
</connections>
</textField>
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="FHY-Ih-1rd">
- <rect key="frame" x="119" y="184" width="781" height="5"/>
+ <rect key="frame" x="119" y="185" width="781" height="5"/>
</box>
<slider verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Biw-5K-pPD">
<rect key="frame" x="106" y="155" width="124" height="18"/>
diff --git a/macosx/HBAppDelegate.m b/macosx/HBAppDelegate.m
index 72e3f3656..e4d78e6fb 100644
--- a/macosx/HBAppDelegate.m
+++ b/macosx/HBAppDelegate.m
@@ -79,6 +79,10 @@
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
+ if (@available (macOS 10.12.2, *))
+ {
+ NSApplication.sharedApplication.automaticCustomizeTouchBarMenuItemEnabled = YES;
+ }
self.presetsMenuBuilder = [[HBPresetsMenuBuilder alloc] initWithMenu:self.presetsMenu
action:@selector(selectPresetFromMenu:)
diff --git a/macosx/HBController.m b/macosx/HBController.m
index fd4b054c7..62330608d 100644
--- a/macosx/HBController.m
+++ b/macosx/HBController.m
@@ -34,6 +34,10 @@
@import HandBrakeKit;
+static void *HBControllerContext = &HBControllerContext;
+static void *HBControllerScanCoreContext = &HBControllerScanCoreContext;
+static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext;
+
@interface HBController () <HBPresetsViewControllerDelegate, HBTitleSelectionDelegate, NSDraggingDestination, NSPopoverDelegate>
{
IBOutlet NSTabView *fMainTabView;
@@ -69,9 +73,6 @@
// Picture Preview
HBPreviewController * fPreviewController;
- // Queue panel
- HBQueueController * fQueueController;
-
// Source box
IBOutlet NSProgressIndicator * fScanIndicator;
IBOutlet NSBox * fScanHorizontalLine;
@@ -123,6 +124,9 @@
/// The HBCore used for scanning.
@property (nonatomic, strong) HBCore *core;
+/// The queue controller.
+@property (nonatomic, strong) HBQueueController *queue;
+
/// Whether the window is visible or occluded,
/// useful to avoid updating the UI needlessly
@property (nonatomic) BOOL visible;
@@ -136,6 +140,16 @@
// Alerts
@property (nonatomic) BOOL suppressCopyProtectionWarning;
+@property (nonatomic) IBOutlet NSToolbarItem *openSourceToolbarItem;
+@property (nonatomic) IBOutlet NSToolbarItem *ripToolbarItem;
+@property (nonatomic) IBOutlet NSToolbarItem *pauseToolbarItem;
+
+@end
+
+@interface HBController (TouchBar) <NSTouchBarProvider, NSTouchBarDelegate>
+- (void)updateButtonsStateForScanCore:(HBState)state;
+- (void)updateButtonsStateForQueueCore:(HBState)state;
+- (void)validateTouchBarsItems;
@end
#define WINDOW_HEIGHT_OFFSET_INIT 48
@@ -156,8 +170,8 @@
fPreviewController = [[HBPreviewController alloc] init];
fPreviewController.documentController = self;
- fQueueController = queueController;
- fQueueController.controller = self;
+ _queue = queueController;
+ _queue.controller = self;
presetManager = manager;
_currentPreset = manager.defaultPreset;
@@ -263,8 +277,19 @@
[[NSUserDefaultsController sharedUserDefaultsController] addObserver:self
forKeyPath:@"values.HBShowAdvancedTab"
options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial
- context:NULL];
+ context:HBControllerContext];
+
+ [self.core addObserver:self forKeyPath:@"state"
+ options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial
+ context:HBControllerScanCoreContext];
+ [self.queue.core addObserver:self forKeyPath:@"state"
+ options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial
+ context:HBControllerQueueCoreContext];
+
+ [self.queue addObserver:self forKeyPath:@"pendingItemsCount"
+ options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial
+ context:HBControllerQueueCoreContext];
self.presetsMenuBuilder = [[HBPresetsMenuBuilder alloc] initWithMenu:self.presetsPopup.menu
action:@selector(selectPresetFromMenu:)
@@ -320,26 +345,89 @@
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
- if ([keyPath isEqualToString:@"values.HBShowAdvancedTab"])
+ if (context == HBControllerContext && [keyPath isEqualToString:@"values.HBShowAdvancedTab"])
{
- if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HBShowAdvancedTab"])
+ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HBShowAdvancedTab"] && ![[fMainTabView tabViewItems] containsObject:fAdvancedTab])
{
- if (![[fMainTabView tabViewItems] containsObject:fAdvancedTab])
- {
- [fMainTabView insertTabViewItem:fAdvancedTab atIndex:5];
- }
+ [fMainTabView insertTabViewItem:fAdvancedTab atIndex:5];
}
else
{
[fMainTabView removeTabViewItem:fAdvancedTab];
}
}
+ else if (context == HBControllerScanCoreContext)
+ {
+ HBState state = [change[NSKeyValueChangeNewKey] intValue];
+ [self updateToolbarButtonsStateForScanCore:state];
+ if (@available(macOS 10.12.2, *))
+ {
+ [self updateButtonsStateForScanCore:state];
+ [self validateTouchBarsItems];
+ }
+ }
+ else if (context == HBControllerQueueCoreContext)
+ {
+ HBState state = self.queue.core.state;
+ [self updateToolbarButtonsStateForQueueCore:state];
+ [self.window.toolbar validateVisibleItems];
+ if (@available(macOS 10.12.2, *))
+ {
+ [self updateButtonsStateForQueueCore:state];
+ [self validateTouchBarsItems];
+ }
+ }
else
{
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
+- (void)updateToolbarButtonsStateForScanCore:(HBState)state
+{
+ if (state == HBStateIdle)
+ {
+ _openSourceToolbarItem.image = [NSImage imageNamed: @"source"];
+ _openSourceToolbarItem.label = NSLocalizedString(@"Open Source", @"Toolbar Open/Cancel Item");
+ _openSourceToolbarItem.toolTip = NSLocalizedString(@"Open Source", @"Toolbar Open/Cancel Item");
+ }
+ else
+ {
+ _openSourceToolbarItem.image = [NSImage imageNamed: @"stopencode"];
+ _openSourceToolbarItem.label = NSLocalizedString(@"Cancel Scan", @"Toolbar Open/Cancel Item");
+ _openSourceToolbarItem.toolTip = NSLocalizedString(@"Cancel Scanning Source", @"Toolbar Open/Cancel Item");
+ }
+}
+
+- (void)updateToolbarButtonsStateForQueueCore:(HBState)state
+{
+ if (state == HBStatePaused)
+ {
+ _pauseToolbarItem.image = [NSImage imageNamed: @"encode"];
+ _pauseToolbarItem.label = NSLocalizedString(@"Resume", @"Toolbar Pause Item");
+ _pauseToolbarItem.toolTip = NSLocalizedString(@"Resume Encoding", @"Toolbar Pause Item");
+ }
+ else
+ {
+ _pauseToolbarItem.image = [NSImage imageNamed:@"pauseencode"];
+ _pauseToolbarItem.label = NSLocalizedString(@"Pause", @"Toolbar Pause Item");
+ _pauseToolbarItem.toolTip = NSLocalizedString(@"Pause Encoding", @"Toolbar Pause Item");
+
+ }
+ if (state == HBStateScanning || state == HBStateWorking || state == HBStateSearching || state == HBStateMuxing || state == HBStatePaused)
+ {
+ _ripToolbarItem.image = [NSImage imageNamed:@"stopencode"];
+ _ripToolbarItem.label = NSLocalizedString(@"Stop", @"Toolbar Start/Stop Item");
+ _ripToolbarItem.toolTip = NSLocalizedString(@"Stop Encoding", @"Toolbar Start/Stop Item");
+ }
+ else
+ {
+ _ripToolbarItem.image = [NSImage imageNamed: @"encode"];
+ _ripToolbarItem.label = _queue.pendingItemsCount > 0 ? NSLocalizedString(@"Start Queue", @"Toolbar Start/Stop Item") : NSLocalizedString(@"Start", @"Toolbar Start/Stop Item");
+ _pauseToolbarItem.toolTip = NSLocalizedString(@"Start Encoding", @"Toolbar Start/Stop Item");
+ }
+}
+
- (void)enableUI:(BOOL)enabled
{
if (enabled)
@@ -364,91 +452,47 @@
#pragma mark - UI Validation
-- (BOOL)validateToolbarItem:(NSToolbarItem *)toolbarItem
+- (BOOL)validateUserIterfaceItemForAction:(SEL)action
{
- SEL action = toolbarItem.action;
-
if (self.core.state == HBStateScanning)
{
if (action == @selector(browseSources:))
{
- [toolbarItem setImage: [NSImage imageNamed: @"stopencode"]];
- [toolbarItem setLabel: NSLocalizedString(@"Cancel Scan", @"Toolbar Open/Cancel Item")];
- [toolbarItem setPaletteLabel: NSLocalizedString(@"Cancel Scanning", @"Toolbar Open/Cancel Item")];
- [toolbarItem setToolTip: NSLocalizedString(@"Cancel Scanning Source", @"Toolbar Open/Cancel Item")];
return YES;
}
-
if (action == @selector(rip:) || action == @selector(addToQueue:))
+ {
return NO;
+ }
}
- else
+ else if (action == @selector(browseSources:))
{
- if (action == @selector(browseSources:))
- {
- [toolbarItem setImage:[NSImage imageNamed:@"source"]];
- [toolbarItem setLabel:NSLocalizedString(@"Open Source", @"Toolbar Open/Cancel Item")];
- [toolbarItem setPaletteLabel:NSLocalizedString(@"Open Source", @"Toolbar Open/Cancel Item")];
- [toolbarItem setToolTip:NSLocalizedString(@"Open Source", @"Toolbar Open/Cancel Item")];
- return YES;
- }
+ return YES;
}
- HBState queueState = fQueueController.core.state;
+ HBState queueState = _queue.core.state;
- if (queueState == HBStateScanning || queueState == HBStateWorking || queueState == HBStateSearching || queueState == HBStateMuxing)
+ if (action == @selector(rip:))
{
- if (action == @selector(rip:))
+ if (queueState == HBStateScanning || queueState == HBStateWorking || queueState == HBStateSearching ||
+ queueState == HBStateMuxing || queueState == HBStatePaused)
{
- [toolbarItem setImage: [NSImage imageNamed: @"stopencode"]];
- [toolbarItem setLabel: NSLocalizedString(@"Stop", @"Toolbar Start/Stop Item")];
- [toolbarItem setPaletteLabel: NSLocalizedString(@"Stop", @"Toolbar Start/Stop Item")];
- [toolbarItem setToolTip: NSLocalizedString(@"Stop Encoding", @"Toolbar Start/Stop Item")];
return YES;
}
- if (action == @selector(pause:))
- {
- [toolbarItem setImage: [NSImage imageNamed: @"pauseencode"]];
- [toolbarItem setLabel: NSLocalizedString(@"Pause", @"Toolbar Pause Item")];
- [toolbarItem setPaletteLabel: NSLocalizedString(@"Pause Encoding", @"Pause Item")];
- [toolbarItem setToolTip: NSLocalizedString(@"Pause Encoding", @"Toolbar Pause Item")];
- return YES;
- }
- }
- else if (queueState == HBStatePaused)
- {
- if (action == @selector(pause:))
+ else
{
- [toolbarItem setImage: [NSImage imageNamed: @"encode"]];
- [toolbarItem setLabel: NSLocalizedString(@"Resume", @"Toolbar Pause Item")];
- [toolbarItem setPaletteLabel: NSLocalizedString(@"Resume Encoding", @"Toolbar Pause Item")];
- [toolbarItem setToolTip: NSLocalizedString(@"Resume Encoding", @"Toolbar Pause Item")];
- return YES;
+ return (self.job != nil || _queue.pendingItemsCount > 0);
}
- if (action == @selector(rip:))
- return YES;
}
- else
- {
- if (action == @selector(rip:))
- {
- [toolbarItem setImage: [NSImage imageNamed: @"encode"]];
- if (fQueueController.pendingItemsCount > 0)
- [toolbarItem setLabel: NSLocalizedString(@"Start Queue", @"Toolbar Start/Stop Item")];
- else
- [toolbarItem setLabel: NSLocalizedString(@"Start", @"Toolbar Start/Stop Item")];
- [toolbarItem setPaletteLabel: NSLocalizedString(@"Start Encoding", @"Toolbar Start/Stop Item")];
- [toolbarItem setToolTip: NSLocalizedString(@"Start Encoding", @"Toolbar Start/Stop Item")];
- }
- if (action == @selector(rip:))
+ if (action == @selector(pause:)) {
+ if (queueState == HBStatePaused)
{
- return (self.job != nil || fQueueController.pendingItemsCount > 0);
+ return YES;
}
-
- if (action == @selector(pause:))
+ else
{
- return NO;
+ return (queueState == HBStateWorking || queueState == HBStateMuxing);
}
}
@@ -460,6 +504,11 @@
return YES;
}
+- (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)anItem
+{
+ return [self validateUserIterfaceItemForAction:anItem.action];
+}
+
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
{
SEL action = menuItem.action;
@@ -475,11 +524,11 @@
}
if (action == @selector(pause:))
{
- return [fQueueController validateMenuItem:menuItem];
+ return [_queue validateMenuItem:menuItem];
}
if (action == @selector(rip:))
{
- BOOL result = [fQueueController validateMenuItem:menuItem];
+ BOOL result = [_queue validateMenuItem:menuItem];
if ([menuItem.title isEqualToString:NSLocalizedString(@"Start Encoding", @"Menu Start/Stop Item")])
{
@@ -646,6 +695,10 @@
completionHandler(self.core.titles);
[self.window.toolbar validateVisibleItems];
+ if (@available(macOS 10.12.2, *))
+ {
+ [self validateTouchBarsItems];
+ }
}];
}
else
@@ -1038,9 +1091,6 @@
self.bottomConstrain.animator.constant = -WINDOW_HEIGHT_OFFSET;
fRipIndicator.hidden = YES;
fRipIndicatorShown = NO;
-
- // Refresh the toolbar buttons
- [self.window.toolbar validateVisibleItems];
}
}
else
@@ -1052,9 +1102,6 @@
self.bottomConstrain.animator.constant = 0;
fRipIndicatorShown = YES;
fRipIndicator.hidden = NO;
-
- // Refresh the toolbar buttons
- [self.window.toolbar validateVisibleItems];
}
}
}
@@ -1094,7 +1141,7 @@
[alert beginSheetModalForWindow:self.window completionHandler:handler];
}
- else if ([fQueueController jobExistAtURL:job.completeOutputURL])
+ else if ([_queue jobExistAtURL:job.completeOutputURL])
{
NSAlert *alert = [[NSAlert alloc] init];
[alert setMessageText:NSLocalizedString(@"There is already a queue item for this destination.", @"File already exists in queue alert -> message")];
@@ -1116,7 +1163,7 @@
*/
- (void)doAddToQueue
{
- [fQueueController addJob:[self.job copy]];
+ [_queue addJob:[self.job copy]];
}
/**
@@ -1139,12 +1186,12 @@
{
// if there are no jobs in the queue, then add this one to the queue and rip
// otherwise, just rip the queue
- if (fQueueController.pendingItemsCount == 0)
+ if (_queue.pendingItemsCount == 0)
{
[self doAddToQueue];
}
- [fQueueController rip:self];
+ [_queue rip:self];
}
/**
@@ -1153,15 +1200,15 @@
- (IBAction)rip:(id)sender
{
// Rip or Cancel ?
- if (fQueueController.core.state == HBStateWorking || fQueueController.core.state == HBStatePaused || fQueueController.core.state == HBStateSearching)
+ if (_queue.core.state == HBStateWorking || _queue.core.state == HBStatePaused || _queue.core.state == HBStateSearching)
{
// Displays an alert asking user if the want to cancel encoding of current job.
- [fQueueController cancelRip:self];
+ [_queue cancelRip:self];
}
// If there are pending jobs in the queue, then this is a rip the queue
- else if (fQueueController.pendingItemsCount > 0)
+ else if (_queue.pendingItemsCount > 0)
{
- [fQueueController rip:self];
+ [_queue rip:self];
}
else
{
@@ -1179,7 +1226,7 @@
- (IBAction)pause:(id)sender
{
- [fQueueController togglePauseResume:sender];
+ [_queue togglePauseResume:sender];
}
#pragma mark -
@@ -1234,7 +1281,7 @@
[destinations addObject:job.completeOutputURL];
}
- if ([[NSFileManager defaultManager] fileExistsAtPath:job.completeOutputURL.path] || [fQueueController jobExistAtURL:job.completeOutputURL])
+ if ([[NSFileManager defaultManager] fileExistsAtPath:job.completeOutputURL.path] || [_queue jobExistAtURL:job.completeOutputURL])
{
fileExists = YES;
break;
@@ -1269,13 +1316,13 @@
[alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse returnCode) {
if (returnCode == NSAlertSecondButtonReturn)
{
- [self->fQueueController addJobsFromArray:jobs];
+ [self->_queue addJobsFromArray:jobs];
}
}];
}
else
{
- [fQueueController addJobsFromArray:jobs];
+ [_queue addJobsFromArray:jobs];
}
}
@@ -1491,3 +1538,141 @@
}
@end
+
+@implementation HBController (TouchBar)
+
+static NSTouchBarItemIdentifier HBTouchBarMain = @"fr.handbrake.mainWindowTouchBar";
+
+static NSTouchBarItemIdentifier HBTouchBarOpen = @"fr.handbrake.openSource";
+static NSTouchBarItemIdentifier HBTouchBarAddToQueue = @"fr.handbrake.addToQueue";
+static NSTouchBarItemIdentifier HBTouchBarRip = @"fr.handbrake.rip";
+static NSTouchBarItemIdentifier HBTouchBarPause = @"fr.handbrake.pause";
+static NSTouchBarItemIdentifier HBTouchBarPreview = @"fr.handbrake.preview";
+
+- (NSTouchBar *)makeTouchBar
+{
+ NSTouchBar *bar = [[NSTouchBar alloc] init];
+ bar.delegate = self;
+
+ bar.defaultItemIdentifiers = @[HBTouchBarOpen, NSTouchBarItemIdentifierFixedSpaceSmall, HBTouchBarAddToQueue, NSTouchBarItemIdentifierFixedSpaceLarge, HBTouchBarRip, HBTouchBarPause, NSTouchBarItemIdentifierFixedSpaceLarge, HBTouchBarPreview];
+
+ bar.customizationIdentifier = HBTouchBarMain;
+ bar.customizationAllowedItemIdentifiers = @[HBTouchBarOpen, HBTouchBarAddToQueue, HBTouchBarRip, HBTouchBarPause, HBTouchBarPreview];
+
+ return bar;
+}
+
+- (NSTouchBarItem *)touchBar:(NSTouchBar *)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier
+{
+ if ([identifier isEqualTo:HBTouchBarOpen])
+ {
+ NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier];
+ item.customizationLabel = NSLocalizedString(@"Open Source", @"Touch bar");
+
+ NSButton *button = [NSButton buttonWithTitle:NSLocalizedString(@"Open Source", @"Touch bar") target:self action:@selector(browseSources:)];
+
+ item.view = button;
+ return item;
+ }
+ else if ([identifier isEqualTo:HBTouchBarAddToQueue])
+ {
+ NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier];
+ item.customizationLabel = NSLocalizedString(@"Add to Queue", @"Touch bar");
+
+ NSButton *button = [NSButton buttonWithTitle:NSLocalizedString(@"Add to Queue", @"Touch bar") target:self action:@selector(addToQueue:)];
+
+ item.view = button;
+ return item;
+ }
+ else if ([identifier isEqualTo:HBTouchBarRip])
+ {
+ NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier];
+ item.customizationLabel = NSLocalizedString(@"Rip", @"Touch bar");
+
+ NSButton *button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarPlayTemplate] target:self action:@selector(rip:)];
+
+ item.view = button;
+ return item;
+ }
+ else if ([identifier isEqualTo:HBTouchBarPause])
+ {
+ NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier];
+ item.customizationLabel = NSLocalizedString(@"Pause", @"Touch bar");
+
+ NSButton *button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarPauseTemplate] target:self action:@selector(pause:)];
+
+ item.view = button;
+ return item;
+ }
+ else if ([identifier isEqualTo:HBTouchBarPreview])
+ {
+ NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier];
+ item.customizationLabel = NSLocalizedString(@"Show Preview", @"Touch bar");
+
+ NSButton *button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarQuickLookTemplate] target:self action:@selector(showPreviewWindow:)];
+
+ item.view = button;
+ return item;
+ }
+
+ return nil;
+}
+
+- (void)updateButtonsStateForScanCore:(HBState)state
+{
+ NSButton *openButton = (NSButton *)[[self.touchBar itemForIdentifier:HBTouchBarOpen] view];
+
+ NSButton *addToQueueButton = (NSButton *)[[self.touchBar itemForIdentifier:HBTouchBarAddToQueue] view];
+ NSButton *previewButton = (NSButton *)[[self.touchBar itemForIdentifier:HBTouchBarPreview] view];
+
+ if (state == HBStateIdle)
+ {
+ openButton.title = NSLocalizedString(@"Open Source", @"Touch bar");
+ addToQueueButton.enabled = NO;
+ previewButton.enabled = NO;
+ }
+ else
+ {
+ openButton.title = NSLocalizedString(@"Cancel scan", @"Touch bar");
+ addToQueueButton.enabled = YES;
+ }
+}
+
+- (void)updateButtonsStateForQueueCore:(HBState)state;
+{
+ NSButton *ripButton = (NSButton *)[[self.touchBar itemForIdentifier:HBTouchBarRip] view];
+ NSButton *pauseButton = (NSButton *)[[self.touchBar itemForIdentifier:HBTouchBarPause] view];
+
+ if (state == HBStateScanning || state == HBStateWorking || state == HBStateSearching || state == HBStateMuxing)
+ {
+ ripButton.image = [NSImage imageNamed:NSImageNameTouchBarRecordStopTemplate];
+ pauseButton.image = [NSImage imageNamed:NSImageNameTouchBarPauseTemplate];
+ }
+ else if (state == HBStatePaused)
+ {
+ ripButton.image = [NSImage imageNamed:NSImageNameTouchBarRecordStopTemplate];
+ pauseButton.image = [NSImage imageNamed:NSImageNameTouchBarPlayTemplate];
+ }
+ else if (state == HBStateIdle)
+ {
+ ripButton.image = [NSImage imageNamed:NSImageNameTouchBarPlayTemplate];
+ pauseButton.image = [NSImage imageNamed:NSImageNameTouchBarPauseTemplate];
+ }
+}
+
+- (void)validateTouchBarsItems
+{
+ for (NSTouchBarItemIdentifier identifier in self.touchBar.itemIdentifiers) {
+ NSTouchBarItem *item = [self.touchBar itemForIdentifier:identifier];
+ NSView *view = item.view;
+ if ([view isKindOfClass:[NSButton class]]) {
+ NSButton *button = (NSButton *)view;
+ BOOL enabled = [self validateUserIterfaceItemForAction:button.action];
+ button.enabled = enabled;
+ }
+ }
+}
+
+@dynamic touchBar;
+
+@end
diff --git a/macosx/HBCore.m b/macosx/HBCore.m
index b2252183d..de9a26941 100644
--- a/macosx/HBCore.m
+++ b/macosx/HBCore.m
@@ -546,7 +546,10 @@ typedef void (^HBCoreCleanupHandler)(void);
}
// Update HBCore state to reflect the current state of libhb
- self.state = _hb_state->state;
+ if (_state != _hb_state->state)
+ {
+ self.state = _hb_state->state;
+ }
// Call the handler for the current state
if (_hb_state->state == HB_STATE_WORKDONE || _hb_state->state == HB_STATE_SCANDONE)
diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m
index 519aef569..78df3bcb4 100644
--- a/macosx/HBQueueController.m
+++ b/macosx/HBQueueController.m
@@ -28,6 +28,8 @@
// DockTile update frequency in total percent increment
#define dockTileUpdateFrequency 0.1f
+static void *HBControllerQueueCoreContext = &HBControllerQueueCoreContext;
+
@interface HBQueueController () <NSOutlineViewDataSource, HBQueueOutlineViewDelegate, NSUserNotificationCenterDelegate>
/// Whether the window is visible or occluded,
@@ -44,6 +46,9 @@
@property (unsafe_unretained) IBOutlet NSTextField *countTextField;
@property (unsafe_unretained) IBOutlet HBQueueOutlineView *outlineView;
+@property (nonatomic) IBOutlet NSToolbarItem *ripToolbarItem;
+@property (nonatomic) IBOutlet NSToolbarItem *pauseToolbarItem;
+
@property (nonatomic, readonly) NSMutableDictionary *descriptions;
@property (nonatomic, readonly) HBDistributedArray<HBJob *> *jobs;
@@ -59,6 +64,11 @@
@end
+@interface HBQueueController (TouchBar) <NSTouchBarProvider, NSTouchBarDelegate>
+- (void)updateButtonsStateForQueueCore:(HBState)state;
+- (void)validateTouchBarsItems;
+@end
+
@implementation HBQueueController
- (instancetype)initWithURL:(NSURL *)queueURL;
@@ -106,10 +116,65 @@
[self.outlineView setVerticalMotionCanBeginDrag:YES];
[self updateQueueStats];
+
+ [self.core addObserver:self forKeyPath:@"state"
+ options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial
+ context:HBControllerQueueCoreContext];
+ [self addObserver:self forKeyPath:@"pendingItemsCount"
+ options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial
+ context:HBControllerQueueCoreContext];
+}
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+{
+ if (context == HBControllerQueueCoreContext)
+ {
+ HBState state = self.core.state;
+ [self updateToolbarButtonsStateForQueueCore:state];
+ [self.window.toolbar validateVisibleItems];
+ if (@available(macOS 10.12.2, *))
+ {
+ [self updateButtonsStateForQueueCore:state];
+ [self validateTouchBarsItems];
+ }
+ }
+ else
+ {
+ [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
+ }
}
#pragma mark Toolbar
+- (void)updateToolbarButtonsStateForQueueCore:(HBState)state
+{
+ if (state == HBStatePaused)
+ {
+ _pauseToolbarItem.image = [NSImage imageNamed: @"encode"];
+ _pauseToolbarItem.label = NSLocalizedString(@"Resume", @"Toolbar Pause Item");
+ _pauseToolbarItem.toolTip = NSLocalizedString(@"Resume Encoding", @"Toolbar Pause Item");
+ }
+ else
+ {
+ _pauseToolbarItem.image = [NSImage imageNamed:@"pauseencode"];
+ _pauseToolbarItem.label = NSLocalizedString(@"Pause", @"Toolbar Pause Item");
+ _pauseToolbarItem.toolTip = NSLocalizedString(@"Pause Encoding", @"Toolbar Pause Item");
+
+ }
+ if (state == HBStateScanning || state == HBStateWorking || state == HBStateSearching || state == HBStateMuxing || state == HBStatePaused)
+ {
+ _ripToolbarItem.image = [NSImage imageNamed:@"stopencode"];
+ _ripToolbarItem.label = NSLocalizedString(@"Stop", @"Toolbar Start/Stop Item");
+ _ripToolbarItem.toolTip = NSLocalizedString(@"Stop Encoding", @"Toolbar Start/Stop Item");
+ }
+ else
+ {
+ _ripToolbarItem.image = [NSImage imageNamed: @"encode"];
+ _ripToolbarItem.label = NSLocalizedString(@"Start", @"Toolbar Start/Stop Item");
+ _pauseToolbarItem.toolTip = NSLocalizedString(@"Start Encoding", @"Toolbar Start/Stop Item");
+ }
+}
+
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
{
SEL action = menuItem.action;
@@ -169,25 +234,18 @@
return YES;
}
-- (BOOL)validateToolbarItem:(NSToolbarItem *)theItem
+- (BOOL)validateUserIterfaceItemForAction:(SEL)action
{
- SEL action = theItem.action;
HBState s = self.core.state;
if (action == @selector(toggleStartCancel:))
{
if ((s == HBStateScanning) || (s == HBStatePaused) || (s == HBStateWorking) || (s == HBStateMuxing))
{
- theItem.image = [NSImage imageNamed:@"stopencode"];
- theItem.label = NSLocalizedString(@"Stop", @"Queue Toolbar -> start/stop item title");
- theItem.toolTip = NSLocalizedString(@"Stop Encoding", @"Queue Toolbar -> start/stop item tooltip");
return YES;
}
else
{
- theItem.image = [NSImage imageNamed:@"encode"];
- theItem.label = NSLocalizedString(@"Start", @"Queue Toolbar -> start/stop item title");
- theItem.toolTip = NSLocalizedString(@"Start Encoding", @"Queue Toolbar -> start/stop item tooltip");
return (self.pendingItemsCount > 0);
}
}
@@ -196,16 +254,10 @@
{
if (s == HBStatePaused)
{
- theItem.image = [NSImage imageNamed:@"encode"];
- theItem.label = NSLocalizedString(@"Resume", @"Queue Toolbar -> pause/resume item title");
- theItem.toolTip = NSLocalizedString(@"Resume Encoding", @"Queue Toolbar -> pause/resume item tooltip");
return YES;
}
else
{
- theItem.image = [NSImage imageNamed:@"pauseencode"];
- theItem.label = NSLocalizedString(@"Pause", @"Queue Toolbar -> pause/resume item title");
- theItem.toolTip = NSLocalizedString(@"Pause Encoding", @"Queue Toolbar -> pause/resume item tooltip");
return (s == HBStateWorking || s == HBStateMuxing);
}
}
@@ -213,6 +265,12 @@
return NO;
}
+- (BOOL)validateToolbarItem:(NSToolbarItem *)theItem
+{
+ SEL action = theItem.action;
+ return [self validateUserIterfaceItemForAction:action];
+}
+
#pragma mark - Public methods
- (void)addJob:(HBJob *)item
@@ -1600,7 +1658,7 @@
#pragma mark NSOutlineView drag & drop
-- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard
+- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray<HBJob *> *)items toPasteboard:(NSPasteboard *)pboard
{
// Dragging is only allowed of the pending items.
if ([items[0] state] != HBJobStateReady)
@@ -1655,3 +1713,89 @@
}
@end
+
+@implementation HBQueueController (TouchBar)
+
+static NSTouchBarItemIdentifier HBTouchBarMain = @"fr.handbrake.queueWindowTouchBar";
+
+static NSTouchBarItemIdentifier HBTouchBarRip = @"fr.handbrake.rip";
+static NSTouchBarItemIdentifier HBTouchBarPause = @"fr.handbrake.pause";
+
+- (NSTouchBar *)makeTouchBar
+{
+ NSTouchBar *bar = [[NSTouchBar alloc] init];
+ bar.delegate = self;
+
+ bar.defaultItemIdentifiers = @[HBTouchBarRip, HBTouchBarPause];
+
+ bar.customizationIdentifier = HBTouchBarMain;
+ bar.customizationAllowedItemIdentifiers = @[HBTouchBarRip, HBTouchBarPause];
+
+ return bar;
+}
+
+- (NSTouchBarItem *)touchBar:(NSTouchBar *)touchBar makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier
+{
+ if ([identifier isEqualTo:HBTouchBarRip])
+ {
+ NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier];
+ item.customizationLabel = NSLocalizedString(@"Rip", @"Touch bar");
+
+ NSButton *button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarPlayTemplate] target:self action:@selector(toggleStartCancel:)];
+
+ item.view = button;
+ return item;
+ }
+ else if ([identifier isEqualTo:HBTouchBarPause])
+ {
+ NSCustomTouchBarItem *item = [[NSCustomTouchBarItem alloc] initWithIdentifier:identifier];
+ item.customizationLabel = NSLocalizedString(@"Pause", @"Touch bar");
+
+ NSButton *button = [NSButton buttonWithImage:[NSImage imageNamed:NSImageNameTouchBarPauseTemplate] target:self action:@selector(togglePauseResume:)];
+
+ item.view = button;
+ return item;
+ }
+
+ return nil;
+}
+
+- (void)updateButtonsStateForQueueCore:(HBState)state;
+{
+ NSButton *ripButton = (NSButton *)[[self.touchBar itemForIdentifier:HBTouchBarRip] view];
+ NSButton *pauseButton = (NSButton *)[[self.touchBar itemForIdentifier:HBTouchBarPause] view];
+
+ if (state == HBStateScanning || state == HBStateWorking || state == HBStateSearching || state == HBStateMuxing)
+ {
+ ripButton.image = [NSImage imageNamed:NSImageNameTouchBarRecordStopTemplate];
+ pauseButton.image = [NSImage imageNamed:NSImageNameTouchBarPauseTemplate];
+ }
+ else if (state == HBStatePaused)
+ {
+ ripButton.image = [NSImage imageNamed:NSImageNameTouchBarRecordStopTemplate];
+ pauseButton.image = [NSImage imageNamed:NSImageNameTouchBarPlayTemplate];
+ }
+ else if (state == HBStateIdle)
+ {
+ ripButton.image = [NSImage imageNamed:NSImageNameTouchBarPlayTemplate];
+ pauseButton.image = [NSImage imageNamed:NSImageNameTouchBarPauseTemplate];
+ }
+}
+
+- (void)validateTouchBarsItems
+{
+ for (NSTouchBarItemIdentifier identifier in self.touchBar.itemIdentifiers) {
+ NSTouchBarItem *item = [self.touchBar itemForIdentifier:identifier];
+ NSView *view = item.view;
+ if ([view isKindOfClass:[NSButton class]]) {
+ NSButton *button = (NSButton *)view;
+ BOOL enabled = [self validateUserIterfaceItemForAction:button.action];
+ button.enabled = enabled;
+ }
+ }
+}
+
+@dynamic touchBar;
+
+@end
+