change around the gui code for the Network prefs a bit
This commit is contained in:
parent
4e00714e62
commit
e19ba5199b
|
@ -54,7 +54,7 @@
|
|||
IBOutlet NSImageView * fNatStatusImage, * fPortStatusImage;
|
||||
IBOutlet NSProgressIndicator * fPortStatusProgress;
|
||||
NSTimer * fNatStatusTimer;
|
||||
int fNatStatus;
|
||||
int fPublicPort, fNatStatus;
|
||||
}
|
||||
|
||||
- (id) initWithWindowNibName: (NSString *) name handle: (tr_handle_t *) handle;
|
||||
|
|
|
@ -236,32 +236,33 @@
|
|||
|
||||
- (void) setPort: (id) sender
|
||||
{
|
||||
int port = [sender intValue];
|
||||
if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", port]])
|
||||
fPublicPort = [sender intValue];
|
||||
if (![[sender stringValue] isEqualToString: [NSString stringWithFormat: @"%d", fPublicPort]])
|
||||
{
|
||||
NSBeep();
|
||||
[sender setIntValue: [fDefaults integerForKey: @"BindPort"]];
|
||||
return;
|
||||
}
|
||||
|
||||
[fDefaults setInteger: port forKey: @"BindPort"];
|
||||
[fDefaults setInteger: fPublicPort forKey: @"BindPort"];
|
||||
|
||||
tr_setBindPort(fHandle, [fDefaults integerForKey: @"BindPort"]);
|
||||
tr_setBindPort(fHandle, fPublicPort);
|
||||
[self updateNatStatus];
|
||||
[self updatePortStatus];
|
||||
}
|
||||
|
||||
- (void) updatePortStatus
|
||||
{
|
||||
PortChecker * portChecker = [[PortChecker alloc] initWithDelegate: self];
|
||||
|
||||
[fPortStatusField setStringValue: [NSLocalizedString(@"Checking port status",
|
||||
"Preferences -> Network -> port status") stringByAppendingEllipsis]];
|
||||
[fPortStatusImage setImage: nil];
|
||||
[fPortStatusProgress startAnimation: self];
|
||||
|
||||
tr_handle_status_t * stat = tr_handleStatus(fHandle);
|
||||
[portChecker probePort: stat->publicPort];
|
||||
fPublicPort = stat->publicPort;
|
||||
|
||||
PortChecker * portChecker = [[PortChecker alloc] initWithDelegate: self];
|
||||
[portChecker probePort: fPublicPort];
|
||||
}
|
||||
|
||||
- (void) portCheckerDidFinishProbing: (PortChecker *) portChecker
|
||||
|
@ -299,8 +300,8 @@
|
|||
- (void) updateNatStatus
|
||||
{
|
||||
tr_handle_status_t * stat = tr_handleStatus(fHandle);
|
||||
if (fNatStatus == stat->natTraversalStatus)
|
||||
return;
|
||||
if (fNatStatus != stat->natTraversalStatus)
|
||||
{
|
||||
fNatStatus = stat->natTraversalStatus;
|
||||
|
||||
if (fNatStatus == TR_NAT_TRAVERSAL_MAPPED)
|
||||
|
@ -323,6 +324,12 @@
|
|||
|
||||
[self updatePortStatus];
|
||||
}
|
||||
else if (fPublicPort != stat->publicPort)
|
||||
{
|
||||
[self updatePortStatus];
|
||||
}
|
||||
else;
|
||||
}
|
||||
|
||||
- (void) applySpeedSettings: (id) sender
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue