CustomSetting

This commit is contained in:
Nobel
2017-01-10 17:04:18 +08:00
parent 37e157b024
commit 6175ec2888
3 changed files with 72 additions and 30 deletions
@@ -10,6 +10,9 @@ import Cocoa
class HTTPPreferencesWindowController: NSWindowController, NSWindowDelegate {
@IBOutlet weak var address: NSTextField!
@IBOutlet weak var port: NSTextField!
override func windowDidLoad() {
super.windowDidLoad()
@@ -24,4 +27,13 @@ class HTTPPreferencesWindowController: NSWindowController, NSWindowDelegate {
.post(name: Notification.Name(rawValue: NOTIFY_HTTP_CONF_CHANGED), object: nil)
}
@IBAction func copyExportCommand(_ sender: Any) {
let command = "export http_proxy=http://\(address.stringValue):\(port.stringValue)"
NSPasteboard.general().clearContents()
NSPasteboard.general().setString(command, forType: NSStringPboardType)
let notification = NSUserNotification()
notification.title = "Export Command Copied.".localized
NSUserNotificationCenter.default
.deliver(notification)
}
}