mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-06 19:40:08 +02:00
♻️ Move window logic to VC
This commit is contained in:
@ -107,16 +107,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate {
|
||||
// MARK: - Callable via Obj-C (#selector)
|
||||
|
||||
@objc func openOutput() {
|
||||
if (App.shared.windowController == nil) {
|
||||
let vc = NSStoryboard(name: "Main", bundle: nil).instantiateController(withIdentifier: "logWindow") as! LogViewController
|
||||
Shell.shared.delegate = vc
|
||||
let window = NSWindow(contentViewController: vc)
|
||||
window.title = "Terminal Output"
|
||||
window.delegate = self
|
||||
App.shared.windowController = NSWindowController(window: window)
|
||||
}
|
||||
App.shared.windowController!.showWindow(self)
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
LogViewController.show(delegate: self)
|
||||
}
|
||||
|
||||
@objc func updatePhpVersionInStatusBar() {
|
||||
|
@ -10,6 +10,19 @@ import Cocoa
|
||||
|
||||
class LogViewController: NSViewController, ShellDelegate {
|
||||
|
||||
public static func show(delegate: NSWindowDelegate? = nil) {
|
||||
if (App.shared.windowController == nil) {
|
||||
let vc = NSStoryboard(name: "Main", bundle: nil).instantiateController(withIdentifier: "logWindow") as! LogViewController
|
||||
Shell.shared.delegate = vc
|
||||
let window = NSWindow(contentViewController: vc)
|
||||
window.title = "Terminal Output"
|
||||
window.delegate = delegate
|
||||
App.shared.windowController = NSWindowController(window: window)
|
||||
}
|
||||
App.shared.windowController!.showWindow(self)
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
}
|
||||
|
||||
@IBOutlet var textView: NSTextView!
|
||||
|
||||
public func appendHistoryItem(_ historyItem: ShellHistoryItem) {
|
||||
|
Reference in New Issue
Block a user