Skip to content

Commit 6f4a8ee

Browse files
committed
Merge branch 'main' into exotic-audio-only
2 parents 1144ccd + 193bc54 commit 6f4a8ee

11 files changed

Lines changed: 1146 additions & 106 deletions

Base.lproj/MainMenu.xib

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,7 @@
490490
</items>
491491
<point key="canvasLocation" x="-244" y="-303"/>
492492
</menu>
493+
<customObject id="Msu-dq-xzt" customClass="DocumentController" customModule="Subler" customModuleProvider="target"/>
493494
<customObject id="419" customClass="NSFontManager"/>
494495
<customObject id="449" userLabel="AppDelegate" customClass="AppDelegate" customModule="Subler" customModuleProvider="target">
495496
<connections>

Classes/AppDelegate.swift

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@ import MP42Foundation
1010

1111
final class DocumentController : NSDocumentController {
1212

13+
override func makeDocument(withContentsOf url: URL, ofType typeName: String) throws -> NSDocument {
14+
return try Document(contentsOf: url, ofType: typeName)
15+
}
16+
17+
override func makeUntitledDocument(ofType typeName: String) throws -> NSDocument {
18+
return Document()
19+
}
20+
21+
override func validateUserInterfaceItem(_ item: NSValidatedUserInterfaceItem) -> Bool {
22+
if item.action == #selector(NSDocumentController.newDocument(_:)) ||
23+
item.action == #selector(NSDocumentController.openDocument(_:)) {
24+
return true
25+
}
26+
return super.validateUserInterfaceItem(item)
27+
}
28+
1329
private var openPanel: NSOpenPanel?
1430

1531
override func openDocument(_ sender: Any?) {
@@ -155,7 +171,6 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
155171
Prefs.register()
156172
MetadataPrefs.register()
157173

158-
_ = documentController
159174
_ = activityWindowController
160175

161176
logger.clear()

Classes/Document.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Cocoa
99
import IOKit.pwr_mgt
1010
import MP42Foundation
1111

12+
@objc(Document)
1213
final class Document: NSDocument {
1314

1415
private(set) var mp4: MP42File
@@ -20,6 +21,7 @@ final class Document: NSDocument {
2021
self.optimize = false
2122
self.unsupportedMp4Brand = false
2223
self.mp4 = MP42File()
24+
super.init()
2325
}
2426

2527
init(mp4: MP42File) {

Classes/DocumentWindowController.swift

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,22 @@ final class DocumentWindowController: NSWindowController, TracksViewControllerDe
514514
}
515515
}
516516

517+
@objc func importFilesDirectly(_ fileURLs: [URL]) {
518+
do {
519+
let controller = try FileImportController(fileURLs: fileURLs, delegate: self)
520+
521+
// Call addTracks directly - the Settings initialization logic runs when the controller is created
522+
controller.addTracks(self)
523+
tracksViewController.reloadData()
524+
} catch {
525+
if let windowForSheet = doc.windowForSheet {
526+
presentError(error, modalFor: windowForSheet, delegate: nil, didPresent: nil, contextInfo: nil)
527+
} else {
528+
presentError(error)
529+
}
530+
}
531+
}
532+
517533
func didSelect(tracks: [MP42Track], metadata: MP42Metadata?) {
518534
for track in tracks {
519535
mp4.addTrack(track)
@@ -536,7 +552,7 @@ final class DocumentWindowController: NSWindowController, TracksViewControllerDe
536552
doc.updateChangeCount(.changeDone)
537553
metadataViewController?.metadata = mp4.metadata
538554
}
539-
555+
540556
tracksViewController.reloadData()
541557
}
542558

Classes/QueueScriptCommand.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,27 @@ import Foundation
4545
}
4646

4747
}
48+
49+
@objc(SBQueueRemoveCompletedScriptCommand) class QueueRemoveCompletedScriptCommand: NSScriptCommand {
50+
51+
@MainActor override func performDefaultImplementation() -> Any? {
52+
QueueController.shared.removeCompletedItems(self)
53+
return nil
54+
}
55+
56+
}
57+
58+
@objc(SBQueueStatusScriptCommand) class SBQueueStatusScriptCommand: NSScriptCommand {
59+
60+
@MainActor override func performDefaultImplementation() -> Any? {
61+
switch QueueController.shared.status {
62+
case .unknown:
63+
return 0 // idle
64+
case .working:
65+
return 1 // running
66+
case .completed:
67+
return 2 // completed
68+
}
69+
}
70+
71+
}

Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
<key>NSPrincipalClass</key>
159159
<string>NSApplication</string>
160160
<key>OSAScriptingDefinition</key>
161-
<string>Queue.sdef</string>
161+
<string>Subler.sdef</string>
162162
<key>SUAllowsAutomaticUpdates</key>
163163
<false/>
164164
<key>SUFeedURL</key>

Queue.sdef

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)