Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Commit ff57615

Browse files
committed
minor UI modification
1 parent b68bf65 commit ff57615

4 files changed

+13
-10
lines changed

V2RayX/AdvancedWindowController.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ - (BOOL)checkOutbound {
195195
NSError *e;
196196
NSDictionary* newOutboud = [NSJSONSerialization JSONObjectWithData:[_outboundJsonView.string dataUsingEncoding:NSUTF8StringEncoding] options:0 error:&e];
197197
if (e) {
198-
[self showAlert:@"not a valid json"];
198+
[self showAlert:@"NOT a valid json"];
199199
[_outboundTable selectRowIndexes:[NSIndexSet indexSetWithIndex:_selectedOutbound] byExtendingSelection:NO];
200200
return NO;
201201
} else {

V2RayX/AppDelegate.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ - (void)updateServerMenuList {
572572
} else {
573573
int i = 0;
574574
for (NSDictionary *p in profiles) {
575-
NSString *itemTitle = [NSString stringWithFormat:@"%@:%@",p[@"protocol"], p[@"tag"]];
575+
NSString *itemTitle = nilCoalescing(p[@"tag"], @"");
576576
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:itemTitle action:@selector(switchServer:) keyEquivalent:@""];
577577
[newItem setTag:i];
578578
if (useMultipleServer){

V2RayX/ConfigWindow.xib

+3-2
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
148148
<clipView key="contentView" ambiguous="YES" drawsBackground="NO" id="0kH-bt-ahk">
149149
<rect key="frame" x="1" y="1" width="138" height="181"/>
150-
<autoresizingMask key="autoresizingMask"/>
150+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
151151
<subviews>
152152
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnReordering="NO" columnResizing="NO" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" id="fje-9q-W5F">
153153
<rect key="frame" x="0.0" y="0.0" width="138" height="181"/>
@@ -603,7 +603,7 @@ Gw
603603
<action selector="importFromJSONFiles:" target="-2" id="bWI-hd-Wef"/>
604604
</connections>
605605
</menuItem>
606-
<menuItem title="Import from standard SS share links..." id="CTZ-Lq-X8f">
606+
<menuItem title="Import from standard share links..." id="CTZ-Lq-X8f">
607607
<modifierMask key="keyEquivalentModifierMask"/>
608608
<connections>
609609
<action selector="importFromStandardLink:" target="-2" id="prN-IG-Awe"/>
@@ -612,6 +612,7 @@ Gw
612612
<menuItem title="Import from pastboard..." hidden="YES" id="EQb-nS-Lf9">
613613
<modifierMask key="keyEquivalentModifierMask"/>
614614
</menuItem>
615+
<menuItem isSeparatorItem="YES" id="HUE-ih-p3S"/>
615616
<menuItem title="Import from other miscellaneous links..." id="8rA-16-mml">
616617
<modifierMask key="keyEquivalentModifierMask"/>
617618
<connections>

V2RayX/ConfigWindowController.m

+8-6
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,13 @@ - (void)askInputWithPrompt: (NSString*)prompt handler:(void (^ __nullable)(NSStr
284284
alternateButton:@"Cancel"
285285
otherButton:nil
286286
informativeTextWithFormat:@""];
287-
NSTextField *input = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 400, 24)];
288-
[alert setAccessoryView:input];
287+
NSTextField *inputField = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 400, 24)];
288+
inputField.usesSingleLineMode = true;
289+
inputField.lineBreakMode = NSLineBreakByTruncatingHead;
290+
[alert setAccessoryView:inputField];
289291
[alert beginSheetModalForWindow:self.window completionHandler:^(NSModalResponse returnCode) {
290292
if (returnCode == NSModalResponseOK) {
291-
handler([input stringValue]);
293+
handler([inputField stringValue]);
292294
}
293295
}];
294296
}
@@ -302,7 +304,7 @@ - (void)showAlert:(NSString*)text {
302304
}
303305

304306
- (IBAction)importFromStandardLink:(id)sender {
305-
[self askInputWithPrompt:@"Please input the server info with standard and official format" handler:^(NSString *inputStr) {
307+
[self askInputWithPrompt:@"Support standard ss:// link. Use \"Import from other miscellaneous links...\" to import other links(may cause failure)." handler:^(NSString *inputStr) {
306308
if (inputStr.length) {
307309
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
308310
NSMutableDictionary* ssOutbound = [ConfigImporter ssOutboundFromSSLink:inputStr];
@@ -321,7 +323,7 @@ - (void)presentImportResultOfVmessCount:(NSInteger)vmessCount otherCount:(NSInte
321323
dispatch_async(dispatch_get_main_queue(), ^{
322324
[self->_profileTable reloadData];
323325
self.popover = [[NSPopover alloc] init];
324-
self.importMessageField.stringValue = [NSString stringWithFormat:@"imported %lu vmess and %lu other protocol outbounds, %lu routing sets.", vmessCount, otherCount, ruleSetCount];
326+
self.importMessageField.stringValue = [NSString stringWithFormat:@"Imported %lu vmess and %lu other protocol outbounds, %lu routing rule sets.", vmessCount, otherCount, ruleSetCount];
325327
self.popover.contentViewController = [[NSViewController alloc] init];
326328
self.popover.contentViewController.view = self.importResultView;
327329
self.popover.behavior = NSPopoverBehaviorTransient;
@@ -331,7 +333,7 @@ - (void)presentImportResultOfVmessCount:(NSInteger)vmessCount otherCount:(NSInte
331333
}
332334

333335
- (IBAction)importFromMiscLinks:(id)sender {
334-
[self askInputWithPrompt:@"Please input the link" handler:^(NSString *inputStr) {
336+
[self askInputWithPrompt:@"V2RayX will try importing vmess:// and http(s):// links from v2rayN ." handler:^(NSString *inputStr) {
335337
if ([inputStr length] != 0) {
336338
ServerProfile* p = [ConfigImporter importFromVmessOfV2RayN:inputStr];
337339
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{

0 commit comments

Comments
 (0)