Improve: Config Generator support keyboard shortcut and rc4md5/chacha20 encrypt methods. Feature: add auto start at login
This commit is contained in:
parent
67a5cd2585
commit
302b683c36
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
Country.mmdb
|
||||
Carthage
|
||||
|
1
Cartfile.resolved
Normal file
1
Cartfile.resolved
Normal file
@ -0,0 +1 @@
|
||||
github "sindresorhus/LaunchAtLogin" "v2.1.0"
|
@ -10,8 +10,9 @@
|
||||
4989F98020D01C8F0001E564 /* clash.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4989F97E20D01C8F0001E564 /* clash.a */; };
|
||||
4989F98420D02D200001E564 /* Country.mmdb in Resources */ = {isa = PBXBuildFile; fileRef = 4989F98320D02D200001E564 /* Country.mmdb */; };
|
||||
4989F98B20D0AD800001E564 /* SampleConfigViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4989F98920D0AD800001E564 /* SampleConfigViewController.swift */; };
|
||||
4989F98C20D0AD800001E564 /* SampleConfigViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4989F98A20D0AD800001E564 /* SampleConfigViewController.xib */; };
|
||||
4989F98E20D0AE990001E564 /* sampleConfig.ini in Resources */ = {isa = PBXBuildFile; fileRef = 4989F98D20D0AE990001E564 /* sampleConfig.ini */; };
|
||||
4997732520D251A60009B136 /* SWBApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 4997732320D251A60009B136 /* SWBApplication.m */; };
|
||||
4997735920D25AB10009B136 /* LaunchAtLogin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4997735820D25AB10009B136 /* LaunchAtLogin.framework */; };
|
||||
49CF3B2120CD7463001EBF94 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49CF3B2020CD7463001EBF94 /* AppDelegate.swift */; };
|
||||
49CF3B2520CD7465001EBF94 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 49CF3B2420CD7465001EBF94 /* Assets.xcassets */; };
|
||||
49CF3B2820CD7465001EBF94 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 49CF3B2620CD7465001EBF94 /* Main.storyboard */; };
|
||||
@ -41,8 +42,10 @@
|
||||
4989F97F20D01C8F0001E564 /* clash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = clash.h; sourceTree = "<group>"; };
|
||||
4989F98320D02D200001E564 /* Country.mmdb */ = {isa = PBXFileReference; lastKnownFileType = file; path = Country.mmdb; sourceTree = "<group>"; };
|
||||
4989F98920D0AD800001E564 /* SampleConfigViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleConfigViewController.swift; sourceTree = "<group>"; };
|
||||
4989F98A20D0AD800001E564 /* SampleConfigViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SampleConfigViewController.xib; sourceTree = "<group>"; };
|
||||
4989F98D20D0AE990001E564 /* sampleConfig.ini */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sampleConfig.ini; sourceTree = "<group>"; };
|
||||
4997732320D251A60009B136 /* SWBApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWBApplication.m; sourceTree = "<group>"; };
|
||||
4997732420D251A60009B136 /* SWBApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWBApplication.h; sourceTree = "<group>"; };
|
||||
4997735820D25AB10009B136 /* LaunchAtLogin.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LaunchAtLogin.framework; path = Carthage/Build/Mac/LaunchAtLogin.framework; sourceTree = "<group>"; };
|
||||
49CF3B1D20CD7463001EBF94 /* ClashX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ClashX.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
49CF3B2020CD7463001EBF94 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
49CF3B2420CD7465001EBF94 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
@ -67,6 +70,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4997735920D25AB10009B136 /* LaunchAtLogin.framework in Frameworks */,
|
||||
4989F98020D01C8F0001E564 /* clash.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -78,16 +82,33 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4989F98920D0AD800001E564 /* SampleConfigViewController.swift */,
|
||||
4989F98A20D0AD800001E564 /* SampleConfigViewController.xib */,
|
||||
);
|
||||
path = ViewControllers;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4997732220D251A60009B136 /* Basic */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4997732320D251A60009B136 /* SWBApplication.m */,
|
||||
4997732420D251A60009B136 /* SWBApplication.h */,
|
||||
);
|
||||
path = Basic;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4997735720D25AB00009B136 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4997735820D25AB10009B136 /* LaunchAtLogin.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
49CF3B1420CD7463001EBF94 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
49CF3B1F20CD7463001EBF94 /* ClashX */,
|
||||
49CF3B1E20CD7463001EBF94 /* Products */,
|
||||
4997735720D25AB00009B136 /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@ -102,6 +123,7 @@
|
||||
49CF3B1F20CD7463001EBF94 /* ClashX */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4997732220D251A60009B136 /* Basic */,
|
||||
4989F98520D0AA300001E564 /* ViewControllers */,
|
||||
49CF3B5D20CE80D2001EBF94 /* script */,
|
||||
49CF3B5A20CE8054001EBF94 /* Managers */,
|
||||
@ -185,6 +207,8 @@
|
||||
49CF3B1920CD7463001EBF94 /* Sources */,
|
||||
49CF3B1A20CD7463001EBF94 /* Frameworks */,
|
||||
49CF3B1B20CD7463001EBF94 /* Resources */,
|
||||
4997735A20D25ACC0009B136 /* ShellScript */,
|
||||
4997735C20D25AF00009B136 /* ShellScript */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@ -264,7 +288,6 @@
|
||||
49CF3B4020CD7845001EBF94 /* menu_icon_disabled@2x.png in Resources */,
|
||||
49CF3B3F20CD7845001EBF94 /* menu_icon.png in Resources */,
|
||||
4989F98420D02D200001E564 /* Country.mmdb in Resources */,
|
||||
4989F98C20D0AD800001E564 /* SampleConfigViewController.xib in Resources */,
|
||||
4989F98E20D0AE990001E564 /* sampleConfig.ini in Resources */,
|
||||
49CF3B6320CED9CF001EBF94 /* check_proxy_helper.sh in Resources */,
|
||||
);
|
||||
@ -272,6 +295,36 @@
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
4997735A20D25ACC0009B136 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "./Carthage/Build/Mac/LaunchAtLogin.framework/Resources/copy-helper.sh";
|
||||
};
|
||||
4997735C20D25AF00009B136 /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
"$(SRCROOT)/Carthage/Build/Mac/LaunchAtLogin.framework",
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/usr/local/bin/carthage copy-frameworks";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
49CF3B1920CD7463001EBF94 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
@ -279,6 +332,7 @@
|
||||
files = (
|
||||
4989F98B20D0AD800001E564 /* SampleConfigViewController.swift in Sources */,
|
||||
49CF3B5C20CE8068001EBF94 /* ProxyConfigManager.swift in Sources */,
|
||||
4997732520D251A60009B136 /* SWBApplication.m in Sources */,
|
||||
49CF3B2120CD7463001EBF94 /* AppDelegate.swift in Sources */,
|
||||
49CF3B6520CEE06C001EBF94 /* ConfigManager.swift in Sources */,
|
||||
);
|
||||
@ -419,6 +473,10 @@
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_TEAM = MEWHFZ92DY;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/Mac",
|
||||
);
|
||||
INFOPLIST_FILE = ClashX/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@ -429,6 +487,7 @@
|
||||
"$(PROJECT_DIR)/ClashX",
|
||||
"$(PROJECT_DIR)/ClashX/clash",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.west2online.ClashX;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "ClashX/ClashX-Bridging-Header.h";
|
||||
@ -445,6 +504,10 @@
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_TEAM = MEWHFZ92DY;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)/Carthage/Build/Mac",
|
||||
);
|
||||
INFOPLIST_FILE = ClashX/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@ -455,6 +518,7 @@
|
||||
"$(PROJECT_DIR)/ClashX",
|
||||
"$(PROJECT_DIR)/ClashX/clash",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.west2online.ClashX;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "ClashX/ClashX-Bridging-Header.h";
|
||||
|
@ -7,8 +7,7 @@
|
||||
//
|
||||
|
||||
import Cocoa
|
||||
|
||||
|
||||
import LaunchAtLogin
|
||||
|
||||
@NSApplicationMain
|
||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
@ -18,6 +17,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
|
||||
@IBOutlet weak var statusMenu: NSMenu!
|
||||
@IBOutlet weak var proxySettingMenuItem: NSMenuItem!
|
||||
@IBOutlet weak var autoStartMenuItem: NSMenuItem!
|
||||
|
||||
let ssQueue = DispatchQueue(label: "com.w2fzu.ssqueue", attributes: .concurrent)
|
||||
|
||||
@ -44,6 +44,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
|
||||
func updateMenuItem(){
|
||||
proxySettingMenuItem.state = ConfigManager.proxyPortAutoSet ? .on : .off
|
||||
autoStartMenuItem.state = LaunchAtLogin.isEnabled ? .on:.off
|
||||
|
||||
}
|
||||
|
||||
func startProxy() {
|
||||
@ -83,6 +85,22 @@ class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
pasteboard.setString("export https_proxy=http://127.0.0.1:\(ConfigManager.httpProxyPort);export http_proxy=http://127.0.0.1:\(ConfigManager.httpProxyPort)", forType: .string)
|
||||
}
|
||||
|
||||
@IBAction func actionStartAtLogin(_ sender: NSMenuItem) {
|
||||
LaunchAtLogin.isEnabled = !LaunchAtLogin.isEnabled
|
||||
updateMenuItem()
|
||||
}
|
||||
|
||||
var genConfigWindow:NSWindowController?=nil
|
||||
@IBAction func actionGenConfig(_ sender: Any) {
|
||||
let ctrl = NSStoryboard(name: NSStoryboard.Name(rawValue: "Main"), bundle: nil)
|
||||
.instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "sampleConfigGenerator")) as! NSWindowController
|
||||
genConfigWindow?.close()
|
||||
genConfigWindow=ctrl
|
||||
ctrl.showWindow(nil)
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
ctrl.window?.makeKeyAndOrderFront(self)
|
||||
|
||||
}
|
||||
|
||||
@IBAction func openConfigFolder(_ sender: Any) {
|
||||
let path = (NSHomeDirectory() as NSString).appendingPathComponent("/.config/clash/config.ini")
|
||||
|
@ -16,6 +16,7 @@
|
||||
</application>
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModule="ClashX" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="autoStartMenuItem" destination="B1J-XB-BiZ" id="xaS-h5-qd0"/>
|
||||
<outlet property="proxySettingMenuItem" destination="8se-yr-wmp" id="yvm-QP-yoA"/>
|
||||
<outlet property="statusMenu" destination="Afa-lD-EbR" id="cov-E9-WrO"/>
|
||||
</connections>
|
||||
@ -30,6 +31,9 @@
|
||||
</menuItem>
|
||||
<menuItem title="start at login" id="B1J-XB-BiZ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="actionStartAtLogin:" target="Voe-Tx-rLC" id="aie-1F-HjZ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="copy export command" id="Jmb-PK-rMW">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
@ -44,25 +48,22 @@
|
||||
<menuItem title="generate config" id="5Ab-VJ-iIm">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<segue destination="Byh-1P-5fs" kind="show" id="mVy-i5-se3"/>
|
||||
<action selector="actionGenConfig:" target="Voe-Tx-rLC" id="SBd-vV-e1R"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="open Config Folder" id="DwE-WX-ETZ">
|
||||
<menuItem title="edit config" id="DwE-WX-ETZ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="openConfigFolder:" target="Voe-Tx-rLC" id="6Ke-Bi-AAZ"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="update config" id="q3G-VH-eyy">
|
||||
<menuItem title="reload config" id="q3G-VH-eyy">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="actionUpdateConfig:" target="Voe-Tx-rLC" id="oW5-Ll-SY8"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="import Config" id="GRE-Ra-Pkx">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
<menuItem title="reload Config" id="MKB-4v-QNy">
|
||||
<menuItem title="import config" id="GRE-Ra-Pkx">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
</menuItem>
|
||||
</items>
|
||||
@ -84,7 +85,7 @@
|
||||
<!--Window Controller-->
|
||||
<scene sceneID="seD-T7-5qr">
|
||||
<objects>
|
||||
<windowController id="Byh-1P-5fs" sceneMemberID="viewController">
|
||||
<windowController storyboardIdentifier="sampleConfigGenerator" id="Byh-1P-5fs" sceneMemberID="viewController">
|
||||
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="q8i-4q-6dO">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
|
11
ClashX/Basic/SWBApplication.h
Normal file
11
ClashX/Basic/SWBApplication.h
Normal file
@ -0,0 +1,11 @@
|
||||
//
|
||||
// Created by clowwindy on 3/1/14.
|
||||
// Copyright (c) 2014 clowwindy. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
@import AppKit;
|
||||
|
||||
|
||||
@interface SWBApplication : NSApplication
|
||||
@end
|
49
ClashX/Basic/SWBApplication.m
Normal file
49
ClashX/Basic/SWBApplication.m
Normal file
@ -0,0 +1,49 @@
|
||||
//
|
||||
// Created by clowwindy on 3/1/14.
|
||||
// Copyright (c) 2014 clowwindy. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SWBApplication.h"
|
||||
|
||||
|
||||
@implementation SWBApplication {
|
||||
|
||||
}
|
||||
|
||||
// Enable Key Shortcuts
|
||||
// http://stackoverflow.com/questions/970707/cocoa-keyboard-shortcuts-in-dialog-without-an-edit-menu
|
||||
- (void) sendEvent:(NSEvent *)event {
|
||||
if ([event type] == NSKeyDown) {
|
||||
if (([event modifierFlags] & NSDeviceIndependentModifierFlagsMask) == NSCommandKeyMask) {
|
||||
if ([[event charactersIgnoringModifiers] isEqualToString:@"x"]) {
|
||||
if ([self sendAction:@selector(cut:) to:nil from:self])
|
||||
return;
|
||||
}
|
||||
else if ([[event charactersIgnoringModifiers] isEqualToString:@"c"]) {
|
||||
if ([self sendAction:@selector(copy:) to:nil from:self])
|
||||
return;
|
||||
}
|
||||
else if ([[event charactersIgnoringModifiers] isEqualToString:@"v"]) {
|
||||
if ([self sendAction:@selector(paste:) to:nil from:self])
|
||||
return;
|
||||
}
|
||||
else if ([[event charactersIgnoringModifiers] isEqualToString:@"z"]) {
|
||||
if ([self sendAction:@selector(undo) to:nil from:self])
|
||||
return;
|
||||
}
|
||||
else if ([[event charactersIgnoringModifiers] isEqualToString:@"a"]) {
|
||||
if ([self sendAction:@selector(selectAll:) to:nil from:self])
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (([event modifierFlags] & NSDeviceIndependentModifierFlagsMask) == (NSCommandKeyMask | NSShiftKeyMask)) {
|
||||
if ([[event charactersIgnoringModifiers] isEqualToString:@"Z"]) {
|
||||
if ([self sendAction:@selector(redo) to:nil from:self])
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
[super sendEvent:event];
|
||||
}
|
||||
|
||||
@end
|
@ -29,6 +29,6 @@
|
||||
<key>NSMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<string>SWBApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -89,7 +89,7 @@
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0820;
|
||||
LastUpgradeCheck = 0820;
|
||||
LastUpgradeCheck = 0940;
|
||||
ORGANIZATIONNAME = "Zhuhao Wang";
|
||||
TargetAttributes = {
|
||||
36B6A3221E263590002B5B1D = {
|
||||
@ -136,15 +136,23 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@ -184,15 +192,23 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@ -212,6 +228,7 @@
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@ -250,6 +267,7 @@
|
||||
36B6A32C1E263590002B5B1D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
|
@ -64,12 +64,41 @@ class SampleConfigViewController: NSViewController {
|
||||
|
||||
}
|
||||
|
||||
func shakeWindows(){
|
||||
let numberOfShakes:Int = 8
|
||||
let durationOfShake:Float = 0.5
|
||||
let vigourOfShake:Float = 0.05
|
||||
let window = self.view.window
|
||||
let frame:CGRect = (window?.frame)!
|
||||
let shakeAnimation = CAKeyframeAnimation()
|
||||
|
||||
let shakePath = CGMutablePath()
|
||||
shakePath.move(to: CGPoint(x:NSMinX(frame), y:NSMinX(frame)))
|
||||
|
||||
for _ in 1...numberOfShakes{
|
||||
shakePath.addLine(to: CGPoint(x: NSMinX(frame) - frame.size.width * CGFloat(vigourOfShake), y: NSMinY(frame)))
|
||||
shakePath.addLine(to: CGPoint(x: NSMinX(frame) + frame.size.width * CGFloat(vigourOfShake), y: NSMinY(frame)))
|
||||
}
|
||||
|
||||
shakePath.closeSubpath()
|
||||
shakeAnimation.path = shakePath
|
||||
shakeAnimation.duration = CFTimeInterval(durationOfShake)
|
||||
window?.animations = [NSAnimatablePropertyKey("frameOrigin"):shakeAnimation]
|
||||
window?.animator().setFrameOrigin(window!.frame.origin)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@IBAction func actionConfirm(_ sender: Any) {
|
||||
if (vaildConfig()) {
|
||||
generateConfig()
|
||||
self.view.window?.windowController?.close()
|
||||
DispatchQueue(label: "com.w2fzu.ssqueue", attributes: .concurrent).async {
|
||||
updateConfigC()
|
||||
}
|
||||
} else {
|
||||
shakeWindows()
|
||||
}
|
||||
self.view.window?.windowController?.close()
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11134"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="SampleConfigViewController" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customView id="Hz6-mo-xeY">
|
||||
<rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
</customView>
|
||||
</objects>
|
||||
</document>
|
Loading…
Reference in New Issue
Block a user