Skip to content

Commit

Permalink
MacGui: add a popover to edit tracks names.
Browse files Browse the repository at this point in the history
  • Loading branch information
galad87 committed Sep 26, 2019
1 parent cc03179 commit a681474
Show file tree
Hide file tree
Showing 8 changed files with 254 additions and 39 deletions.
86 changes: 62 additions & 24 deletions macosx/Base.lproj/Audio.xib

Large diffs are not rendered by default.

64 changes: 51 additions & 13 deletions macosx/Base.lproj/Subtitles.xib
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15400" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15400"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="HBSubtitlesController">
<connections>
<outlet property="table" destination="0yM-wE-D2x" id="YbV-Eu-Sie"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
Expand Down Expand Up @@ -94,13 +95,13 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnReordering="NO" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="25" rowSizeStyle="automatic" headerView="IiW-3a-Drv" viewBased="YES" id="0yM-wE-D2x">
<rect key="frame" x="0.0" y="0.0" width="884" height="234"/>
<rect key="frame" x="0.0" y="0.0" width="885" height="234"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn identifier="track" editable="NO" width="320" minWidth="40" maxWidth="1000" id="N3S-st-yGv">
<tableColumn identifier="track" editable="NO" width="290" minWidth="40" maxWidth="1000" id="N3S-st-yGv">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Track">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
Expand All @@ -118,11 +119,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="EZp-rc-7mo">
<rect key="frame" x="1" y="1" width="320" height="25"/>
<rect key="frame" x="1" y="1" width="290" height="25"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<popUpButton toolTip="Subtitles language and type." verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Tf3-cP-TGw">
<rect key="frame" x="0.0" y="1" width="320" height="22"/>
<rect key="frame" x="0.0" y="1" width="290" height="22"/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="JWk-Ab-hdY">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
Expand Down Expand Up @@ -162,7 +163,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="zKg-by-KFV">
<rect key="frame" x="324" y="1" width="76" height="25"/>
<rect key="frame" x="294" y="1" width="76" height="25"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button toolTip="Forced Only. Use only subtitles marked as “forced” in the selected source track." translatesAutoresizingMaskIntoConstraints="NO" id="HC5-ql-Vcr">
Expand Down Expand Up @@ -200,7 +201,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="gxH-yz-YRK">
<rect key="frame" x="403" y="1" width="64" height="25"/>
<rect key="frame" x="373" y="1" width="64" height="25"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button toolTip="Burned In. Make the selected subtitles permanent by overlaying them onto the video track." translatesAutoresizingMaskIntoConstraints="NO" id="zpm-9Z-Hsq">
Expand Down Expand Up @@ -242,7 +243,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="mQ6-s6-Zm2">
<rect key="frame" x="470" y="1" width="51" height="25"/>
<rect key="frame" x="440" y="1" width="51" height="25"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button toolTip="Default flag. Mark the selected subtitles track as the default to be displayed on playback." translatesAutoresizingMaskIntoConstraints="NO" id="mdO-Qu-3Pb">
Expand Down Expand Up @@ -283,7 +284,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="4bh-my-GeM">
<rect key="frame" x="524" y="1" width="171" height="25"/>
<rect key="frame" x="494" y="1" width="171" height="25"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<popUpButton toolTip="Language of the selected SRT/SSA format source track. Not applicable to other formats." verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Inz-O5-B8g">
Expand Down Expand Up @@ -333,7 +334,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="ZBK-cc-m0z">
<rect key="frame" x="698" y="1" width="113" height="25"/>
<rect key="frame" x="668" y="1" width="113" height="25"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<popUpButton toolTip="Character encoding/codeset of the selected SRT/SSA format source track. Not applicable to other formats." verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QV0-kE-4yR">
Expand Down Expand Up @@ -379,7 +380,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="9tV-iL-oaF">
<rect key="frame" x="814" y="1" width="68" height="17"/>
<rect key="frame" x="784" y="1" width="68" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField toolTip="Positive or negative offset in milliseconds (ms) for the selected SRT/SSA format source track. Not applicable to other formats." verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="aJi-zQ-0cg">
Expand Down Expand Up @@ -412,6 +413,39 @@
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn width="28" minWidth="28" maxWidth="28" id="9QI-EX-yTT">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="gYk-0C-2tR">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="FiE-Us-vj1">
<rect key="frame" x="855" y="1" width="28" height="25"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="bFt-wX-C9J">
<rect key="frame" x="-3" y="-2" width="34" height="27"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" bezelStyle="rounded" image="NSActionTemplate" imagePosition="only" alignment="center" controlSize="small" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="A3l-TZ-bBd">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
</buttonCell>
<connections>
<action selector="showAdditionalSettingsPopOver:" target="-2" id="lYo-do-opD"/>
<binding destination="FiE-Us-vj1" name="enabled" keyPath="objectValue.isEnabled" id="ptR-gm-qhm"/>
</connections>
</button>
</subviews>
</tableCellView>
</prototypeCellViews>
</tableColumn>
</tableColumns>
<accessibility description="Subtitles tracks"/>
<connections>
Expand All @@ -421,6 +455,7 @@
<string key="NSValueTransformerName">NSIsNotNil</string>
</dictionary>
</binding>
<outlet property="delegate" destination="-2" id="qvK-X0-R9e"/>
<outlet property="menu" destination="KgC-dn-Hq2" id="Iff-7t-kdg"/>
</connections>
</tableView>
Expand All @@ -434,7 +469,7 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
<tableHeaderView key="headerView" id="IiW-3a-Drv">
<rect key="frame" x="0.0" y="0.0" width="884" height="23"/>
<rect key="frame" x="0.0" y="0.0" width="885" height="23"/>
<autoresizingMask key="autoresizingMask"/>
</tableHeaderView>
</scrollView>
Expand Down Expand Up @@ -493,4 +528,7 @@
<point key="canvasLocation" x="-18" y="437"/>
</menu>
</objects>
<resources>
<image name="NSActionTemplate" width="14" height="14"/>
</resources>
</document>
13 changes: 13 additions & 0 deletions macosx/HBAudioController.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@

