mirror of
https://github.com/qinyuhang/ShadowsocksX-NG-R.git
synced 2026-10-20 14:34:30 +00:00
fix bug
修正服务器设置面板不能拷贝到剪切板的bug 重新组织了AppDelegate的结构 修正travis-ci报错问题
This commit is contained in:
+1
-1
@@ -2,4 +2,4 @@ language: objective-c
|
||||
osx_image: xcode7.3
|
||||
xcode_workspace: ShadowsocksX-NG.xcworkspace
|
||||
xcode_scheme: ShadowsocksX-NG
|
||||
script: set -o pipefail && xcodebuild test -workspace ShadowsocksX-NG.xcworkspace -scheme ShadowsocksX-NG|xcpretty
|
||||
script: set -o pipefail && xcodebuild test -workspace ShadowsocksX-NG.xcworkspace -scheme ShadowsocksX-NG -sdk macosx10.12 CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO|xcpretty
|
||||
|
||||
@@ -452,7 +452,8 @@
|
||||
TargetAttributes = {
|
||||
9B0BFFE41D0460A70040E62B = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
ProvisioningStyle = Manual;
|
||||
DevelopmentTeam = 2E8Q4BTFR2;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
9B0BFFF31D0460A70040E62B = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
@@ -861,9 +862,9 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "Developer ID Application";
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DEVELOPMENT_TEAM = 2E8Q4BTFR2;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(SRCROOT)/libcork/include/",
|
||||
"$(SRCROOT)/libipset/include/",
|
||||
@@ -893,7 +894,7 @@
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DEVELOPMENT_TEAM = 2E8Q4BTFR2;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(SRCROOT)/libcork/include/",
|
||||
"$(SRCROOT)/libipset/include/",
|
||||
|
||||
@@ -11,15 +11,17 @@ import Cocoa
|
||||
|
||||
@NSApplicationMain
|
||||
class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDelegate {
|
||||
|
||||
|
||||
// MARK: Controllers
|
||||
var qrcodeWinCtrl: SWBQRCodeWindowController!
|
||||
var preferencesWinCtrl: PreferencesWindowController!
|
||||
var advPreferencesWinCtrl: AdvPreferencesWindowController!
|
||||
var proxyPreferencesWinCtrl: ProxyPreferencesController!
|
||||
var editUserRulesWinCtrl: UserRulesController!
|
||||
|
||||
|
||||
var launchAtLoginController: LaunchAtLoginController = LaunchAtLoginController()
|
||||
|
||||
// MARK: Outlets
|
||||
@IBOutlet weak var window: NSWindow!
|
||||
@IBOutlet weak var statusMenu: NSMenu!
|
||||
|
||||
@@ -46,6 +48,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
@IBOutlet weak var connectAtLaunchMenuItem: NSMenuItem!
|
||||
@IBOutlet weak var ShowNetworkSpeedItem: NSMenuItem!
|
||||
|
||||
// MARK: Variables
|
||||
var statusItemView:StatusItemView!
|
||||
|
||||
var statusItem: NSStatusItem?
|
||||
@@ -236,7 +239,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
|
||||
}
|
||||
|
||||
// MARK: interface functions
|
||||
// MARK: Mainmenu functions
|
||||
|
||||
@IBAction func toggleRunning(sender: NSMenuItem) {
|
||||
let defaults = NSUserDefaults.standardUserDefaults()
|
||||
@@ -269,6 +272,18 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
ctrl.window?.makeKeyAndOrderFront(self)
|
||||
}
|
||||
|
||||
@IBAction func toggleLaunghAtLogin(sender: NSMenuItem) {
|
||||
launchAtLoginController.launchAtLogin = !launchAtLoginController.launchAtLogin;
|
||||
updateLaunchAtLoginMenu()
|
||||
}
|
||||
|
||||
@IBAction func toggleConnectAtLaunch(sender: NSMenuItem) {
|
||||
let defaults = NSUserDefaults.standardUserDefaults()
|
||||
defaults.setBool(!defaults.boolForKey("ConnectAtLaunch"), forKey: "ConnectAtLaunch")
|
||||
updateMainMenu()
|
||||
}
|
||||
|
||||
// MARK: Server submenu function
|
||||
@IBAction func showQRCodeForCurrentServer(sender: NSMenuItem) {
|
||||
var errMsg: String?
|
||||
if let profile = ServerProfileManager.instance.getActiveProfile() {
|
||||
@@ -314,17 +329,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
@IBAction func exportAllServerProfile(sender: NSMenuItem) {
|
||||
ServerProfileManager.instance.exportConfigFile()
|
||||
}
|
||||
|
||||
@IBAction func toggleLaunghAtLogin(sender: NSMenuItem) {
|
||||
launchAtLoginController.launchAtLogin = !launchAtLoginController.launchAtLogin;
|
||||
updateLaunchAtLoginMenu()
|
||||
}
|
||||
|
||||
@IBAction func toggleConnectAtLaunch(sender: NSMenuItem) {
|
||||
let defaults = NSUserDefaults.standardUserDefaults()
|
||||
defaults.setBool(!defaults.boolForKey("ConnectAtLaunch"), forKey: "ConnectAtLaunch")
|
||||
updateMainMenu()
|
||||
}
|
||||
|
||||
@IBAction func selectPACMode(sender: NSMenuItem) {
|
||||
let defaults = NSUserDefaults.standardUserDefaults()
|
||||
@@ -636,7 +640,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
}
|
||||
|
||||
//------------------------------------------------------------
|
||||
// NSUserNotificationCenterDelegate
|
||||
// MARK: NSUserNotificationCenterDelegate
|
||||
|
||||
func userNotificationCenter(center: NSUserNotificationCenter
|
||||
, shouldPresentNotification notification: NSUserNotification) -> Bool {
|
||||
|
||||
@@ -160,10 +160,6 @@ class PingTest: NSObject, SimplePingDelegate {
|
||||
}
|
||||
class func pingArray(){//hostList : [String]) -> [[String : String]]{
|
||||
// return [["apple.com":"20"],["baidu.com":"20"]]
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -172,11 +172,10 @@ class PreferencesWindowController: NSWindowController
|
||||
let profile = profileMgr.profiles[index]
|
||||
let ssURL = profile.URL()
|
||||
if let url = ssURL {
|
||||
// Then copy url to pasteboard
|
||||
// TODO Why it not working?? It's ok in objective-c
|
||||
|
||||
let pboard = NSPasteboard.generalPasteboard()
|
||||
pboard.clearContents()
|
||||
let rs = pboard.writeObjects([url])
|
||||
let rs = pboard.setString(String(url), forType: NSStringPboardType)//writeObjects([url])
|
||||
if rs {
|
||||
NSLog("copy to pasteboard success")
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user