Fix save options when the save as sheet is dismissed.

This commit is contained in:
Damiano Galassi committed 2020-09-01 11:52:13 +02:00
1 parent ab52a8e0f6
commit 251d3b5555
1 file changed
+5 -4
+5 -4
View File
@@ -76,7 +76,7 @@ final class Document: NSDocument {
private var optimize: Bool private var optimize: Bool
private var options: [String : Any] private var options: [String : Any]
private func saveOptions() -> [String : Any] { private func saveOptions(for saveOperation: NSDocument.SaveOperationType) -> [String : Any] {
var options = [String : Any]() var options = [String : Any]()
if Prefs.chaptersPreviewTrack { if Prefs.chaptersPreviewTrack {
@@ -88,7 +88,8 @@ final class Document: NSDocument {
options[MP42ForceHvc1] = true options[MP42ForceHvc1] = true
} }
if let accessoryViewController = accessoryViewController { if let accessoryViewController = accessoryViewController,
saveOperation == .saveAsOperation || saveOperation == .saveToOperation {
options[MP4264BitData] = accessoryViewController._64bit_data.state == .on ? true : false options[MP4264BitData] = accessoryViewController._64bit_data.state == .on ? true : false
options[MP4264BitTime] = accessoryViewController._64bit_time.state == .on ? true : false options[MP4264BitTime] = accessoryViewController._64bit_time.state == .on ? true : false
optimize = accessoryViewController.optimize.state == .on ? true : false optimize = accessoryViewController.optimize.state == .on ? true : false
@@ -124,7 +125,7 @@ final class Document: NSDocument {
} }
} }
options = saveOptions() options = saveOptions(for: saveOperation)
releaseSavePanel() releaseSavePanel()
docController?.startProgressReporting() docController?.startProgressReporting()
@@ -219,7 +220,7 @@ final class Document: NSDocument {
let handler = { (response: NSApplication.ModalResponse) in let handler = { (response: NSApplication.ModalResponse) in
if response == NSApplication.ModalResponse.OK, let url = panel.url { if response == NSApplication.ModalResponse.OK, let url = panel.url {
let options = self.saveOptions() let options = self.saveOptions(for: .saveAsOperation)
let item = QueueItem(mp4: self.mp4, destURL: url, attributes: options, optimize: self.optimize) let item = QueueItem(mp4: self.mp4, destURL: url, attributes: options, optimize: self.optimize)
queue.add(item) queue.add(item)
self.releaseSavePanel() self.releaseSavePanel()