mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-09 12:43:01 +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)
|
// MARK: - Callable via Obj-C (#selector)
|
||||||
|
|
||||||
@objc func openOutput() {
|
@objc func openOutput() {
|
||||||
if (App.shared.windowController == nil) {
|
LogViewController.show(delegate: self)
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func updatePhpVersionInStatusBar() {
|
@objc func updatePhpVersionInStatusBar() {
|
||||||
|
@@ -10,6 +10,19 @@ import Cocoa
|
|||||||
|
|
||||||
class LogViewController: NSViewController, ShellDelegate {
|
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!
|
@IBOutlet var textView: NSTextView!
|
||||||
|
|
||||||
public func appendHistoryItem(_ historyItem: ShellHistoryItem) {
|
public func appendHistoryItem(_ historyItem: ShellHistoryItem) {
|
||||||
|
Reference in New Issue
Block a user