Fix the insert a chapter at the beginning action

Fix #74.
This commit is contained in:
Damiano Galassi committed 2025-07-25 17:36:46 +02:00
1 parent 87837a0f5e
commit 971adb6342
3 files changed
+5 -5

No files matched your search

+3 -3
View File
@@ -308,12 +308,12 @@ final class DocumentWindowController: NSWindowController, TracksViewControllerDe
let minutes = sender.tag * 60 * 1000 let minutes = sender.tag * 60 * 1000
if minutes > 0 { if minutes > 0 {
for (index, duration) in stride(from: 0, to: mp4.duration, by: minutes).enumerated() { for (index, timestamp) in stride(from: 0, to: mp4.duration, by: minutes).enumerated() {
track.addChapter("Chapter \(index + 1)", duration: UInt64(duration)) track.addChapter("Chapter \(index + 1)", timestamp: UInt64(timestamp))
} }
} }
else { else {
track.addChapter("Chapter 1", duration: UInt64(mp4.duration)) track.addChapter("Chapter 1", timestamp: 0)
} }
doc.updateChangeCount(.changeDone) doc.updateChangeCount(.changeDone)
@@ -119,7 +119,7 @@ final class ChapterViewController : PropertyView, NSTableViewDataSource, NSTable
} }
@IBAction func addChapter(_ sender: Any) { @IBAction func addChapter(_ sender: Any) {
track.addChapter("Chapter", duration: 0) track.addChapter("Chapter", timestamp: 0)
tableView.reloadData() tableView.reloadData()
updateChangeCount() updateChangeCount()