#import "HBAudioController.h"
#import "HBAudioDefaultsController.h"
#import "HBTrackTitleViewController.h"

@import HandBrakeKit;

@interface HBAudioController ()

@property (nonatomic, readwrite, strong) HBAudioDefaultsController *defaultsController;
@property (nonatomic, weak) IBOutlet NSTableView *table;

@end

Expand All @@ -38,6 +40,17 @@ - (IBAction)removeAll:(id)sender
[self.audio removeAll];
}

- (IBAction)showAdditionalSettingsPopOver:(id)sender
{
HBTrackTitleViewController *controller = [[HBTrackTitleViewController alloc] init];
NSInteger index = [self.table rowForView:sender];
if (index != -1)
{
controller.track = [self.audio objectInTracksAtIndex:index];
[self presentViewController:controller asPopoverRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSRectEdgeMinX behavior:NSPopoverBehaviorTransient];
}
}

#pragma mark - Defaults

- (IBAction)showSettingsSheet:(id)sender
Expand Down
14 changes: 13 additions & 1 deletion macosx/HBSubtitlesController.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

#import "HBSubtitlesController.h"
#import "HBSubtitlesDefaultsController.h"
#import "HBTrackTitleViewController.h"

@import HandBrakeKit;

@interface HBSubtitlesController ()

// Defaults
@property (nonatomic, readwrite, strong) HBSubtitlesDefaultsController *defaultsController;
@property (nonatomic, weak) IBOutlet NSTableView *table;

@end

Expand Down Expand Up @@ -70,6 +71,17 @@ - (IBAction)showSettingsSheet:(id)sender
}];
}

- (IBAction)showAdditionalSettingsPopOver:(id)sender
{
HBTrackTitleViewController *controller = [[HBTrackTitleViewController alloc] init];
NSInteger index = [self.table rowForView:sender];
if (index != -1)
{
controller.track = [self.subtitles objectInTracksAtIndex:index];
[self presentViewController:controller asPopoverRelativeToRect:[sender bounds] ofView:sender preferredEdge:NSRectEdgeMinX behavior:NSPopoverBehaviorTransient];
}
}

#pragma mark - External subtitles import

/**
Expand Down
18 changes: 18 additions & 0 deletions macosx/HBTrackTitleViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// HBTrackTitleViewController.h
// HandBrake
//
// Created by Damiano Galassi on 26/09/2019.
//

#import <Cocoa/Cocoa.h>

NS_ASSUME_NONNULL_BEGIN

@interface HBTrackTitleViewController : NSViewController

@property (nonatomic) id track;

@end

NS_ASSUME_NONNULL_END
16 changes: 16 additions & 0 deletions macosx/HBTrackTitleViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// HBTrackTitleViewController.m
// HandBrake
//
// Created by Damiano Galassi on 26/09/2019.
//

#import "HBTrackTitleViewController.h"

@interface HBTrackTitleViewController ()

@end

@implementation HBTrackTitleViewController

@end
Loading

0 comments on commit a681474

Please sign in to comment.