diff --git a/Aerial/Source/Controllers/CustomVideoController.swift b/Aerial/Source/Controllers/CustomVideoController.swift
index 4bf40657..86554812 100644
--- a/Aerial/Source/Controllers/CustomVideoController.swift
+++ b/Aerial/Source/Controllers/CustomVideoController.swift
@@ -51,7 +51,7 @@ class CustomVideoController: NSWindowController, NSWindowDelegate, NSDraggingDes
var hasAwokenAlready = false
var sw: NSWindow?
- var controller: PanelWindowController?
+ var controller: SourcesViewController?
// MARK: - Lifecycle
required init?(coder: NSCoder) {
@@ -116,7 +116,7 @@ class CustomVideoController: NSWindowController, NSWindowDelegate, NSDraggingDes
}
// This is the public function to make this visible
- func show(sender: NSButton, controller: PanelWindowController) {
+ func show(sender: NSButton, controller: SourcesViewController) {
self.controller = controller
if !mainPanel.isVisible {
mainPanel.makeKeyAndOrderFront(sender)
@@ -138,6 +138,7 @@ class CustomVideoController: NSWindowController, NSWindowDelegate, NSDraggingDes
// MARK: - Add a new folder of videos to parse
@IBAction func addFolderButton(_ sender: NSButton) {
+ debugLog("addFolder")
if #available(OSX 10.15, *) {
// On Catalina, we can't use NSOpenPanel right now
addFolderTextField.stringValue = ""
diff --git a/Aerial/Source/Models/AerialVideo.swift b/Aerial/Source/Models/AerialVideo.swift
index 284c9c4c..710699cb 100644
--- a/Aerial/Source/Models/AerialVideo.swift
+++ b/Aerial/Source/Models/AerialVideo.swift
@@ -50,16 +50,19 @@ final class AerialVideo: CustomStringConvertible, Equatable {
// Returns the closest video we have in the manifests
private func getClosestAvailable(wanted: VideoFormat) -> URL {
if urls[wanted] != "" {
+ //print(urls[wanted])
+ //return URL(fileURLWithPath: urls[wanted]!)
return URL(string: urls[wanted]!)!
} else {
// Fallback
if urls[.v4KHEVC] != "" {
return URL(string: urls[.v4KHEVC]!)!
-
} else if urls[.v1080pHEVC] != "" {
return URL(string: urls[.v1080pHEVC]!)!
- } else { // Last resort
+ } else if urls[.v1080pH264] != "" { // Last resort
return URL(string: urls[.v1080pH264]!)!
+ } else {
+ return URL(string: urls[.v4KHDR]!)!
}
}
}
@@ -166,8 +169,6 @@ final class AerialVideo: CustomStringConvertible, Equatable {
}
}
}
-
- // print("no duration for \(self)")
}
}
diff --git a/Resources/MainUI/First time setup/FirstSetupWindowController.swift b/Resources/MainUI/First time setup/FirstSetupWindowController.swift
index 705354ac..142a72e2 100644
--- a/Resources/MainUI/First time setup/FirstSetupWindowController.swift
+++ b/Resources/MainUI/First time setup/FirstSetupWindowController.swift
@@ -20,6 +20,7 @@ class FirstSetupWindowController: NSWindowController {
override func windowDidLoad() {
super.windowDidLoad()
+ splitVC.splitView.isVertical = false
print("*** fswc vdl")
// We always need to specify a bundle manually, auto loading from bundle
// does not work for screen savers when compiled as plugins
@@ -39,6 +40,7 @@ class FirstSetupWindowController: NSWindowController {
}
func nextAction() {
+ window?.close()
}
}
diff --git a/Resources/MainUI/First time setup/NextViewController.xib b/Resources/MainUI/First time setup/NextViewController.xib
index 7f2b2adf..1db9180b 100644
--- a/Resources/MainUI/First time setup/NextViewController.xib
+++ b/Resources/MainUI/First time setup/NextViewController.xib
@@ -23,6 +23,9 @@
+
+DQ
+
diff --git a/Resources/MainUI/PanelWindowController.swift b/Resources/MainUI/PanelWindowController.swift
index b6f8f7b6..22e0575b 100644
--- a/Resources/MainUI/PanelWindowController.swift
+++ b/Resources/MainUI/PanelWindowController.swift
@@ -9,7 +9,7 @@
import Cocoa
class PanelWindowController: NSWindowController {
- lazy var firstSetupWindowController: FirstSetupWindowController = FirstSetupWindowController()
+ var firstSetupWindowController: FirstSetupWindowController?
var splitVC: NSSplitViewController?
var videosVC: VideosViewController?
@@ -33,12 +33,11 @@ class PanelWindowController: NSWindowController {
var currentPath: String?
convenience init() {
- debugLog("PWC2 init")
self.init(windowNibName: "PanelWindowController")
}
override func windowDidLoad() {
- debugLog("PWC2 wdl")
+ debugLog("PWC2 wdl: Aerial version \(String(describing: Aerial.version))")
super.windowDidLoad()
currentPath = "location:all"
@@ -91,21 +90,24 @@ class PanelWindowController: NSWindowController {
window?.contentViewController = splitVC
debugLog("/PWC2 wdl")
- /*
- if PrefsAdvanced.firstTimeSetup == false {
+ }
+
+ func doFirstTimeSetup() {
+ if PrefsAdvanced.firstTimeSetup == false && firstSetupWindowController == nil {
+ let bundle = Bundle(for: PanelWindowController.self)
// We also load our CustomVideos nib here
+ firstSetupWindowController = FirstSetupWindowController()
var topLevelObjects: NSArray? = NSArray()
if !bundle.loadNibNamed(NSNib.Name("FirstSetupWindowController"),
owner: firstSetupWindowController,
topLevelObjects: &topLevelObjects) {
errorLog("Could not load nib for CustomVideos, please report")
}
- firstSetupWindowController.windowDidLoad()
- firstSetupWindowController.showWindow(self)
- firstSetupWindowController.window?.makeKeyAndOrderFront(nil)
-
- }*/
+ firstSetupWindowController!.windowDidLoad()
+ firstSetupWindowController!.showWindow(self)
+ firstSetupWindowController!.window!.makeKeyAndOrderFront(self)
+ }
}
// Switch from one menu list to another
@@ -167,29 +169,33 @@ class PanelWindowController: NSWindowController {
// Remove the old one
splitVC.removeChild(at: 1)
- if path == "sources" {
+ switch path {
+ case "sources":
splitVC.addSplitViewItem(sourcesViewItem!)
- } else if path == "time" {
+ case "time":
splitVC.addSplitViewItem(timeViewItem!)
- } else if path == "displays" {
+ case "displays":
splitVC.addSplitViewItem(displaysViewItem!)
- } else if path == "brightness" {
+ case "brightness":
splitVC.addSplitViewItem(brightnessViewItem!)
- } else if path == "cache" {
+ case "cache":
splitVC.addSplitViewItem(cacheViewItem!)
- } else if path == "overlays" {
+ case "overlays":
splitVC.addSplitViewItem(overlaysViewItem!)
- } else if path == "updates" {
+ case "updates":
splitVC.addSplitViewItem(updatesViewItem!)
- } else if path == "advanced" {
+ case "advanced":
splitVC.addSplitViewItem(advancedViewItem!)
// Infos
- } else if path == "about" {
+ case "about":
splitVC.addSplitViewItem(infoViewItem!)
- } else if path == "credits" {
+ case "credits":
splitVC.addSplitViewItem(creditsViewItem!)
- } else if path == "help" {
+ case "help":
splitVC.addSplitViewItem(helpViewItem!)
+ default:
+ errorLog("Unknown path in panel")
+ splitVC.addSplitViewItem(infoViewItem!)
}
}
@@ -202,3 +208,14 @@ class PanelWindowController: NSWindowController {
}
}
+
+extension PanelWindowController: NSWindowDelegate {
+ func windowDidBecomeKey(_ notification: Notification) {
+ debugLog("didbecomekey")
+
+ if (notification.object as? NSWindow) == self.window {
+ debugLog("wedidbecomekey")
+ doFirstTimeSetup()
+ }
+ }
+}
diff --git a/Resources/MainUI/Settings panels/SourcesViewController.swift b/Resources/MainUI/Settings panels/SourcesViewController.swift
index 8ff7d7d0..0b983cb4 100644
--- a/Resources/MainUI/Settings panels/SourcesViewController.swift
+++ b/Resources/MainUI/Settings panels/SourcesViewController.swift
@@ -18,8 +18,9 @@ class SourcesViewController: NSViewController {
sourceOutlineView.delegate = self
}
- @IBAction func downloadAllClick(_ sender: Any) {
+ @IBAction func downloadAllClick(_ sender: NSButton) {
print("download All from sources")
+
}
}
diff --git a/Resources/MainUI/SidebarViewController.swift b/Resources/MainUI/SidebarViewController.swift
index 7c9d8461..39a22972 100644
--- a/Resources/MainUI/SidebarViewController.swift
+++ b/Resources/MainUI/SidebarViewController.swift
@@ -30,9 +30,12 @@ class SidebarViewController: NSViewController {
// Always start with the videos panel selected
var menuSelection: SidebarMenus = .videos
+ @IBOutlet var closeButton: NSButton!
+
override func viewDidLoad() {
super.viewDidLoad()
+ closeButton.isHighlighted = true
sidebarOutlineView.delegate = self
sidebarOutlineView.dataSource = self
diff --git a/Resources/MainUI/SidebarViewController.xib b/Resources/MainUI/SidebarViewController.xib
index e9a5ec70..c3e87838 100644
--- a/Resources/MainUI/SidebarViewController.xib
+++ b/Resources/MainUI/SidebarViewController.xib
@@ -8,6 +8,7 @@
+
diff --git a/Resources/MainUI/VideosViewController.swift b/Resources/MainUI/VideosViewController.swift
index 033766dd..f426396e 100644
--- a/Resources/MainUI/VideosViewController.swift
+++ b/Resources/MainUI/VideosViewController.swift
@@ -337,7 +337,7 @@ class VideosViewController: NSViewController {
print(path)
if let mode = modeFromPath(path) {
let index = Int(path.split(separator: ":")[1])!
- if index >= 0 {
+ if index >= 0 && videoListTableView.selectedRow >= 0 {
return VideoList.instance.getVideoForSource(index, item: videoListTableView.selectedRow, mode: mode)
}
} else {