Merge branch 'pr/197' into develop
# Conflicts: # ShadowsocksX-NG/ServerProfile.swift
This commit is contained in:
@ -1,9 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
|
||||||
<capability name="box content view" minToolsVersion="7.0"/>
|
<capability name="box content view" minToolsVersion="7.0"/>
|
||||||
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
<customObject id="-2" userLabel="File's Owner" customClass="PreferencesWindowController" customModule="ShadowsocksX_NG" customModuleProvider="target">
|
<customObject id="-2" userLabel="File's Owner" customClass="PreferencesWindowController" customModule="ShadowsocksX_NG" customModuleProvider="target">
|
||||||
@ -26,7 +27,7 @@
|
|||||||
<window title="Server Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" oneShot="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
<window title="Server Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" oneShot="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
||||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
|
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
|
||||||
<rect key="contentRect" x="423" y="365" width="590" height="330"/>
|
<rect key="contentRect" x="423" y="365" width="590" height="330"/>
|
||||||
<rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/>
|
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/>
|
||||||
<view key="contentView" id="se5-gp-TjO">
|
<view key="contentView" id="se5-gp-TjO">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="590" height="330"/>
|
<rect key="frame" x="0.0" y="0.0" width="590" height="330"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
@ -70,6 +71,7 @@
|
|||||||
<connections>
|
<connections>
|
||||||
<outlet property="dataSource" destination="-2" id="fz3-X6-PbB"/>
|
<outlet property="dataSource" destination="-2" id="fz3-X6-PbB"/>
|
||||||
<outlet property="delegate" destination="-2" id="6zR-v1-wZj"/>
|
<outlet property="delegate" destination="-2" id="6zR-v1-wZj"/>
|
||||||
|
<outlet property="menu" destination="QmU-th-vjP" id="J0d-c9-pYs"/>
|
||||||
</connections>
|
</connections>
|
||||||
</tableView>
|
</tableView>
|
||||||
</subviews>
|
</subviews>
|
||||||
@ -339,6 +341,17 @@ DQ
|
|||||||
<real key="minimum" value="1"/>
|
<real key="minimum" value="1"/>
|
||||||
<real key="maximum" value="65535"/>
|
<real key="maximum" value="65535"/>
|
||||||
</numberFormatter>
|
</numberFormatter>
|
||||||
|
<menu showsStateColumn="NO" id="QmU-th-vjP">
|
||||||
|
<items>
|
||||||
|
<menuItem title="Duplicate" id="bl9-lq-u9V">
|
||||||
|
<modifierMask key="keyEquivalentModifierMask"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="duplicate:" target="-2" id="dEb-Dt-yBW"/>
|
||||||
|
</connections>
|
||||||
|
</menuItem>
|
||||||
|
</items>
|
||||||
|
<point key="canvasLocation" x="-25.5" y="171.5"/>
|
||||||
|
</menu>
|
||||||
</objects>
|
</objects>
|
||||||
<resources>
|
<resources>
|
||||||
<image name="NSAddTemplate" width="11" height="11"/>
|
<image name="NSAddTemplate" width="11" height="11"/>
|
||||||
|
@ -114,6 +114,20 @@ class PreferencesWindowController: NSWindowController
|
|||||||
window?.performClose(self)
|
window?.performClose(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@IBAction func duplicate(_ sender: Any) {
|
||||||
|
let profile = profileMgr.profiles[profilesTableView.clickedRow]
|
||||||
|
let duplicateProfile = profile.copy() as! ServerProfile
|
||||||
|
duplicateProfile.uuid = UUID().uuidString
|
||||||
|
profileMgr.profiles.insert(duplicateProfile, at: profilesTableView.clickedRow+1)
|
||||||
|
profilesTableView.beginUpdates()
|
||||||
|
let index = IndexSet(integer: profileMgr.profiles.count-1)
|
||||||
|
profilesTableView.insertRows(at: index, withAnimation: .effectFade)
|
||||||
|
self.profilesTableView.scrollRowToVisible(profilesTableView.clickedRow+1)
|
||||||
|
self.profilesTableView.selectRowIndexes(index, byExtendingSelection: false)
|
||||||
|
profilesTableView.endUpdates()
|
||||||
|
updateProfileBoxVisible()
|
||||||
|
}
|
||||||
|
|
||||||
@IBAction func copyCurrentProfileURL2Pasteboard(_ sender: NSButton) {
|
@IBAction func copyCurrentProfileURL2Pasteboard(_ sender: NSButton) {
|
||||||
let index = profilesTableView.selectedRow
|
let index = profilesTableView.selectedRow
|
||||||
if index >= 0 {
|
if index >= 0 {
|
||||||
|
@ -8,7 +8,9 @@
|
|||||||
|
|
||||||
import Cocoa
|
import Cocoa
|
||||||
|
|
||||||
class ServerProfile: NSObject {
|
|
||||||
|
class ServerProfile: NSObject, NSCopying {
|
||||||
|
|
||||||
var uuid: String
|
var uuid: String
|
||||||
|
|
||||||
var serverHost: String = ""
|
var serverHost: String = ""
|
||||||
@ -75,8 +77,19 @@ class ServerProfile: NSObject {
|
|||||||
ota = NSString(string: otaStr).boolValue
|
ota = NSString(string: otaStr).boolValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static func fromDictionary(_ data:[String: Any?]) -> ServerProfile {
|
public func copy(with zone: NSZone? = nil) -> Any {
|
||||||
|
let copy = ServerProfile()
|
||||||
|
copy.serverHost = self.serverHost
|
||||||
|
copy.serverPort = self.serverPort
|
||||||
|
copy.method = self.method
|
||||||
|
copy.password = self.password
|
||||||
|
copy.remark = self.remark
|
||||||
|
copy.ota = self.ota
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
static func fromDictionary(_ data:[String:Any?]) -> ServerProfile {
|
||||||
let cp = {
|
let cp = {
|
||||||
(profile: ServerProfile) in
|
(profile: ServerProfile) in
|
||||||
profile.serverHost = data["ServerHost"] as! String
|
profile.serverHost = data["ServerHost"] as! String
|
||||||
|
@ -34,3 +34,6 @@
|
|||||||
|
|
||||||
/* Class = "NSButtonCell"; title = "OK"; ObjectID = "zPE-oD-PwK"; */
|
/* Class = "NSButtonCell"; title = "OK"; ObjectID = "zPE-oD-PwK"; */
|
||||||
"zPE-oD-PwK.title" = "确定";
|
"zPE-oD-PwK.title" = "确定";
|
||||||
|
|
||||||
|
/* Class = "NSMenuItem"; title = "Duplicate"; ObjectID = "bl9-lq-u9V"; */
|
||||||
|
"bl9-lq-u9V.title" = "复制";
|
||||||
|
Reference in New Issue
Block a user