mirror of
https://github.com/qinyuhang/ShadowsocksX-NG-R.git
synced 2026-10-20 22:44:11 +00:00
40 lines
1.4 KiB
Swift
40 lines
1.4 KiB
Swift
//
|
|
// HTTPPreferencesWindowController.swift
|
|
// ShadowsocksX-NG
|
|
//
|
|
// Created by 王晨 on 2016/10/7.
|
|
// Copyright © 2016年 qiuyuzhou. All rights reserved.
|
|
//
|
|
|
|
import Cocoa
|
|
|
|
class HTTPPreferencesWindowController: NSWindowController, NSWindowDelegate {
|
|
|
|
@IBOutlet weak var address: NSTextField!
|
|
@IBOutlet weak var port: NSTextField!
|
|
|
|
override func windowDidLoad() {
|
|
super.windowDidLoad()
|
|
|
|
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
|
|
self.window?.delegate = self
|
|
}
|
|
|
|
//------------------------------------------------------------
|
|
// NSWindowDelegate
|
|
func windowWillClose(_ notification: Notification) {
|
|
NotificationCenter.default
|
|
.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);export https_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)
|
|
}
|
|
}
|