Archived
1
This commit is contained in:
Kim Wittenburg
2019-02-01 22:59:01 +01:00
parent ba472864df
commit 0a485ff42a
82 changed files with 3975 additions and 1822 deletions

30
TagTunes/AppDelegate.swift Normal file → Executable file
View File

@@ -11,13 +11,43 @@ import Cocoa
@NSApplicationMain
internal class AppDelegate: NSObject, NSApplicationDelegate {
/// The app's unsorted tracks window. This should be initalized when the app
/// launches.
var unsortedTracksWindowController: NSWindowController!
/// The app's unsorted tracks controller.
weak var unsortedTracksController: UnsortedTracksController!
internal func applicationDidFinishLaunching(aNotification: NSNotification) {
Preferences.sharedPreferences.initializeDefaultValues()
let storyboard = NSStoryboard(name: "Main", bundle: nil)
unsortedTracksWindowController = storyboard.instantiateControllerWithIdentifier("unsortedTracksWindowController") as? NSWindowController
unsortedTracksController.visible = true
}
internal func applicationShouldTerminateAfterLastWindowClosed(sender: NSApplication) -> Bool {
return true
}
@IBAction func toggleUnsortedTracks(sender: AnyObject?) {
unsortedTracksController.visible = !unsortedTracksController.visible
}
}
extension NSApplication {
/// The app`s unsorted tracks controller. When a `UnsortedTracksController`
/// is initialized it should this property to itself.
///
/// The value of this property is not retained.
var unsortedTracksController: UnsortedTracksController! {
set {
(delegate as? AppDelegate)?.unsortedTracksController = newValue
}
get {
return (delegate as? AppDelegate)?.unsortedTracksController
}
}
}