Rewrite the file import controller in swift.
This commit is contained in:
9 files changed
+594
-787
No files matched your search
@@ -1,16 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13528" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13528"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="SBFileImport">
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="FileImportController" customModule="Subler" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="addTracksButton" destination="25" id="33"/>
|
||||
<outlet property="importMetadata" destination="36" id="38"/>
|
||||
<outlet property="tracksTableView" destination="7" id="qn7-PC-KQu"/>
|
||||
<outlet property="addButton" destination="25" id="Nec-Ur-WuH"/>
|
||||
<outlet property="importMetadata" destination="36" id="ctf-Cj-LBY"/>
|
||||
<outlet property="tableView" destination="7" id="fqn-pa-2UI"/>
|
||||
<outlet property="window" destination="1" id="3"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
@@ -32,7 +32,7 @@
|
||||
<rect key="frame" x="1" y="0.0" width="602" height="188"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" autosaveColumns="NO" headerView="d1E-cV-kwd" id="7" customClass="SBTableView">
|
||||
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" autosaveColumns="NO" rowSizeStyle="automatic" headerView="d1E-cV-kwd" viewBased="YES" id="7" customClass="SBTableView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="602" height="165"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<size key="intercellSpacing" width="3" height="2"/>
|
||||
@@ -49,6 +49,25 @@
|
||||
<font key="font" metaFont="system"/>
|
||||
</customCell>
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView identifier="check" id="MEZ-zI-j7A" customClass="SBCheckBoxCellView">
|
||||
<rect key="frame" x="1" y="1" width="20" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="sgl-Nd-VyZ">
|
||||
<rect key="frame" x="1" y="-2" width="23" height="20"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="left" controlSize="small" state="on" inset="2" id="vja-6g-gbE">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
</subviews>
|
||||
<connections>
|
||||
<outlet property="checkboxButton" destination="sgl-Nd-VyZ" id="GVn-qM-29C"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
</prototypeCellViews>
|
||||
</tableColumn>
|
||||
<tableColumn identifier="trackId" editable="NO" width="26" minWidth="25" maxWidth="30" id="10">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Id">
|
||||
@@ -62,6 +81,26 @@
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView id="6VI-ju-vEZ">
|
||||
<rect key="frame" x="24" y="1" width="26" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rZL-VU-9do">
|
||||
<rect key="frame" x="0.0" y="0.0" width="26" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="id" id="8jV-de-dNQ">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<connections>
|
||||
<outlet property="textField" destination="rZL-VU-9do" id="iAU-fO-B3g"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
</prototypeCellViews>
|
||||
</tableColumn>
|
||||
<tableColumn identifier="trackName" editable="NO" width="159" minWidth="40" maxWidth="400" id="15">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Name">
|
||||
@@ -75,6 +114,26 @@
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView id="mo6-bX-0Lf">
|
||||
<rect key="frame" x="53" y="1" width="159" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vTg-ca-LBV">
|
||||
<rect key="frame" x="0.0" y="0.0" width="159" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="yoP-fP-lic">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<connections>
|
||||
<outlet property="textField" destination="vTg-ca-LBV" id="CQp-O2-hGS"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
</prototypeCellViews>
|
||||
</tableColumn>
|
||||
<tableColumn identifier="trackDuration" editable="NO" width="84" minWidth="10" maxWidth="110" id="17">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="Duration">
|
||||
@@ -88,6 +147,26 @@
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView id="24X-IQ-waU">
|
||||
<rect key="frame" x="215" y="1" width="84" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="p2s-Yz-qhZ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="84" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="right" title="0" id="bif-2e-3RV">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<connections>
|
||||
<outlet property="textField" destination="p2s-Yz-qhZ" id="I3Q-Av-NaP"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
</prototypeCellViews>
|
||||
</tableColumn>
|
||||
<tableColumn identifier="trackLanguage" editable="NO" width="86" minWidth="10" maxWidth="90" id="20">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="Language">
|
||||
@@ -101,6 +180,26 @@
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView id="4Bb-uI-db9">
|
||||
<rect key="frame" x="302" y="1" width="86" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="25J-SB-aeF">
|
||||
<rect key="frame" x="0.0" y="0.0" width="86" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="right" title="Lang" id="j7R-zS-fPy">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<connections>
|
||||
<outlet property="textField" destination="25J-SB-aeF" id="an4-II-z6L"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
</prototypeCellViews>
|
||||
</tableColumn>
|
||||
<tableColumn identifier="trackInfo" editable="NO" width="82" minWidth="10" maxWidth="90" id="22">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="Info">
|
||||
@@ -114,6 +213,26 @@
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView id="W2R-SU-mbL">
|
||||
<rect key="frame" x="391" y="1" width="82" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="HCv-KV-l7J">
|
||||
<rect key="frame" x="0.0" y="0.0" width="82" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="right" title="Info" id="gDY-tC-Ecv">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<connections>
|
||||
<outlet property="textField" destination="HCv-KV-l7J" id="Sod-SP-eWY"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
</prototypeCellViews>
|
||||
</tableColumn>
|
||||
<tableColumn identifier="trackAction" width="124" minWidth="10" maxWidth="3.4028234663852886e+38" id="39">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Action">
|
||||
@@ -125,6 +244,32 @@
|
||||
<font key="font" metaFont="system"/>
|
||||
</customCell>
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView id="K4f-NU-em4" customClass="SBPopUpCellView">
|
||||
<rect key="frame" x="476" y="1" width="124" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<popUpButton fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="pAl-i2-yhV">
|
||||
<rect key="frame" x="0.0" y="-2" width="120" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<popUpButtonCell key="cell" type="bevel" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" imageScaling="proportionallyDown" inset="2" selectedItem="Iwa-6U-c3K" id="VtC-oc-VAC">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" id="6Oy-4J-Chg">
|
||||
<items>
|
||||
<menuItem title="Item 1" state="on" id="Iwa-6U-c3K"/>
|
||||
<menuItem title="Item 2" id="7hk-eT-JuK"/>
|
||||
<menuItem title="Item 3" id="kEW-n7-zA2"/>
|
||||
</items>
|
||||
</menu>
|
||||
</popUpButtonCell>
|
||||
</popUpButton>
|
||||
</subviews>
|
||||
<connections>
|
||||
<outlet property="popUpButton" destination="pAl-i2-yhV" id="mu9-zP-rn5"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
</prototypeCellViews>
|
||||
</tableColumn>
|
||||
</tableColumns>
|
||||
<connections>
|
||||
@@ -198,15 +343,18 @@ Gw
|
||||
<constraint firstItem="26" firstAttribute="baseline" secondItem="25" secondAttribute="baseline" id="AlZ-k8-usu"/>
|
||||
<constraint firstAttribute="bottom" secondItem="26" secondAttribute="bottom" constant="20" symbolic="YES" id="KcL-sz-rgd"/>
|
||||
<constraint firstItem="4" firstAttribute="leading" secondItem="36" secondAttribute="leading" id="P6D-hW-Duj"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="13" secondAttribute="trailing" constant="20" symbolic="YES" id="T2S-ze-SOI"/>
|
||||
<constraint firstItem="26" firstAttribute="width" secondItem="25" secondAttribute="width" id="YQp-jV-dmE"/>
|
||||
<constraint firstItem="26" firstAttribute="top" secondItem="4" secondAttribute="bottom" constant="8" id="ZjP-E3-av1"/>
|
||||
<constraint firstItem="13" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="19" id="iOs-ID-2Ec"/>
|
||||
<constraint firstAttribute="trailing" secondItem="4" secondAttribute="trailing" constant="20" symbolic="YES" id="mnc-3M-tQv"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="36" secondAttribute="trailing" constant="20" symbolic="YES" id="nAK-TB-b06"/>
|
||||
<constraint firstItem="4" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="20" symbolic="YES" id="oU0-Yr-ZwO"/>
|
||||
<constraint firstItem="25" firstAttribute="leading" secondItem="26" secondAttribute="trailing" constant="12" symbolic="YES" id="rNA-mf-SdH"/>
|
||||
<constraint firstItem="26" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="2" secondAttribute="leading" constant="20" symbolic="YES" id="xcH-VR-g52"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<point key="canvasLocation" x="27" y="88"/>
|
||||
<point key="canvasLocation" x="391" y="126.5"/>
|
||||
</window>
|
||||
<menu id="Nqo-5L-aDh">
|
||||
<items>
|
||||
@@ -11,34 +11,445 @@ protocol FileImportControllerDelegate : AnyObject {
|
||||
func didSelect(tracks: [MP42Track], metadata: MP42Metadata?)
|
||||
}
|
||||
|
||||
class FileImportController: NSWindowController {
|
||||
class FileImportController: NSWindowController, NSTableViewDataSource, NSTableViewDelegate {
|
||||
|
||||
private let fileURLs: [URL]
|
||||
private let fileImporters: [MP42FileImporter]
|
||||
|
||||
private weak var delegate: FileImportControllerDelegate?
|
||||
private let items: [ItemType]
|
||||
|
||||
private enum ItemType {
|
||||
case header(String)
|
||||
case track(TrackSettings)
|
||||
}
|
||||
|
||||
private struct TrackAction {
|
||||
let title: String
|
||||
let tag: Int
|
||||
let enabled: Bool
|
||||
}
|
||||
|
||||
private class TrackSettings {
|
||||
let track: MP42Track
|
||||
let importable: Bool
|
||||
let actions: [TrackAction]
|
||||
var selectedActionTag: UInt
|
||||
var checked: Bool
|
||||
|
||||
init(track: MP42Track) {
|
||||
self.track = track
|
||||
|
||||
let needsConversion = trackNeedConversion(track.format)
|
||||
let muxable = isTrackMuxable(track.format)
|
||||
self.checked = needsConversion || muxable ? true : false
|
||||
self.importable = needsConversion || muxable ? true : false
|
||||
|
||||
// Set up the actions
|
||||
var actions: [TrackAction] = Array()
|
||||
|
||||
switch track {
|
||||
case is MP42ClosedCaptionTrack, is MP42ChapterTrack:
|
||||
let action = TrackAction(title: NSLocalizedString("Passthru", comment: "File Import action menu item."),
|
||||
tag: 0,
|
||||
enabled: true)
|
||||
actions.append(action)
|
||||
|
||||
case is MP42SubtitleTrack:
|
||||
let action = TrackAction(title: NSLocalizedString("Passthru", comment: "File Import action menu item."),
|
||||
tag: 0,
|
||||
enabled: needsConversion == false)
|
||||
actions.append(action)
|
||||
|
||||
if (needsConversion) {
|
||||
let conversionAction = TrackAction(title: NSLocalizedString("Tx3g", comment: "File Import action menu item."),
|
||||
tag: 1,
|
||||
enabled: true)
|
||||
actions.append(conversionAction)
|
||||
}
|
||||
|
||||
case is MP42VideoTrack:
|
||||
if track.url?.pathExtension.caseInsensitiveCompare("264") == ComparisonResult.orderedSame ||
|
||||
track.url?.pathExtension.caseInsensitiveCompare("h264") == ComparisonResult.orderedSame {
|
||||
let formats = ["23.976", "24", "25", "29.97", "30", "50", "59.96", "60"]
|
||||
let tags = [2398, 24, 25, 2997, 30, 50, 5994, 60]
|
||||
|
||||
for frameRate in zip(formats, tags) {
|
||||
let action = TrackAction(title: frameRate.0,
|
||||
tag: frameRate.1,
|
||||
enabled: true)
|
||||
actions.append(action)
|
||||
}
|
||||
}
|
||||
else {
|
||||
let action = TrackAction(title: NSLocalizedString("Passthru", comment: "File Import action menu item."),
|
||||
tag: 0,
|
||||
enabled: muxable == true)
|
||||
actions.append(action)
|
||||
}
|
||||
|
||||
case is MP42AudioTrack:
|
||||
|
||||
let action = TrackAction(title: NSLocalizedString("Passthru", comment: "File Import action menu item."),
|
||||
tag: 0,
|
||||
enabled: needsConversion == false)
|
||||
actions.append(action)
|
||||
|
||||
let formats = ["AAC - Dolby Pro Logic II", "AAC - Dolby Pro Logic", "AAC - Stereo", "AAC - Mono", "AAC - Multi-channel"]
|
||||
for (index, format) in formats.enumerated() {
|
||||
let conversionAction = TrackAction(title: format,
|
||||
tag: index + 1,
|
||||
enabled: true)
|
||||
actions.append(conversionAction)
|
||||
}
|
||||
|
||||
if track.format == kMP42AudioCodecType_AC3 ||
|
||||
track.format == kMP42AudioCodecType_EnhancedAC3 ||
|
||||
track.format == kMP42AudioCodecType_DTS {
|
||||
let conversionAction = TrackAction(title: NSLocalizedString("AAC + Passthru", comment: "File Import action menu item."),
|
||||
tag: 6,
|
||||
enabled: true)
|
||||
actions.append(conversionAction)
|
||||
}
|
||||
|
||||
if track.format == kMP42AudioCodecType_DTS {
|
||||
let conversionAction = TrackAction(title: NSLocalizedString("AAC + AC3", comment: "File Import action menu item."),
|
||||
tag: 7,
|
||||
enabled: true)
|
||||
actions.append(conversionAction)
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
self.actions = actions
|
||||
|
||||
// Set the action menu selection
|
||||
// AC-3 Specific actions
|
||||
if track.format == kMP42AudioCodecType_AC3 || track.format == kMP42AudioCodecType_EnhancedAC3 &&
|
||||
UserDefaults.standard.bool(forKey: "SBAudioConvertAC3"), let audioTrack = track as? MP42AudioTrack {
|
||||
if UserDefaults.standard.bool(forKey: "SBAudioKeepAC3") && audioTrack.fallbackTrack == nil {
|
||||
self.selectedActionTag = 6
|
||||
} else if audioTrack.fallbackTrack != nil {
|
||||
self.selectedActionTag = 0
|
||||
} else {
|
||||
self.selectedActionTag = UInt(UserDefaults.standard.integer(forKey: "SBAudioMixdown"))
|
||||
}
|
||||
}
|
||||
// DTS Specific actions
|
||||
else if track.format == kMP42AudioCodecType_DTS &&
|
||||
UserDefaults.standard.bool(forKey: "SBAudioConvertDts"), let audioTrack = track as? MP42AudioTrack {
|
||||
if audioTrack.fallbackTrack != nil {
|
||||
self.selectedActionTag = 0
|
||||
}
|
||||
else {
|
||||
switch UserDefaults.standard.integer(forKey: "SBAudioDtsOptions") {
|
||||
case 1: self.selectedActionTag = 7; // Convert to AC-3
|
||||
case 2: self.selectedActionTag = 6; // Keep DTS
|
||||
default: self.selectedActionTag = UInt(UserDefaults.standard.integer(forKey: "SBAudioMixdown"))
|
||||
}
|
||||
}
|
||||
}
|
||||
// Vobsub
|
||||
else if track.format == kMP42SubtitleCodecType_VobSub && UserDefaults.standard.bool(forKey: "SBSubtitleConvertBitmap") {
|
||||
self.selectedActionTag = 1
|
||||
}
|
||||
// Generic actions
|
||||
else if needsConversion {
|
||||
if track is MP42AudioTrack {
|
||||
self.selectedActionTag = UInt(UserDefaults.standard.integer(forKey: "SBAudioMixdown"))
|
||||
} else {
|
||||
self.selectedActionTag = 1
|
||||
}
|
||||
}
|
||||
else {
|
||||
self.selectedActionTag = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@IBOutlet weak var tableView: SBTableView!
|
||||
@IBOutlet weak var importMetadata: NSButton!
|
||||
@IBOutlet weak var addButton: NSButton!
|
||||
|
||||
private weak var delegate: FileImportControllerDelegate?
|
||||
|
||||
override public var windowNibName: NSNib.Name? {
|
||||
return NSNib.Name(rawValue: "FileImportController")
|
||||
}
|
||||
|
||||
init(fileURLs: [URL], delegate: FileImportControllerDelegate) throws {
|
||||
self.fileURLs = fileURLs
|
||||
self.delegate = delegate
|
||||
|
||||
var tracks: [MP42Track] = Array()
|
||||
|
||||
|
||||
var rows: [ItemType] = Array()
|
||||
|
||||
self.fileImporters = fileURLs.flatMap {
|
||||
let importer = MP42FileImporter(url: $0, error: nil)
|
||||
tracks.append(contentsOf: importer.tracks)
|
||||
rows.append(ItemType.header($0.lastPathComponent))
|
||||
|
||||
let tracks = importer.tracks.map { ItemType.track(TrackSettings(track: $0)) }
|
||||
rows.append(contentsOf: tracks)
|
||||
return importer
|
||||
}
|
||||
|
||||
|
||||
self.items = rows
|
||||
|
||||
super.init(window: nil)
|
||||
}
|
||||
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
override func windowDidLoad() {
|
||||
super.windowDidLoad()
|
||||
|
||||
self.importMetadata.isEnabled = fileImporters.first?.metadata != nil
|
||||
self.addButton.isEnabled = true
|
||||
}
|
||||
|
||||
// MARK: Public properties
|
||||
|
||||
private var tracks: [TrackSettings] {
|
||||
return items.flatMap {
|
||||
switch $0 {
|
||||
case .header(_):
|
||||
return nil
|
||||
case .track(let settings):
|
||||
return settings
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var onlyContainsSubtitles: Bool {
|
||||
return tracks.filter { $0.track.format != kMP42SubtitleCodecType_3GText && $0.track as? MP42SubtitleTrack == nil } .isEmpty
|
||||
}
|
||||
|
||||
// MARK: Selection
|
||||
|
||||
private func reloadCheckColumn(forRowIndexes indexes: IndexSet) {
|
||||
let columnIndex = tableView.column(withIdentifier: checkColumn)
|
||||
tableView.reloadData(forRowIndexes: indexes, columnIndexes: IndexSet(integer: columnIndex))
|
||||
}
|
||||
|
||||
private func setCheck(value: Bool, forIndexes indexes: IndexSet) {
|
||||
for index in indexes {
|
||||
let item = items[index]
|
||||
switch item {
|
||||
case .header(_):
|
||||
break
|
||||
case .track(let settings):
|
||||
settings.checked = value && settings.importable
|
||||
}
|
||||
}
|
||||
reloadCheckColumn(forRowIndexes: indexes)
|
||||
}
|
||||
|
||||
override func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
|
||||
if let action = menuItem.action,
|
||||
action == #selector(self.checkSelected(_:)) ||
|
||||
action == #selector(self.uncheckSelected(_:)) ||
|
||||
action == #selector(self.checkOnlyTracksWithSameLanguage(_:)) {
|
||||
if tableView.selectedRow != -1 || tableView.clickedRow != -1 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@IBAction func checkSelected(_ sender: Any) {
|
||||
setCheck(value: true, forIndexes: tableView.targetedRowIndexes)
|
||||
}
|
||||
|
||||
@IBAction func uncheckSelected(_ sender: Any) {
|
||||
setCheck(value: false, forIndexes: tableView.targetedRowIndexes)
|
||||
}
|
||||
|
||||
@IBAction func checkOnlyTracksWithSameLanguage(_ sender: Any) {
|
||||
let languages = tableView.targetedRowIndexes.flatMap {
|
||||
let item = items[$0]
|
||||
switch item {
|
||||
case .header(_):
|
||||
return nil
|
||||
case .track(let settings):
|
||||
return settings.track.language
|
||||
}
|
||||
}
|
||||
|
||||
for settings in tracks {
|
||||
settings.checked = settings.importable && languages.contains(settings.track.language)
|
||||
}
|
||||
|
||||
reloadCheckColumn(forRowIndexes: IndexSet(integersIn: 0..<items.count))
|
||||
}
|
||||
|
||||
// MARK: IBActions
|
||||
|
||||
@IBAction func closeWindow(_ sender: Any) {
|
||||
window?.sheetParent?.endSheet(window!, returnCode: NSApplication.ModalResponse.cancel)
|
||||
}
|
||||
|
||||
@IBAction func addTracks(_ sender: Any) {
|
||||
|
||||
var selectedTracks: [MP42Track] = Array()
|
||||
let checkedTracks = tracks.filter { $0.checked }
|
||||
|
||||
for trackSettings in checkedTracks {
|
||||
switch trackSettings.track {
|
||||
case let track as MP42AudioTrack:
|
||||
let bitRate = UInt(UserDefaults.standard.integer(forKey: "SBAudioBitrate"))
|
||||
let drc = UserDefaults.standard.float(forKey: "SBAudioDRC")
|
||||
var mixdown = SBNoneMixdown
|
||||
|
||||
let copyTrack = trackSettings.selectedActionTag == 6 || trackSettings.selectedActionTag == 7 ? true : false
|
||||
let convertDTSToAC3 = trackSettings.selectedActionTag == 7 ? true : false
|
||||
|
||||
switch trackSettings.selectedActionTag {
|
||||
case 5:
|
||||
mixdown = SBNoneMixdown;
|
||||
case 4:
|
||||
mixdown = SBMonoMixdown;
|
||||
case 3:
|
||||
mixdown = SBStereoMixdown;
|
||||
case 2:
|
||||
mixdown = SBDolbyMixdown;
|
||||
default:
|
||||
mixdown = SBDolbyPlIIMixdown;
|
||||
}
|
||||
|
||||
if copyTrack {
|
||||
let copy = track.copy() as! MP42AudioTrack
|
||||
let settings = MP42AudioConversionSettings.audioConversion(withBitRate: bitRate, mixDown: mixdown, drc: drc)
|
||||
|
||||
copy.conversionSettings = settings
|
||||
|
||||
track.fallbackTrack = copy
|
||||
track.isEnabled = false
|
||||
|
||||
if convertDTSToAC3 {
|
||||
// Wouldn't it be better to use pref settings too instead of 640/Multichannel and the drc from the prefs?
|
||||
track.conversionSettings = MP42AudioConversionSettings(format: kMP42AudioCodecType_AC3, bitRate: 640, mixDown: SBNoneMixdown, drc: drc)
|
||||
}
|
||||
|
||||
selectedTracks.append(copy)
|
||||
}
|
||||
|
||||
selectedTracks.append(trackSettings.track)
|
||||
|
||||
case let track as MP42SubtitleTrack:
|
||||
|
||||
if trackSettings.selectedActionTag > 0 {
|
||||
track.conversionSettings = MP42ConversionSettings.subtitlesConversion()
|
||||
}
|
||||
selectedTracks.append(trackSettings.track)
|
||||
|
||||
case let track as MP42VideoTrack:
|
||||
|
||||
if track.url?.pathExtension.caseInsensitiveCompare("264") == ComparisonResult.orderedSame ||
|
||||
track.url?.pathExtension.caseInsensitiveCompare("h264") == ComparisonResult.orderedSame {
|
||||
|
||||
track.conversionSettings = MP42RawConversionSettings.rawConversion(withFrameRate: trackSettings.selectedActionTag)
|
||||
}
|
||||
selectedTracks.append(trackSettings.track)
|
||||
|
||||
default:
|
||||
selectedTracks.append(trackSettings.track)
|
||||
}
|
||||
}
|
||||
|
||||
let metadata = importMetadata.state == NSControl.StateValue.on ? fileImporters.first?.metadata : nil
|
||||
|
||||
delegate?.didSelect(tracks: selectedTracks,
|
||||
metadata: metadata)
|
||||
|
||||
window?.sheetParent?.endSheet(window!, returnCode: NSApplication.ModalResponse.OK)
|
||||
}
|
||||
|
||||
// MARK: Action menu
|
||||
|
||||
|
||||
// MARK: Table View
|
||||
|
||||
let checkColumn = NSUserInterfaceItemIdentifier(rawValue: "check")
|
||||
let trackIdColumn = NSUserInterfaceItemIdentifier(rawValue: "trackId")
|
||||
let trackNameColumn = NSUserInterfaceItemIdentifier(rawValue: "trackName")
|
||||
let trackDurationColumn = NSUserInterfaceItemIdentifier(rawValue: "trackDuration")
|
||||
let trackLanguageColumn = NSUserInterfaceItemIdentifier(rawValue: "trackLanguage")
|
||||
let trackInfoColumn = NSUserInterfaceItemIdentifier(rawValue: "trackInfo")
|
||||
let trackActionColumn = NSUserInterfaceItemIdentifier(rawValue: "trackAction")
|
||||
|
||||
func numberOfRows(in tableView: NSTableView) -> Int {
|
||||
return items.count
|
||||
}
|
||||
|
||||
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
|
||||
switch items[row] {
|
||||
case .header(let title):
|
||||
let groupCell = tableView.makeView(withIdentifier: trackNameColumn, owner:self) as? NSTableCellView
|
||||
groupCell?.textField?.stringValue = title
|
||||
return groupCell
|
||||
|
||||
case .track(let settings):
|
||||
switch tableColumn?.identifier {
|
||||
|
||||
case checkColumn?:
|
||||
let cell = tableView.makeView(withIdentifier: checkColumn, owner:self) as? SBCheckBoxCellView
|
||||
cell?.checkboxButton?.state = settings.checked ? NSControl.StateValue.on : NSControl.StateValue.off
|
||||
return cell
|
||||
|
||||
case trackIdColumn?:
|
||||
let cell = tableView.makeView(withIdentifier: trackIdColumn, owner:self) as? NSTableCellView
|
||||
cell?.textField?.stringValue = String(settings.track.trackId)
|
||||
return cell
|
||||
|
||||
case trackNameColumn?:
|
||||
let cell = tableView.makeView(withIdentifier: trackNameColumn, owner:self) as? NSTableCellView
|
||||
cell?.textField?.stringValue = settings.track.name
|
||||
return cell
|
||||
|
||||
case trackDurationColumn?:
|
||||
let cell = tableView.makeView(withIdentifier: trackDurationColumn, owner:self) as? NSTableCellView
|
||||
cell?.textField?.stringValue = StringFromTime(Int64(settings.track.duration), 1000)
|
||||
return cell
|
||||
|
||||
case trackLanguageColumn?:
|
||||
let cell = tableView.makeView(withIdentifier: trackLanguageColumn, owner:self) as? NSTableCellView
|
||||
cell?.textField?.stringValue = MP42Languages.defaultManager.localizedLang(forExtendedTag: settings.track.language)
|
||||
return cell
|
||||
|
||||
case trackInfoColumn?:
|
||||
let cell = tableView.makeView(withIdentifier: trackInfoColumn, owner:self) as? NSTableCellView
|
||||
cell?.textField?.stringValue = settings.track.formatSummary
|
||||
return cell
|
||||
|
||||
case trackActionColumn?:
|
||||
let cell = tableView.makeView(withIdentifier: trackActionColumn, owner:self) as? SBPopUpCellView
|
||||
if let menu = cell?.popUpButton?.menu {
|
||||
menu.removeAllItems()
|
||||
_ = settings.actions.map {
|
||||
let menuItem = NSMenuItem(title: $0.title, action: nil, keyEquivalent: "")
|
||||
menuItem.tag = $0.tag
|
||||
menuItem.isEnabled = $0.enabled
|
||||
menu.addItem(menuItem)
|
||||
}
|
||||
|
||||
cell?.popUpButton?.isEnabled = settings.importable
|
||||
cell?.popUpButton?.autoenablesItems = false
|
||||
cell?.popUpButton?.selectItem(withTag: Int(settings.selectedActionTag))
|
||||
}
|
||||
return cell
|
||||
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func tableView(_ tableView: NSTableView, isGroupRow row: Int) -> Bool {
|
||||
switch items[row] {
|
||||
case .header:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -287,7 +287,7 @@
|
||||
SBDocument *doc = [self openUntitledDocumentAndDisplay:displayDocument error:&outError];
|
||||
completionHandler(doc, NO, outError);
|
||||
if (doc) {
|
||||
[doc showImportSheet:@[url]];
|
||||
[doc showImportSheetWithFileURLs:@[url]];
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class MP42File;
|
||||
@class SBTableView;
|
||||
|
||||
@interface SBDocument : NSDocument
|
||||
|
||||
@@ -18,6 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (instancetype)initWithMP4:(MP42File *)mp4File error:(NSError * __autoreleasing *)outError;
|
||||
|
||||
@property (nonatomic, weak) IBOutlet SBTableView *tracksTable;
|
||||
@property (nonatomic, strong, nullable) NSWindowController *sheetController;
|
||||
|
||||
- (IBAction)selectFile:(id)sender;
|
||||
@@ -40,9 +42,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (IBAction)export:(id)sender;
|
||||
|
||||
- (void)showImportSheet:(NSArray *)fileURLs;
|
||||
|
||||
- (void)reload;
|
||||
- (void)reloadPropertyView;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+3
-56
@@ -9,7 +9,6 @@
|
||||
#import "SBDocument.h"
|
||||
#import "SBQueueController.h"
|
||||
#import "SBQueueItem.h"
|
||||
#import "SBFileImport.h"
|
||||
#import "SBTableView.h"
|
||||
#import "SBCheckBoxCellView.h"
|
||||
#import "SBPopUpCellView.h"
|
||||
@@ -32,7 +31,7 @@
|
||||
|
||||
#define SublerTableViewDataType @"SublerTableViewDataType"
|
||||
|
||||
@interface SBDocument () <NSTableViewDelegate, SBFileImportDelegate>
|
||||
@interface SBDocument () <NSTableViewDelegate>
|
||||
{
|
||||
IBOutlet NSSplitView *splitView;
|
||||
|
||||
@@ -59,7 +58,6 @@
|
||||
}
|
||||
|
||||
@property (nonatomic, weak) IBOutlet NSWindow *documentWindow;
|
||||
@property (nonatomic, weak) IBOutlet SBTableView *tracksTable;
|
||||
|
||||
@property (nonatomic, weak) IBOutlet NSWindow *saveWindow;
|
||||
@property (nonatomic, weak) IBOutlet NSTextField *saveOperationName;
|
||||
@@ -931,63 +929,12 @@ static NSDictionary *_detailMonospacedAttr;
|
||||
[self updateChapters:chapters fromCSVFile:panel.URLs.firstObject];
|
||||
}
|
||||
else {
|
||||
[self showImportSheet:panel.URLs];
|
||||
[self showImportSheetWithFileURLs:panel.URLs];
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)showImportSheet:(NSArray<NSURL *> *)fileURLs
|
||||
{
|
||||
NSError *error = nil;
|
||||
|
||||
self.sheetController = [[SBFileImport alloc] initWithURLs:fileURLs delegate:self error:&error];
|
||||
|
||||
if (self.sheetController) {
|
||||
if (((SBFileImport *)self.sheetController).onlyContainsSubtitleTracks) {
|
||||
[(SBFileImport *)self.sheetController addTracks:self];
|
||||
[self.tracksTable reloadData];
|
||||
[self reloadPropertyView];
|
||||
self.sheetController = nil;
|
||||
}
|
||||
else {
|
||||
// show the dialog
|
||||
[self.documentWindow beginSheet:self.sheetController.window completionHandler:^(NSModalResponse returnCode) {
|
||||
self.sheetController = nil;
|
||||
}];
|
||||
}
|
||||
}
|
||||
else if (error) {
|
||||
[self presentError:error modalForWindow:self.documentWindow delegate:nil didPresentSelector:NULL contextInfo:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)importDoneWithTracks:(NSArray<MP42Track *> *)tracksToBeImported andMetadata:(MP42Metadata *)metadata
|
||||
{
|
||||
if (tracksToBeImported) {
|
||||
for (MP42Track *track in tracksToBeImported) {
|
||||
[self.mp4 addTrack:track];
|
||||
}
|
||||
|
||||
[self updateChangeCount:NSChangeDone];
|
||||
|
||||
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"SBOrganizeAlternateGroups"] boolValue]) {
|
||||
[self.mp4 organizeAlternateGroups];
|
||||
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"SBInferMediaCharacteristics"] boolValue]) {
|
||||
[self.mp4 inferMediaCharacteristics];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (metadata) {
|
||||
[self.mp4.metadata mergeMetadata:metadata];
|
||||
[self updateChangeCount:NSChangeDone];
|
||||
}
|
||||
|
||||
[self.tracksTable reloadData];
|
||||
[self reloadPropertyView];
|
||||
}
|
||||
|
||||
- (void)addMetadata:(NSURL *)URL
|
||||
{
|
||||
if ([URL.pathExtension isEqualToString:@"xml"] || [URL.pathExtension isEqualToString:@"nfo"]) {
|
||||
@@ -1150,7 +1097,7 @@ static NSDictionary *_detailMonospacedAttr;
|
||||
}
|
||||
|
||||
if (supportedItems.count) {
|
||||
[self showImportSheet:supportedItems];
|
||||
[self showImportSheetWithFileURLs:supportedItems];
|
||||
}
|
||||
|
||||
return YES;
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
//
|
||||
// FileImport.h
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 31/01/10.
|
||||
// Copyright 2010. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class MP42Track;
|
||||
@class MP42Metadata;
|
||||
|
||||
@protocol SBFileImportDelegate
|
||||
- (void)importDoneWithTracks:(NSArray<MP42Track *> *)tracksToBeImported andMetadata:(nullable MP42Metadata *)metadata;
|
||||
@end
|
||||
|
||||
@interface SBFileImport : NSWindowController
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
- (nullable instancetype)initWithURLs:(NSArray<NSURL *> *)fileURLs delegate:(id <SBFileImportDelegate>)delegate error:(NSError * __autoreleasing *)error;
|
||||
|
||||
- (IBAction)closeWindow:(id)sender;
|
||||
- (IBAction)addTracks:(id)sender;
|
||||
|
||||
@property (nonatomic, readonly) BOOL onlyContainsSubtitleTracks;
|
||||
|
||||
- (IBAction)checkSelected:(id)sender;
|
||||
- (IBAction)uncheckSelected:(id)sender;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -1,618 +0,0 @@
|
||||
//
|
||||
// FileImport.m
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 31/01/10.
|
||||
// Copyright 2010. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SBFileImport.h"
|
||||
#import <MP42Foundation/MP42File.h>
|
||||
#import <MP42Foundation/MP42FileImporter.h>
|
||||
#import <MP42Foundation/MP42Utilities.h>
|
||||
#import <MP42Foundation/MP42Languages.h>
|
||||
|
||||
@interface SBFileImport () <NSTableViewDelegate>
|
||||
{
|
||||
@private
|
||||
NSArray<NSURL *> *_fileURLs;
|
||||
|
||||
NSMutableArray<MP42FileImporter *> *_fileImporters;
|
||||
NSMutableArray *_tracks;
|
||||
|
||||
NSMutableArray<NSNumber *> *_importCheckArray;
|
||||
NSMutableArray<NSNumber *> *_actionArray;
|
||||
|
||||
id<SBFileImportDelegate> _delegate;
|
||||
|
||||
IBOutlet NSTableView *tracksTableView;
|
||||
IBOutlet NSButton *addTracksButton;
|
||||
IBOutlet NSButton *importMetadata;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation SBFileImport
|
||||
|
||||
- (nullable instancetype)initWithURLs:(NSArray<NSURL *> *)fileURLs delegate:(id <SBFileImportDelegate>)delegate error:(NSError * __autoreleasing *)error
|
||||
{
|
||||
if ((self = [super initWithWindowNibName:@"FileImport"])) {
|
||||
_delegate = delegate;
|
||||
_fileURLs = [fileURLs copy];
|
||||
_fileImporters = [[NSMutableArray alloc] initWithCapacity:fileURLs.count];
|
||||
_tracks = [[NSMutableArray alloc] init];
|
||||
|
||||
// Load the files.
|
||||
for (NSURL *url in fileURLs) {
|
||||
MP42FileImporter *importer = [[MP42FileImporter alloc] initWithURL:url error:error];
|
||||
if (importer) {
|
||||
[_tracks addObject:url.lastPathComponent];
|
||||
[_fileImporters addObject:importer];
|
||||
[_tracks addObjectsFromArray:importer.tracks];
|
||||
}
|
||||
}
|
||||
|
||||
if (!_tracks.count) {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills the checkboxes and actions menu defaults
|
||||
*/
|
||||
- (void)_prepareActionArray
|
||||
{
|
||||
_importCheckArray = [[NSMutableArray alloc] initWithCapacity:_tracks.count];
|
||||
_actionArray = [[NSMutableArray alloc] initWithCapacity:_tracks.count];
|
||||
|
||||
for (MP42Track *object in _tracks) {
|
||||
if ([object isKindOfClass:[MP42Track class]]) {
|
||||
|
||||
// Set the checkbox state
|
||||
if (isTrackMuxable(object.format) || trackNeedConversion(object.format)) {
|
||||
[_importCheckArray addObject:@YES];
|
||||
} else {
|
||||
[_importCheckArray addObject:@NO];
|
||||
}
|
||||
|
||||
// Set the action menu selection
|
||||
// AC-3 Specific actions
|
||||
if ((object.format == kMP42AudioCodecType_AC3 || object.format == kMP42AudioCodecType_EnhancedAC3) &&
|
||||
[[[NSUserDefaults standardUserDefaults] valueForKey:@"SBAudioConvertAC3"] boolValue]) {
|
||||
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"SBAudioKeepAC3"] boolValue] &&
|
||||
[(MP42AudioTrack *)object fallbackTrack] == nil) {
|
||||
[_actionArray addObject:@6];
|
||||
} else if ([(MP42AudioTrack *)object fallbackTrack]) {
|
||||
[_actionArray addObject:@0];
|
||||
} else {
|
||||
[_actionArray addObject:@([[[NSUserDefaults standardUserDefaults]
|
||||
valueForKey:@"SBAudioMixdown"] integerValue])];
|
||||
}
|
||||
}
|
||||
// DTS Specific actions
|
||||
else if (object.format == kMP42AudioCodecType_DTS &&
|
||||
[[[NSUserDefaults standardUserDefaults] valueForKey:@"SBAudioConvertDts"] boolValue]) {
|
||||
if ([(MP42AudioTrack *)object fallbackTrack] != nil) {
|
||||
[_actionArray addObject:@0];
|
||||
}
|
||||
else {
|
||||
switch ([[[NSUserDefaults standardUserDefaults] valueForKey:@"SBAudioDtsOptions"] integerValue]) {
|
||||
case 1: [_actionArray addObject:@7]; // Convert to AC-3
|
||||
break;
|
||||
case 2: [_actionArray addObject:@6]; // Keep DTS
|
||||
break;
|
||||
default:
|
||||
[_actionArray addObject:@([[[NSUserDefaults standardUserDefaults]
|
||||
valueForKey:@"SBAudioMixdown"] integerValue])];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Vobsub
|
||||
else if (object.format == kMP42SubtitleCodecType_VobSub &&
|
||||
[[[NSUserDefaults standardUserDefaults] valueForKey:@"SBSubtitleConvertBitmap"] boolValue]) {
|
||||
[_actionArray addObject:@1];
|
||||
}
|
||||
// Generic actions
|
||||
else if (!trackNeedConversion(object.format)) {
|
||||
[_actionArray addObject:@0];
|
||||
}
|
||||
else if ([object isMemberOfClass:[MP42AudioTrack class]]) {
|
||||
[_actionArray addObject:@([[[NSUserDefaults standardUserDefaults]
|
||||
valueForKey:@"SBAudioMixdown"] integerValue])];
|
||||
}
|
||||
// Chapters
|
||||
else if ([object isMemberOfClass:[MP42ChapterTrack class]]) {
|
||||
[_actionArray addObject:@0];
|
||||
}
|
||||
else {
|
||||
[_actionArray addObject:@1];
|
||||
}
|
||||
}
|
||||
else {
|
||||
[_importCheckArray addObject:@YES];
|
||||
[_actionArray addObject:@0];
|
||||
}
|
||||
}
|
||||
|
||||
if (_fileImporters.firstObject.metadata) {
|
||||
[importMetadata setEnabled:YES];
|
||||
}
|
||||
else {
|
||||
[importMetadata setEnabled:NO];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)windowDidLoad
|
||||
{
|
||||
[self _prepareActionArray];
|
||||
[addTracksButton setEnabled:YES];
|
||||
}
|
||||
|
||||
- (BOOL)onlyContainsSubtitleTracks
|
||||
{
|
||||
BOOL onlySubtitle = YES;
|
||||
for (MP42Track *track in _tracks) {
|
||||
if ([track isKindOfClass:[MP42Track class]]) {
|
||||
if (![track isMemberOfClass:[MP42SubtitleTrack class]] || track.format != kMP42SubtitleCodecType_3GText)
|
||||
onlySubtitle = NO;
|
||||
}
|
||||
}
|
||||
return onlySubtitle;
|
||||
}
|
||||
|
||||
- (NSInteger)numberOfRowsInTableView:(NSTableView *)t
|
||||
{
|
||||
return _tracks.count;
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(NSTableView *)tableView isGroupRow:(NSInteger)row
|
||||
{
|
||||
if ([_tracks[row] isKindOfClass:[MP42Track class]]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row
|
||||
{
|
||||
if ([_tracks[row] isKindOfClass:[MP42Track class]]) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(NSTableView *)tableView
|
||||
spanForTableColumn:(NSTableColumn *)tableColumn
|
||||
row:(NSInteger)row
|
||||
{
|
||||
if ([_tracks[row] isKindOfClass:[MP42Track class]]) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 6;
|
||||
}
|
||||
|
||||
- (NSCell *)tableView:(NSTableView *)tableView dataCellForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
|
||||
{
|
||||
NSCell *cell = nil;
|
||||
MP42Track *track = _tracks[rowIndex];
|
||||
|
||||
if ([track isKindOfClass:[MP42Track class]]) {
|
||||
if ([tableColumn.identifier isEqualToString:@"check"]) {
|
||||
NSButtonCell *buttonCell = [[NSButtonCell alloc] init];
|
||||
[buttonCell setButtonType:NSSwitchButton];
|
||||
buttonCell.controlSize = NSControlSizeSmall;
|
||||
buttonCell.title = @"";
|
||||
|
||||
buttonCell.enabled = (isTrackMuxable(track.format) || trackNeedConversion(track.format)) ? YES : NO;
|
||||
|
||||
return buttonCell;
|
||||
}
|
||||
|
||||
if ([tableColumn.identifier isEqualToString:@"trackAction"]) {
|
||||
NSPopUpButtonCell *actionCell = [[NSPopUpButtonCell alloc] init];
|
||||
[actionCell setAutoenablesItems:NO];
|
||||
actionCell.font = [NSFont systemFontOfSize:11];
|
||||
actionCell.controlSize = NSControlSizeSmall;
|
||||
[actionCell setBordered:NO];
|
||||
|
||||
if ([track isMemberOfClass:[MP42VideoTrack class]]) {
|
||||
if ([track.URL.pathExtension caseInsensitiveCompare: @"264"] == NSOrderedSame ||
|
||||
[track.URL.pathExtension caseInsensitiveCompare: @"h264"] == NSOrderedSame) {
|
||||
NSInteger i = 0;
|
||||
NSArray<NSString *> *formatArray = @[@"23.976", @"24", @"25", @"29.97", @"30", @"50", @"59.96", @"60"];
|
||||
NSInteger tags[8] = {2398, 24, 25, 2997, 30, 50, 5994, 60};
|
||||
|
||||
for (NSString* format in formatArray) {
|
||||
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:format action:NULL keyEquivalent:@""];
|
||||
item.tag = tags[i++];
|
||||
[item setEnabled:YES];
|
||||
[actionCell.menu addItem:item];
|
||||
}
|
||||
}
|
||||
else {
|
||||
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""];
|
||||
item.tag = 0;
|
||||
[item setEnabled:YES];
|
||||
[actionCell.menu addItem:item];
|
||||
|
||||
if (isTrackMuxable(track.format)) {
|
||||
[item setEnabled:YES];
|
||||
}
|
||||
else {
|
||||
[item setEnabled:NO];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ([track isMemberOfClass:[MP42SubtitleTrack class]]) {
|
||||
NSInteger tag = 0;
|
||||
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""];
|
||||
item.tag = tag++;
|
||||
if (!trackNeedConversion(track.format)) {
|
||||
[item setEnabled:YES];
|
||||
}
|
||||
else {
|
||||
[item setEnabled:NO];
|
||||
}
|
||||
[actionCell.menu addItem:item];
|
||||
|
||||
NSArray<NSString *> *formatArray = @[@"Tx3g"];
|
||||
for (NSString *format in formatArray) {
|
||||
item = [[NSMenuItem alloc] initWithTitle:format action:NULL keyEquivalent:@""];
|
||||
item.tag = tag++;
|
||||
[item setEnabled:YES];
|
||||
[actionCell.menu addItem:item];
|
||||
}
|
||||
}
|
||||
else if ([track isMemberOfClass:[MP42ClosedCaptionTrack class]]) {
|
||||
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""];
|
||||
item.tag = 0;
|
||||
[item setEnabled:YES];
|
||||
[actionCell.menu addItem:item];
|
||||
}
|
||||
else if ([track isMemberOfClass:[MP42AudioTrack class]]) {
|
||||
NSInteger tag = 0;
|
||||
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""];
|
||||
item.tag = tag++;
|
||||
if (!trackNeedConversion(track.format))
|
||||
[item setEnabled:YES];
|
||||
else
|
||||
[item setEnabled:NO];
|
||||
[actionCell.menu addItem:item];
|
||||
|
||||
NSArray *formatArray = @[@"AAC - Dolby Pro Logic II", @"AAC - Dolby Pro Logic", @"AAC - Stereo", @"AAC - Mono", @"AAC - Multi-channel"];
|
||||
for (NSString *format in formatArray) {
|
||||
item = [[NSMenuItem alloc] initWithTitle:format action:NULL keyEquivalent:@""];
|
||||
item.tag = tag++;
|
||||
[item setEnabled:YES];
|
||||
[actionCell.menu addItem:item];
|
||||
}
|
||||
|
||||
if (track.format == kMP42AudioCodecType_AC3 ||
|
||||
track.format == kMP42AudioCodecType_EnhancedAC3 ||
|
||||
track.format == kMP42AudioCodecType_DTS)
|
||||
{
|
||||
item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AAC + Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""];
|
||||
item.tag = tag++;
|
||||
[item setEnabled:YES];
|
||||
[actionCell.menu addItem:item];
|
||||
}
|
||||
|
||||
if (track.format == kMP42AudioCodecType_DTS)
|
||||
{
|
||||
item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"AAC + AC3", @"File Import action menu item.") action:NULL keyEquivalent:@""];
|
||||
item.tag = tag++;
|
||||
[item setEnabled:YES];
|
||||
[actionCell.menu addItem:item];
|
||||
}
|
||||
}
|
||||
else if ([track isMemberOfClass:[MP42ChapterTrack class]]) {
|
||||
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Passthru", @"File Import action menu item.") action:NULL keyEquivalent:@""];
|
||||
item.tag = 0;
|
||||
[item setEnabled:YES];
|
||||
[actionCell.menu addItem:item];
|
||||
}
|
||||
cell = actionCell;
|
||||
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
|
||||
return tableColumn.dataCell;
|
||||
}
|
||||
|
||||
- (id)tableView:(NSTableView *)tableView
|
||||
objectValueForTableColumn:(NSTableColumn *)tableColumn
|
||||
row:(NSInteger)rowIndex
|
||||
{
|
||||
id object = _tracks[rowIndex];
|
||||
|
||||
if (!object) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
if ([object isKindOfClass:[MP42Track class]]) {
|
||||
MP42Track *track = object;
|
||||
|
||||
if ([tableColumn.identifier isEqualToString: @"check"] ) {
|
||||
return _importCheckArray[rowIndex];
|
||||
}
|
||||
|
||||
if ([tableColumn.identifier isEqualToString:@"trackId"]) {
|
||||
return [NSString stringWithFormat:@"%d", track.trackId];
|
||||
}
|
||||
|
||||
if ([tableColumn.identifier isEqualToString:@"trackName"]) {
|
||||
return track.name;
|
||||
}
|
||||
|
||||
if ([tableColumn.identifier isEqualToString:@"trackInfo"]) {
|
||||
return localizedDisplayName(track.mediaType, track.format);
|
||||
}
|
||||
|
||||
if ([tableColumn.identifier isEqualToString:@"trackDuration"]) {
|
||||
return track.timeString;
|
||||
}
|
||||
|
||||
if ([tableColumn.identifier isEqualToString:@"trackLanguage"]) {
|
||||
return [MP42Languages.defaultManager localizedLangForExtendedTag:track.language];
|
||||
}
|
||||
|
||||
if ([tableColumn.identifier isEqualToString:@"trackAction"]) {
|
||||
return _actionArray[rowIndex];
|
||||
}
|
||||
} else if ([tableColumn isEqual:tableView.tableColumns[1]]) {
|
||||
return object;
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)tableView:(NSTableView *)tableView
|
||||
setObjectValue:(id)anObject
|
||||
forTableColumn:(NSTableColumn *)tableColumn
|
||||
row:(NSInteger)rowIndex
|
||||
{
|
||||
if ([tableColumn.identifier isEqualToString:@"check"]) {
|
||||
_importCheckArray[rowIndex] = anObject;
|
||||
}
|
||||
if ([tableColumn.identifier isEqualToString:@"trackAction"]) {
|
||||
_actionArray[rowIndex] = anObject;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)canBeChecked:(id)rowItem
|
||||
{
|
||||
MP42Track *track = rowItem;
|
||||
if ([track isKindOfClass:[MP42Track class]] &&
|
||||
(isTrackMuxable(track.format) || trackNeedConversion(track.format))) {
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSIndexSet *)targetRows
|
||||
{
|
||||
NSIndexSet *selection = tracksTableView.selectedRowIndexes;
|
||||
NSInteger clickedRow = tracksTableView.clickedRow;
|
||||
|
||||
if (clickedRow != -1 && ![selection containsIndex:clickedRow]) {
|
||||
selection = [NSIndexSet indexSetWithIndex:clickedRow];
|
||||
}
|
||||
|
||||
return selection;
|
||||
}
|
||||
|
||||
- (void)toggleSelectionCheck:(BOOL)value
|
||||
{
|
||||
NSIndexSet *selection = [self targetRows];
|
||||
|
||||
[selection enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
|
||||
if ([self canBeChecked:self->_tracks[idx]]) {
|
||||
self->_importCheckArray[idx] = @(value);
|
||||
}
|
||||
}];
|
||||
|
||||
[tracksTableView reloadDataForRowIndexes:selection columnIndexes:[NSIndexSet indexSetWithIndex:0]];
|
||||
}
|
||||
|
||||
- (IBAction)checkSelected:(id)sender
|
||||
{
|
||||
[self toggleSelectionCheck:YES];
|
||||
}
|
||||
|
||||
- (IBAction)uncheckSelected:(id)sender
|
||||
{
|
||||
[self toggleSelectionCheck:NO];
|
||||
}
|
||||
|
||||
- (IBAction)checkOnlyTracksWithSameLanguage:(id)sender
|
||||
{
|
||||
NSIndexSet *selection = [self targetRows];
|
||||
NSMutableSet *languages = [NSMutableSet set];
|
||||
|
||||
[selection enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
|
||||
if ([self canBeChecked:self->_tracks[idx]]) {
|
||||
MP42Track *track = self->_tracks[idx];
|
||||
[languages addObject:track.language];
|
||||
}
|
||||
}];
|
||||
|
||||
NSUInteger idx = 0;
|
||||
for (MP42Track *track in _tracks) {
|
||||
if ([self canBeChecked:track] && [languages containsObject:track.language]) {
|
||||
self->_importCheckArray[idx] = @YES;
|
||||
}
|
||||
else {
|
||||
self->_importCheckArray[idx] = @NO;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
[tracksTableView reloadData];
|
||||
}
|
||||
|
||||
- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem
|
||||
{
|
||||
SEL action = anItem.action;
|
||||
|
||||
if (action == @selector(uncheckSelected:) ||
|
||||
action == @selector(checkSelected:) ||
|
||||
action == @selector(checkOnlyTracksWithSameLanguage:))
|
||||
if (tracksTableView.selectedRow != -1 || tracksTableView.clickedRow != -1)
|
||||
return YES;
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (IBAction)closeWindow:(id)sender
|
||||
{
|
||||
[tracksTableView setDelegate:nil];
|
||||
[tracksTableView setDataSource:nil];
|
||||
[self.window.sheetParent endSheet:self.window returnCode:NSModalResponseCancel];
|
||||
}
|
||||
|
||||
- (IBAction)addTracks:(id)sender
|
||||
{
|
||||
if (!_actionArray) { // if add tracks is called directly, need to prepare actions
|
||||
[self _prepareActionArray];
|
||||
}
|
||||
|
||||
NSMutableArray *tracks = [[NSMutableArray alloc] init];
|
||||
NSInteger i = 0;
|
||||
|
||||
for (MP42Track *track in _tracks) {
|
||||
if ([track isKindOfClass:[MP42Track class]]) {
|
||||
if (_importCheckArray[i].boolValue) {
|
||||
NSUInteger conversion = _actionArray[i].integerValue;
|
||||
|
||||
if ([track isMemberOfClass:[MP42AudioTrack class]] && conversion) {
|
||||
NSUInteger bitRate = [[[NSUserDefaults standardUserDefaults] valueForKey:@"SBAudioBitrate"] integerValue];
|
||||
NSString *mixdown = SBNoneMixdown;
|
||||
float drc = [[[NSUserDefaults standardUserDefaults] valueForKey:@"SBAudioDRC"] floatValue];
|
||||
|
||||
BOOL copyTrack = (conversion == 6 || conversion == 7) ? YES : NO;
|
||||
BOOL convertDTSToAC3 = (conversion == 7) ? YES : NO;
|
||||
if (copyTrack) {
|
||||
conversion = [[[NSUserDefaults standardUserDefaults]
|
||||
valueForKey:@"SBAudioMixdown"] integerValue];
|
||||
}
|
||||
|
||||
switch (conversion) {
|
||||
case 5:
|
||||
mixdown = SBNoneMixdown;
|
||||
break;
|
||||
case 4:
|
||||
mixdown = SBMonoMixdown;
|
||||
break;
|
||||
case 3:
|
||||
mixdown = SBStereoMixdown;
|
||||
break;
|
||||
case 2:
|
||||
mixdown = SBDolbyMixdown;
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
mixdown = SBDolbyPlIIMixdown;
|
||||
break;
|
||||
}
|
||||
|
||||
if (copyTrack) {
|
||||
MP42AudioTrack *audioTrack = (MP42AudioTrack *)track;
|
||||
MP42AudioTrack *copy = [track copy];
|
||||
MP42ConversionSettings *settings = [MP42AudioConversionSettings audioConversionWithBitRate:bitRate
|
||||
mixDown:mixdown
|
||||
drc:drc];
|
||||
copy.conversionSettings = settings;
|
||||
|
||||
audioTrack.fallbackTrack = copy;
|
||||
audioTrack.enabled = NO;
|
||||
|
||||
if (convertDTSToAC3) { // Wouldn't it be better to use pref settings too instead of 640/Multichannel and the drc from the prefs?
|
||||
audioTrack.conversionSettings = [[MP42AudioConversionSettings alloc] initWitFormat:kMP42AudioCodecType_AC3
|
||||
bitRate:640
|
||||
mixDown:SBNoneMixdown
|
||||
drc:drc];
|
||||
}
|
||||
|
||||
[tracks addObject:copy];
|
||||
}
|
||||
else {
|
||||
MP42ConversionSettings *settings = [MP42AudioConversionSettings audioConversionWithBitRate:bitRate
|
||||
mixDown:mixdown
|
||||
drc:drc];
|
||||
track.conversionSettings = settings;
|
||||
}
|
||||
|
||||
}
|
||||
else if ([track isMemberOfClass:[MP42SubtitleTrack class]]) {
|
||||
if (conversion) {
|
||||
MP42ConversionSettings *settings = [MP42ConversionSettings subtitlesConversion];
|
||||
track.conversionSettings = settings;
|
||||
}
|
||||
}
|
||||
else if ([track isMemberOfClass:[MP42VideoTrack class]]) {
|
||||
if ([track.URL.pathExtension caseInsensitiveCompare:@"264"] == NSOrderedSame ||
|
||||
[track.URL.pathExtension caseInsensitiveCompare:@"h264"] == NSOrderedSame) {
|
||||
NSUInteger frameRate = 0;
|
||||
switch(conversion) {
|
||||
case 0:
|
||||
frameRate = 2398;
|
||||
break;
|
||||
case 1:
|
||||
frameRate = 24;
|
||||
break;
|
||||
case 2:
|
||||
frameRate = 25;
|
||||
break;
|
||||
case 3:
|
||||
frameRate = 2997;
|
||||
break;
|
||||
case 4:
|
||||
frameRate = 30;
|
||||
break;
|
||||
case 5:
|
||||
frameRate = 50;
|
||||
break;
|
||||
case 6:
|
||||
frameRate = 5994;
|
||||
break;
|
||||
case 7:
|
||||
frameRate = 60;
|
||||
break;
|
||||
default:
|
||||
frameRate = 2398;
|
||||
break;
|
||||
}
|
||||
|
||||
track.conversionSettings = [MP42RawConversionSettings rawConversionWithFrameRate:frameRate];
|
||||
}
|
||||
}
|
||||
|
||||
[tracks addObject:track];
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
MP42Metadata *metadata = nil;
|
||||
|
||||
if (importMetadata.state) {
|
||||
metadata = _fileImporters.firstObject.metadata;
|
||||
}
|
||||
|
||||
[_delegate importDoneWithTracks:tracks andMetadata:metadata];
|
||||
|
||||
[tracksTableView setDelegate:nil];
|
||||
[tracksTableView setDataSource:nil];
|
||||
|
||||
[self.window.sheetParent endSheet:self.window returnCode:NSModalResponseOK];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -31,6 +31,7 @@
|
||||
A92BBAB41F557CC0007EA182 /* PresetEditorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A92BBAB21F557CC0007EA182 /* PresetEditorViewController.swift */; };
|
||||
A92BBABE1F5584EA007EA182 /* PresetEditorViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A92BBABC1F558388007EA182 /* PresetEditorViewController.xib */; };
|
||||
A92ECCE31F49984C0063BFBD /* PrefsWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A92ECCE21F49984C0063BFBD /* PrefsWindowController.swift */; };
|
||||
A93105391F9758EC00605146 /* FileImportController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A93105351F9758EC00605146 /* FileImportController.xib */; };
|
||||
A9395E351F8B9ACA004C402B /* MP42FileAdditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9395E341F8B9ACA004C402B /* MP42FileAdditions.swift */; };
|
||||
A93DD7681DACCE930052749A /* SBComboBoxCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = A93DD7671DACCE930052749A /* SBComboBoxCellView.m */; };
|
||||
A9433A8D1F2F5C3600BB38CA /* ChapterResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9433A8C1F2F5C3600BB38CA /* ChapterResult.swift */; };
|
||||
@@ -78,7 +79,6 @@
|
||||
A9AE26C21F3B665D0041A57D /* SBMultiSelectViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9AE26C11F3B665C0041A57D /* SBMultiSelectViewController.m */; };
|
||||
A9AE70E11F2F7B3D001CF27C /* MetadataHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9AE70E01F2F7B3D001CF27C /* MetadataHelper.swift */; };
|
||||
A9AF6A7518D0496400FAAB08 /* SBQueueAction.m in Sources */ = {isa = PBXBuildFile; fileRef = A9AF6A7418D0496400FAAB08 /* SBQueueAction.m */; };
|
||||
A9B46A8C12B79B240040517A /* SBFileImport.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B46A7F12B79B240040517A /* SBFileImport.m */; };
|
||||
A9B46A8F12B79B240040517A /* SBTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B46A8512B79B240040517A /* SBTableView.m */; };
|
||||
A9B46A9E12B79B990040517A /* ButtonToolbarItem.m in Sources */ = {isa = PBXBuildFile; fileRef = A9B46A9412B79B990040517A /* ButtonToolbarItem.m */; };
|
||||
A9B46AA412B79BB10040517A /* Subler.icns in Resources */ = {isa = PBXBuildFile; fileRef = A9B46AA312B79BB10040517A /* Subler.icns */; };
|
||||
@@ -89,7 +89,6 @@
|
||||
A9BA1AF31DBF7DD800FD0B38 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A9BA1AF51DBF7DD800FD0B38 /* Localizable.strings */; };
|
||||
A9BC410318D9AB8700F8C92C /* SBItemViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9BC410218D9AB8700F8C92C /* SBItemViewController.m */; };
|
||||
A9BC410818D9ABC000F8C92C /* QueueItem.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9BC410618D9ABC000F8C92C /* QueueItem.xib */; };
|
||||
A9C055370F6D395B00AF15B5 /* FileImport.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9C055360F6D395B00AF15B5 /* FileImport.xib */; };
|
||||
A9C5FA6E19FA22590051F3FF /* SBLogWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9C5FA6C19FA22590051F3FF /* SBLogWindowController.m */; };
|
||||
A9C5FA7419FA2FEC0051F3FF /* SBLogWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9C5FA7219FA2FEC0051F3FF /* SBLogWindow.xib */; };
|
||||
A9C828F5195950C3004C4718 /* SBQueuePreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = A9C828F4195950C3004C4718 /* SBQueuePreferences.m */; };
|
||||
@@ -200,7 +199,6 @@
|
||||
A924A5101D4B9E66008301A7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Classes/PropertyView/Base.lproj/SoundView.xib; sourceTree = "<group>"; };
|
||||
A924A5111D4B9E66008301A7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Classes/PropertyView/Base.lproj/VideoView.xib; sourceTree = "<group>"; };
|
||||
A924A5121D4B9E66008301A7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||
A924A5131D4B9E66008301A7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/FileImport.xib; sourceTree = "<group>"; };
|
||||
A924A5141D4B9E66008301A7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MetadataSearch.xib; sourceTree = "<group>"; };
|
||||
A924A5151D4B9E66008301A7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ArtworkSelector.xib; sourceTree = "<group>"; };
|
||||
A924A5161D4B9E66008301A7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/SBChapterSearch.xib; sourceTree = "<group>"; };
|
||||
@@ -217,6 +215,7 @@
|
||||
A92BBAB21F557CC0007EA182 /* PresetEditorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PresetEditorViewController.swift; path = Classes/PresetEditorViewController.swift; sourceTree = "<group>"; };
|
||||
A92BBABD1F558388007EA182 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Classes/Base.lproj/PresetEditorViewController.xib; sourceTree = "<group>"; };
|
||||
A92ECCE21F49984C0063BFBD /* PrefsWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PrefsWindowController.swift; path = Classes/PrefsWindowController.swift; sourceTree = "<group>"; };
|
||||
A93105361F9758EC00605146 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/FileImportController.xib; sourceTree = "<group>"; };
|
||||
A9395E341F8B9ACA004C402B /* MP42FileAdditions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MP42FileAdditions.swift; path = Classes/MP42FileAdditions.swift; sourceTree = "<group>"; };
|
||||
A93DD7661DACCE930052749A /* SBComboBoxCellView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBComboBoxCellView.h; path = Classes/SBComboBoxCellView.h; sourceTree = "<group>"; };
|
||||
A93DD7671DACCE930052749A /* SBComboBoxCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBComboBoxCellView.m; path = Classes/SBComboBoxCellView.m; sourceTree = "<group>"; };
|
||||
@@ -275,8 +274,6 @@
|
||||
A9AF6A7318D0496400FAAB08 /* SBQueueAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBQueueAction.h; path = Classes/SBQueueAction.h; sourceTree = "<group>"; };
|
||||
A9AF6A7418D0496400FAAB08 /* SBQueueAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBQueueAction.m; path = Classes/SBQueueAction.m; sourceTree = "<group>"; };
|
||||
A9B3411B1679CA3E00E6EE0C /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = System/Library/Frameworks/QTKit.framework; sourceTree = SDKROOT; };
|
||||
A9B46A7E12B79B240040517A /* SBFileImport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBFileImport.h; path = Classes/SBFileImport.h; sourceTree = "<group>"; };
|
||||
A9B46A7F12B79B240040517A /* SBFileImport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBFileImport.m; path = Classes/SBFileImport.m; sourceTree = "<group>"; };
|
||||
A9B46A8412B79B240040517A /* SBTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBTableView.h; path = Classes/SBTableView.h; sourceTree = "<group>"; };
|
||||
A9B46A8512B79B240040517A /* SBTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBTableView.m; path = Classes/SBTableView.m; sourceTree = "<group>"; };
|
||||
A9B46A9312B79B990040517A /* ButtonToolbarItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ButtonToolbarItem.h; path = Others/ButtonToolbarItem.h; sourceTree = "<group>"; };
|
||||
@@ -297,7 +294,6 @@
|
||||
A9BA1AD51DBF773600FD0B38 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = Classes/PropertyView/it.lproj/SoundView.strings; sourceTree = "<group>"; };
|
||||
A9BA1AD61DBF773600FD0B38 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = Classes/PropertyView/it.lproj/VideoView.strings; sourceTree = "<group>"; };
|
||||
A9BA1AD71DBF773600FD0B38 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/MainMenu.strings; sourceTree = "<group>"; };
|
||||
A9BA1AD81DBF773600FD0B38 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/FileImport.strings; sourceTree = "<group>"; };
|
||||
A9BA1AD91DBF773700FD0B38 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/MetadataSearch.strings; sourceTree = "<group>"; };
|
||||
A9BA1ADA1DBF773700FD0B38 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/ArtworkSelector.strings; sourceTree = "<group>"; };
|
||||
A9BA1ADD1DBF773700FD0B38 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/SBChapterSearch.strings; sourceTree = "<group>"; };
|
||||
@@ -614,9 +610,7 @@
|
||||
A9B46ABE12B79D1C0040517A /* SBDocument.m */,
|
||||
A9577CF51F3DC667009181F4 /* Document+Swift.swift */,
|
||||
A962D9ED1F8B7F9F00802EEF /* FileImportController.swift */,
|
||||
A9B46A7E12B79B240040517A /* SBFileImport.h */,
|
||||
A9B46A7F12B79B240040517A /* SBFileImport.m */,
|
||||
A9C055360F6D395B00AF15B5 /* FileImport.xib */,
|
||||
A93105351F9758EC00605146 /* FileImportController.xib */,
|
||||
A9E932A61F34D31D00B1790B /* ArtworkSelector.swift */,
|
||||
CD4E6E5B12F744210095C84F /* ArtworkSelector.xib */,
|
||||
A997B0A91F348AB000974C9C /* MetadataSearchController.swift */,
|
||||
@@ -797,13 +791,13 @@
|
||||
8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */,
|
||||
A99EEA3F12B801AE002367D3 /* SBDocument.xib in Resources */,
|
||||
A906B5B11E434872007D12B1 /* Queue.sdef in Resources */,
|
||||
A93105391F9758EC00605146 /* FileImportController.xib in Resources */,
|
||||
A9AB486517F0AEFD000AA72E /* EmptyView.xib in Resources */,
|
||||
1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */,
|
||||
A90300C81DAE72C4008237D8 /* SBPresetPrefsViewController.xib in Resources */,
|
||||
A984DB740F52DD4B001A20B2 /* dsa_pub.pem in Resources */,
|
||||
A9C5FA7419FA2FEC0051F3FF /* SBLogWindow.xib in Resources */,
|
||||
A9DA3BA31B918D6F00F1E40C /* ExceptionAlert.xib in Resources */,
|
||||
A9C055370F6D395B00AF15B5 /* FileImport.xib in Resources */,
|
||||
A90B023B10F3290A000416F3 /* Prefs.xib in Resources */,
|
||||
A9AB486417F0AEFD000AA72E /* ChapterView.xib in Resources */,
|
||||
A9AB486817F0AEFD000AA72E /* VideoView.xib in Resources */,
|
||||
@@ -856,7 +850,6 @@
|
||||
A9AB484917F0AEA2000AA72E /* SBAppDelegate.m in Sources */,
|
||||
A9915ABF1F4B26CF003C57D1 /* MetadataPreset.swift in Sources */,
|
||||
A93DD7681DACCE930052749A /* SBComboBoxCellView.m in Sources */,
|
||||
A9B46A8C12B79B240040517A /* SBFileImport.m in Sources */,
|
||||
A900CE3E1F3ACF9700CCA08E /* MetadataResultMap.swift in Sources */,
|
||||
A9B46A8F12B79B240040517A /* SBTableView.m in Sources */,
|
||||
A9B46A9E12B79B990040517A /* ButtonToolbarItem.m in Sources */,
|
||||
@@ -1001,6 +994,14 @@
|
||||
name = PresetEditorViewController.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A93105351F9758EC00605146 /* FileImportController.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
A93105361F9758EC00605146 /* Base */,
|
||||
);
|
||||
name = FileImportController.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A961476513F568210068F161 /* Queue.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
@@ -1098,15 +1099,6 @@
|
||||
name = QueueItem.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A9C055360F6D395B00AF15B5 /* FileImport.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
A924A5131D4B9E66008301A7 /* Base */,
|
||||
A9BA1AD81DBF773600FD0B38 /* it */,
|
||||
);
|
||||
name = FileImport.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A9C5FA7219FA2FEC0051F3FF /* SBLogWindow.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
/* Class = "NSWindow"; title = "Window"; ObjectID = "1"; */
|
||||
"1.title" = "Finestra";
|
||||
|
||||
/* Class = "NSTextFieldCell"; title = "Select tracks:"; ObjectID = "14"; */
|
||||
"14.title" = "Seleziona tracce:";
|
||||
|
||||
/* Class = "NSTableColumn"; headerCell.title = "Name"; ObjectID = "15"; */
|
||||
"15.headerCell.title" = "Nome";
|
||||
|
||||
/* Class = "NSTableColumn"; headerCell.title = "Duration"; ObjectID = "17"; */
|
||||
"17.headerCell.title" = "Durata";
|
||||
|
||||
/* Class = "NSTableColumn"; headerCell.title = "Language"; ObjectID = "20"; */
|
||||
"20.headerCell.title" = "Lingua";
|
||||
|
||||
/* Class = "NSTableColumn"; headerCell.title = "Info"; ObjectID = "22"; */
|
||||
"22.headerCell.title" = "Info";
|
||||
|
||||
/* Class = "NSButtonCell"; title = "Cancel"; ObjectID = "27"; */
|
||||
"27.title" = "Annulla";
|
||||
|
||||
/* Class = "NSButtonCell"; title = "Add"; ObjectID = "28"; */
|
||||
"28.title" = "Aggiungi";
|
||||
|
||||
/* Class = "NSButtonCell"; title = "Import Metadata"; ObjectID = "37"; */
|
||||
"37.title" = "Importa Metadata";
|
||||
|
||||
/* Class = "NSTableColumn"; headerCell.title = "Action"; ObjectID = "39"; */
|
||||
"39.headerCell.title" = "Azione";
|
||||
|
||||
/* Class = "NSMenuItem"; title = "Check only tracks with the same language"; ObjectID = "D3Y-pV-hxZ"; */
|
||||
"D3Y-pV-hxZ.title" = "Abilita solo le tracce con la stessa lingua";
|
||||
|
||||
/* Class = "NSMenuItem"; title = "Check"; ObjectID = "GIM-Js-R4l"; */
|
||||
"GIM-Js-R4l.title" = "Abilita";
|
||||
|
||||
/* Class = "NSMenuItem"; title = "Uncheck"; ObjectID = "w6q-DP-C0O"; */
|
||||
"w6q-DP-C0O.title" = "Disabilita";
|
||||
|
||||
Reference in new issue
Block a user