Fix @objc

This commit is contained in:
Qiu Yuzhou
2017-10-20 19:58:14 +08:00
parent d56b108eb8
commit 6dbf10b7f3
4 changed files with 21 additions and 22 deletions

View File

@ -323,12 +323,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
if preferencesWinCtrl != nil { if preferencesWinCtrl != nil {
preferencesWinCtrl.close() preferencesWinCtrl.close()
} }
let ctrl = PreferencesWindowController(windowNibName: NSNib.Name(rawValue: "PreferencesWindowController")) preferencesWinCtrl = PreferencesWindowController(windowNibName: NSNib.Name(rawValue: "PreferencesWindowController"))
preferencesWinCtrl = ctrl
ctrl.showWindow(self) preferencesWinCtrl.showWindow(self)
NSApp.activate(ignoringOtherApps: true) NSApp.activate(ignoringOtherApps: true)
ctrl.window?.makeKeyAndOrderFront(self) preferencesWinCtrl.window?.makeKeyAndOrderFront(self)
} }
@IBAction func showAllInOnePreferences(_ sender: NSMenuItem) { @IBAction func showAllInOnePreferences(_ sender: NSMenuItem) {

View File

@ -11,15 +11,15 @@ import Foundation
class KcptunProfile: NSObject, NSCopying { class KcptunProfile: NSObject, NSCopying {
var mode: String = "fast" @objc var mode: String = "fast"
var key: String = "it's a secrect" @objc var key: String = "it's a secrect"
var crypt: String = "aes" @objc var crypt: String = "aes"
var nocomp: Bool = false @objc var nocomp: Bool = false
var datashard: uint = 10 @objc var datashard: uint = 10
var parityshard: uint = 3 @objc var parityshard: uint = 3
var mtu: uint = 1350 @objc var mtu: uint = 1350
var arguments: String = "" @objc var arguments: String = ""
public func copy(with zone: NSZone? = nil) -> Any { public func copy(with zone: NSZone? = nil) -> Any {

View File

@ -22,7 +22,7 @@ class PreferencesWinController: NSWindowController {
toolbar.selectedItemIdentifier = NSToolbarItem.Identifier(rawValue: "general") toolbar.selectedItemIdentifier = NSToolbarItem.Identifier(rawValue: "general")
} }
func windowWillClose(_ notification: Notification) { @objc func windowWillClose(_ notification: Notification) {
NotificationCenter.default NotificationCenter.default
.post(name: NOTIFY_CONF_CHANGED, object: nil) .post(name: NOTIFY_CONF_CHANGED, object: nil)
} }

View File

@ -11,17 +11,17 @@ import Cocoa
class ServerProfile: NSObject, NSCopying { class ServerProfile: NSObject, NSCopying {
var uuid: String @objc var uuid: String
var serverHost: String = "" @objc var serverHost: String = ""
var serverPort: uint16 = 8379 @objc var serverPort: uint16 = 8379
var method:String = "aes-128-gcm" @objc var method:String = "aes-128-gcm"
var password:String = "" @objc var password:String = ""
var remark:String = "" @objc var remark:String = ""
var ota: Bool = false // onetime authentication @objc var ota: Bool = false // onetime authentication
var enabledKcptun: Bool = false @objc var enabledKcptun: Bool = false
var kcptunProfile = KcptunProfile() @objc var kcptunProfile = KcptunProfile()
override init() { override init() {
uuid = UUID().uuidString uuid = UUID().uuidString