mirror of
https://github.com/zhigang1992/shadowsocks-iOS.git
synced 2026-06-18 07:29:39 +08:00
update UI
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
"incorrect URL" = "错误的 URL";
|
||||
"OK" = "确定";
|
||||
"Cancel" = "取消";
|
||||
"Yes" = "是";
|
||||
"No" = "否";
|
||||
"New Tab" = "新标签页";
|
||||
"Close" = "关闭";
|
||||
"Back" = "后退";
|
||||
@@ -37,4 +39,12 @@
|
||||
"Public" = "热心网友提供";
|
||||
"Custom" = "自定义";
|
||||
"Config via QRCode" = "用二维码配置";
|
||||
"Use this server?" = "使用这个服务器?";
|
||||
"Use this server?" = "使用这个服务器?";
|
||||
"Invalid Shadowsocks URL" = "无效的 Shadowsocks URL";
|
||||
"Shadowsocks: On" = "Shadowsocks: 打开";
|
||||
"Shadowsocks: Off" = "Shadowsocks: 关闭";
|
||||
"Turn Shadowsocks On" = "打开 Shadowsocks";
|
||||
"Turn Shadowsocks Off" = "关闭 Shadowsocks";
|
||||
"Open Server Preferences..." = "打开服务器设定...";
|
||||
"Show Logs..." = "显示日志..";
|
||||
"Quit" = "退出";
|
||||
@@ -44,17 +44,17 @@
|
||||
self.item.highlightMode = YES;
|
||||
NSMenu *menu = [[NSMenu alloc] initWithTitle:@"Shadowsocks"];
|
||||
[menu setMinimumWidth:200];
|
||||
statusMenuItem = [[NSMenuItem alloc] initWithTitle:@"Shadowsocks: On" action:nil keyEquivalent:@""];
|
||||
statusMenuItem = [[NSMenuItem alloc] initWithTitle:_L(Shadowsocks: On) action:nil keyEquivalent:@""];
|
||||
// [statusMenuItem setEnabled:NO];
|
||||
enableMenuItem = [[NSMenuItem alloc] initWithTitle:@"Turn Shadowsocks Off" action:@selector(toggleRunning) keyEquivalent:@""];
|
||||
enableMenuItem = [[NSMenuItem alloc] initWithTitle:_L(Turn Shadowsocks Off) action:@selector(toggleRunning) keyEquivalent:@""];
|
||||
// [enableMenuItem setState:1];
|
||||
[menu addItem:statusMenuItem];
|
||||
[menu addItem:enableMenuItem];
|
||||
[menu addItem:[NSMenuItem separatorItem]];
|
||||
[menu addItemWithTitle:@"Open Server Preferences..." action:@selector(showConfigWindow) keyEquivalent:@""];
|
||||
[menu addItemWithTitle:@"Show Logs..." action:@selector(showLogs) keyEquivalent:@""];
|
||||
[menu addItemWithTitle:_L(Open Server Preferences...) action:@selector(showConfigWindow) keyEquivalent:@""];
|
||||
[menu addItemWithTitle:_L(Show Logs...) action:@selector(showLogs) keyEquivalent:@""];
|
||||
[menu addItem:[NSMenuItem separatorItem]];
|
||||
[menu addItemWithTitle:@"Quit" action:@selector(exit) keyEquivalent:@""];
|
||||
[menu addItemWithTitle:_L(Quit) action:@selector(exit) keyEquivalent:@""];
|
||||
self.item.menu = menu;
|
||||
[self initializeProxy];
|
||||
|
||||
@@ -64,13 +64,13 @@
|
||||
- (void)toggleRunning {
|
||||
[self toggleSystemProxy:!isRunning];
|
||||
if (isRunning) {
|
||||
statusMenuItem.title = @"Shadowsocks: On";
|
||||
enableMenuItem.title = @"Turn Shadowsocks Off";
|
||||
statusMenuItem.title = _L(Shadowsocks: On);
|
||||
enableMenuItem.title = _L(Turn Shadowsocks Off);
|
||||
self.item.image = [NSImage imageNamed:@"menu_icon"];
|
||||
// [enableMenuItem setState:1];
|
||||
} else {
|
||||
statusMenuItem.title = @"Shadowsocks: Off";
|
||||
enableMenuItem.title = @"Turn Shadowsocks On";
|
||||
statusMenuItem.title = _L(Shadowsocks: Off);
|
||||
enableMenuItem.title = _L(Turn Shadowsocks On);
|
||||
self.item.image = [NSImage imageNamed:@"menu_icon_disabled"];
|
||||
// [enableMenuItem setState:0];
|
||||
}
|
||||
@@ -171,17 +171,17 @@ static AuthorizationFlags authFlags;
|
||||
- (void)handleURLEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent {
|
||||
NSString* url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
|
||||
NSAlert *alert = [[NSAlert alloc] init];
|
||||
[alert addButtonWithTitle:@"OK"];
|
||||
[alert addButtonWithTitle:@"Cancel"];
|
||||
[alert setMessageText:@"Do you want to use this server?"];
|
||||
[alert addButtonWithTitle:_L(OK)];
|
||||
[alert addButtonWithTitle:_L(Cancel)];
|
||||
[alert setMessageText:_L(Use this server?)];
|
||||
[alert setInformativeText:url];
|
||||
[alert setAlertStyle:NSInformationalAlertStyle];
|
||||
if ([alert runModal] == NSAlertFirstButtonReturn) {
|
||||
BOOL result = [ShadowsocksRunner openSSURL:[NSURL URLWithString:url]];
|
||||
if (!result) {
|
||||
alert = [[NSAlert alloc] init];
|
||||
[alert addButtonWithTitle:@"OK"];
|
||||
[alert setMessageText:@"Bad Shadowsocks URL"];
|
||||
[alert addButtonWithTitle:_L(OK)];
|
||||
[alert setMessageText:@"Invalid Shadowsocks URL"];
|
||||
[alert setAlertStyle:NSCriticalAlertStyle];
|
||||
[alert runModal];
|
||||
}
|
||||
|
||||
@@ -7,3 +7,5 @@
|
||||
#ifdef __OBJC__
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#endif
|
||||
|
||||
#define _L(s) NSLocalizedString(@#s, nil)
|
||||
@@ -41,6 +41,7 @@
|
||||
622BE4E718B7307200F22683 /* menu_icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 622BE4E518B7307200F22683 /* menu_icon.png */; };
|
||||
6232047118C0719D001A30B9 /* menu_icon_disabled.png in Resources */ = {isa = PBXBuildFile; fileRef = 6232046F18C0719D001A30B9 /* menu_icon_disabled.png */; };
|
||||
6232047218C0719D001A30B9 /* menu_icon_disabled@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6232047018C0719D001A30B9 /* menu_icon_disabled@2x.png */; };
|
||||
6232047718C08C6C001A30B9 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 628C3DE118AD5AFA0090632A /* Localizable.strings */; };
|
||||
623A7EBB1795AE8000DF11DF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 621571AA16CF6BCB003D96B4 /* Foundation.framework */; };
|
||||
623A7EC61795AF1000DF11DF /* ev.c in Sources */ = {isa = PBXBuildFile; fileRef = 628693FD16DA2983008B1A26 /* ev.c */; };
|
||||
623A7EC71795B0C700DF11DF /* encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 628693EE16DA2815008B1A26 /* encrypt.c */; };
|
||||
@@ -969,6 +970,7 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
6232047718C08C6C001A30B9 /* Localizable.strings in Resources */,
|
||||
629AC93818B497C0001D2771 /* proxy.pac in Resources */,
|
||||
629AC93318B49341001D2771 /* Application.xib in Resources */,
|
||||
6232047218C0719D001A30B9 /* menu_icon_disabled@2x.png in Resources */,
|
||||
|
||||
Reference in New Issue
Block a user