Fix some leak and typo.

This commit is contained in:
Damiano Galassi committed 2018-02-22 13:26:39 +01:00
1 parent f0db0c9969
commit a17eb139ba
4 files changed
+20 -11

No files matched your search

@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13771" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14101" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13771"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14101"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SBSoundViewController">
<customObject id="-2" userLabel="File's Owner" customClass="SoundViewController" customModule="Subler" customModuleProvider="target">
<connections>
<outlet property="alternateGroup" destination="hO4-U9-j72" id="7J3-sK-j8c"/>
<outlet property="fallbacksPopUp" destination="kyn-qq-nF7" id="myr-hC-bw0"/>
@@ -111,7 +111,7 @@
</popUpButtonCell>
<connections>
<accessibilityConnection property="title" destination="AHt-fF-cmH" id="xln-Xh-ghS"/>
<action selector="seTracktFallback:" target="-2" id="w1b-yu-Mre"/>
<action selector="setTrackFallback:" target="-2" id="dW2-e8-n1H"/>
</connections>
</popUpButton>
<textField verticalHuggingPriority="750" preferredMaxLayoutWidth="200" translatesAutoresizingMaskIntoConstraints="NO" id="Wwd-LM-Zu2">
@@ -63,7 +63,7 @@ class SoundViewController : NSViewController {
if isAAC(track: audioTrack) {
let trackID = audioTrack.trackId > 0 ? String(audioTrack.trackId) : "na"
let item = NSMenuItem(title: "\(trackID) - \(audioTrack.name) - \(langs.localizedLang(forExtendedTag: audioTrack.language))",
action: #selector(seTrackFallback(_:)),
action: #selector(setTrackFallback(_:)),
keyEquivalent: "")
item.target = self
item.representedObject = audioTrack
@@ -116,7 +116,7 @@ class SoundViewController : NSViewController {
}
}
@IBAction func seTrackFallback(_ sender: NSMenuItem) {
@IBAction func setTrackFallback(_ sender: NSMenuItem) {
if let newFallbackTrack = sender.representedObject as? MP42AudioTrack {
if newFallbackTrack != track.fallbackTrack {
track.fallbackTrack = newFallbackTrack
+12 -5
View File
@@ -14,12 +14,13 @@ class SaveOptions: NSViewController {
@IBOutlet var _64bit_data: NSButton!
@IBOutlet var _64bit_time: NSButton!
private let doc: Document
private let savePanel: NSSavePanel
private weak var doc: Document?
private weak var savePanel: NSSavePanel?
init(doc: Document, savePanel: NSSavePanel) {
self.doc = doc
self.savePanel = savePanel
print("lele")
super.init(nibName: nil, bundle: nil)
}
@@ -27,9 +28,15 @@ class SaveOptions: NSViewController {
fatalError("init(coder:) has not been implemented")
}
deinit {
print("lala")
}
override func viewDidLoad() {
super.viewDidLoad()
guard let doc = doc else { return }
let formats = doc.writableTypes(for: .saveAsOperation)
fileFormat.removeAllItems()
@@ -42,11 +49,11 @@ class SaveOptions: NSViewController {
fileFormat.selectItem(at: index)
if let format = UserDefaults.standard.string(forKey: "SBSaveFormat") {
savePanel.allowedFileTypes = [format]
savePanel?.allowedFileTypes = [format]
}
if let filename = doc.mp4.preferredFileName() {
savePanel.nameFieldStringValue = filename
savePanel?.nameFieldStringValue = filename
}
_64bit_data.state = UserDefaults.standard.bool(forKey: "mp464bitOffset") ? .on : .off
@@ -81,7 +88,7 @@ class SaveOptions: NSViewController {
default:
break
}
savePanel.allowedFileTypes = [requiredFileType]
savePanel?.allowedFileTypes = [requiredFileType]
UserDefaults.standard.set(requiredFileType, forKey: "SBSaveFormat")
}
}
+2
View File
@@ -158,6 +158,7 @@ class TracksViewController: NSViewController, NSTableViewDataSource, NSTableView
case trackNameColumn?:
let cell = tableView.makeView(withIdentifier: trackNameColumn, owner:self) as? NSTableCellView
cell?.textField?.stringValue = track.name
cell?.textField?.isEditable = true
return cell
case trackDurationColumn?:
@@ -203,6 +204,7 @@ class TracksViewController: NSViewController, NSTableViewDataSource, NSTableView
case trackNameColumn?:
let cell = tableView.makeView(withIdentifier: trackNameColumn, owner:self) as? NSTableCellView
cell?.textField?.stringValue = NSLocalizedString("Metadata", comment: "")
cell?.textField?.isEditable = false
return cell
case trackDurationColumn?: