diff --git a/PHP Monitor.xcodeproj/project.pbxproj b/PHP Monitor.xcodeproj/project.pbxproj index d302ebb..e3ef540 100644 --- a/PHP Monitor.xcodeproj/project.pbxproj +++ b/PHP Monitor.xcodeproj/project.pbxproj @@ -8,7 +8,6 @@ /* Begin PBXBuildFile section */ C41C1B3722B0097F00E7CF16 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B3622B0097F00E7CF16 /* AppDelegate.swift */; }; - C41C1B3922B0097F00E7CF16 /* LogViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B3822B0097F00E7CF16 /* LogViewController.swift */; }; C41C1B3B22B0098000E7CF16 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C41C1B3A22B0098000E7CF16 /* Assets.xcassets */; }; C41C1B3E22B0098000E7CF16 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C41C1B3C22B0098000E7CF16 /* Main.storyboard */; }; C41C1B4722B009A400E7CF16 /* Shell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C41C1B4622B009A400E7CF16 /* Shell.swift */; }; @@ -27,7 +26,6 @@ /* Begin PBXFileReference section */ C41C1B3322B0097F00E7CF16 /* PHP Monitor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "PHP Monitor.app"; sourceTree = BUILT_PRODUCTS_DIR; }; C41C1B3622B0097F00E7CF16 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - C41C1B3822B0097F00E7CF16 /* LogViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogViewController.swift; sourceTree = ""; }; C41C1B3A22B0098000E7CF16 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; C41C1B3D22B0098000E7CF16 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; C41C1B3F22B0098000E7CF16 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -103,7 +101,6 @@ isa = PBXGroup; children = ( C41C1B3C22B0098000E7CF16 /* Main.storyboard */, - C41C1B3822B0097F00E7CF16 /* LogViewController.swift */, ); path = "View Controllers"; sourceTree = ""; @@ -224,7 +221,6 @@ C4811D2422D70A4700B5F6B3 /* App.swift in Sources */, C41C1B4922B00A9800E7CF16 /* MenuBarImageGenerator.swift in Sources */, C4811D2A22D70F9A00B5F6B3 /* MainMenu.swift in Sources */, - C41C1B3922B0097F00E7CF16 /* LogViewController.swift in Sources */, C41C1B3722B0097F00E7CF16 /* AppDelegate.swift in Sources */, C41C1B4B22B019FF00E7CF16 /* PhpVersion.swift in Sources */, C476FF9822B0DD830098105B /* Alert.swift in Sources */, diff --git a/phpmon/Singletons/MainMenu.swift b/phpmon/Singletons/MainMenu.swift index 631ef14..097e9cb 100644 --- a/phpmon/Singletons/MainMenu.swift +++ b/phpmon/Singletons/MainMenu.swift @@ -85,8 +85,6 @@ class MainMenu: NSObject, NSWindowDelegate { } } menu.addItem(NSMenuItem.separator()) - menu.addItem(NSMenuItem(title: "View shell output...", action: #selector(self.openOutput), keyEquivalent: "o")) - menu.addItem(NSMenuItem.separator()) menu.addItem(NSMenuItem(title: "About PHP Monitor", action: #selector(self.openAbout), keyEquivalent: "")) menu.items.forEach({ (item) in item.target = self @@ -115,10 +113,6 @@ class MainMenu: NSObject, NSWindowDelegate { // MARK: - Callable via Obj-C (#selector) - @objc func openOutput() { - LogViewController.show(delegate: self) - } - @objc func updatePhpVersionInStatusBar() { App.shared.currentVersion = PhpVersion() if (App.shared.busy) { diff --git a/phpmon/View Controllers/Base.lproj/Main.storyboard b/phpmon/View Controllers/Base.lproj/Main.storyboard index 244c8b5..bda1e5a 100644 --- a/phpmon/View Controllers/Base.lproj/Main.storyboard +++ b/phpmon/View Controllers/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - - + + @@ -54,68 +54,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/phpmon/View Controllers/LogViewController.swift b/phpmon/View Controllers/LogViewController.swift deleted file mode 100644 index 2cd3f08..0000000 --- a/phpmon/View Controllers/LogViewController.swift +++ /dev/null @@ -1,72 +0,0 @@ -// -// ViewController.swift -// PHP Monitor -// -// Created by Nico Verbruggen on 11/06/2019. -// Copyright © 2019 Nico Verbruggen. All rights reserved. -// - -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.user.delegate = vc - let window = NSWindow(contentViewController: vc) - window.title = "Shell output (/bin/bash --login)" - 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) { - self.append( - """ - ====== - @ \(historyItem.date.toString()) - ------ - $ \(historyItem.command) - ------ - > \(historyItem.output) - - """ - ) - } - - public func append(_ text : String) { - self.textView.textStorage?.append( - NSAttributedString( - string: text, - attributes: [ - NSAttributedString.Key.font: NSFont(name: "Menlo", size: 12.0)! - ] - ) - ) - self.textView.scrollToEndOfDocument(nil) - } - - override func viewDidLoad() { - self.textView.isEditable = false - for entry in Shell.user.history { - self.appendHistoryItem(entry) - } - } - - func didCompleteCommand(historyItem: ShellHistoryItem) { - self.appendHistoryItem(historyItem) - } - - @IBAction func pressed(_ sender: Any) { - self.view.window?.windowController?.close() - } - - deinit { - print("VC deallocated") - } -}