1
0
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:
2019-07-11 08:30:46 +02:00
parent 8486997f01
commit 88d81f343e
2 changed files with 14 additions and 10 deletions

View File

@ -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() {

View File

@ -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) {