mirror of
https://github.com/transmission/transmission
synced 2025-03-09 21:54:09 +00:00
change slightly which values are sent for display in the inspector (i.e. don't send values that won't be displayed), in peer table's tooltip show N/A instead of 0 for port when not available, and don't show progress for non-connected peers
This commit is contained in:
parent
91e4607c64
commit
2f82b2f4fa
2 changed files with 39 additions and 25 deletions
|
@ -682,12 +682,12 @@
|
||||||
else if ([ident isEqualToString: @"Client"])
|
else if ([ident isEqualToString: @"Client"])
|
||||||
return [peer objectForKey: @"Client"];
|
return [peer objectForKey: @"Client"];
|
||||||
else if ([ident isEqualToString: @"Progress"])
|
else if ([ident isEqualToString: @"Progress"])
|
||||||
return [peer objectForKey: @"Progress"];
|
return [[peer objectForKey: @"Connected"] boolValue] ? [peer objectForKey: @"Progress"] : 0;
|
||||||
else if ([ident isEqualToString: @"UL To"])
|
else if ([ident isEqualToString: @"UL To"])
|
||||||
return [[peer objectForKey: @"UL To"] boolValue]
|
return [[peer objectForKey: @"Connected"] boolValue] && [[peer objectForKey: @"UL To"] boolValue]
|
||||||
? [NSString stringForSpeedAbbrev: [[peer objectForKey: @"UL To Rate"] floatValue]] : @"";
|
? [NSString stringForSpeedAbbrev: [[peer objectForKey: @"UL To Rate"] floatValue]] : @"";
|
||||||
else if ([ident isEqualToString: @"DL From"])
|
else if ([ident isEqualToString: @"DL From"])
|
||||||
return [[peer objectForKey: @"DL From"] boolValue]
|
return [[peer objectForKey: @"Connected"] boolValue] && [[peer objectForKey: @"DL From"] boolValue]
|
||||||
? [NSString stringForSpeedAbbrev: [[peer objectForKey: @"DL From Rate"] floatValue]] : @"";
|
? [NSString stringForSpeedAbbrev: [[peer objectForKey: @"DL From Rate"] floatValue]] : @"";
|
||||||
else
|
else
|
||||||
return [peer objectForKey: @"IP"];
|
return [peer objectForKey: @"IP"];
|
||||||
|
@ -719,24 +719,33 @@
|
||||||
{
|
{
|
||||||
if (tableView == fPeerTable)
|
if (tableView == fPeerTable)
|
||||||
{
|
{
|
||||||
NSDictionary * peerDic = [fPeers objectAtIndex: row];
|
NSDictionary * peer = [fPeers objectAtIndex: row];
|
||||||
|
|
||||||
NSString * fromString;
|
NSMutableArray * components = [NSMutableArray arrayWithCapacity: 3];
|
||||||
int from = [[peerDic objectForKey: @"From"] intValue];
|
|
||||||
if (from == TR_PEER_FROM_INCOMING)
|
if ([[peer objectForKey: @"Connected"] boolValue])
|
||||||
fromString = NSLocalizedString(@"incoming connection", "Inspector -> Peers tab -> table row tooltip");
|
[components addObject: [NSString stringWithFormat:
|
||||||
else if (from == TR_PEER_FROM_CACHE)
|
NSLocalizedString(@"Progress: %.1f%%", "Inspector -> Peers tab -> table row tooltip"),
|
||||||
fromString = NSLocalizedString(@"cache", "Inspector -> Peers tab -> table row tooltip");
|
[[peer objectForKey: @"Progress"] floatValue] * 100.0]];
|
||||||
else if (from == TR_PEER_FROM_PEX)
|
|
||||||
fromString = NSLocalizedString(@"peer exchange", "Inspector -> Peers tab -> table row tooltip");
|
int port;
|
||||||
|
if ((port = [[peer objectForKey: @"Port"] intValue]) > 0)
|
||||||
|
[components addObject: [NSString stringWithFormat:
|
||||||
|
NSLocalizedString(@"Port: %d", "Inspector -> Peers tab -> table row tooltip"), port]];
|
||||||
else
|
else
|
||||||
fromString = NSLocalizedString(@"tracker", "Inspector -> Peers tab -> table row tooltip");
|
[components addObject: NSLocalizedString(@"Port: N/A", "Inspector -> Peers tab -> table row tooltip")];
|
||||||
|
|
||||||
return [NSString stringWithFormat: NSLocalizedString(@"Progress: %.1f%%"
|
int from = [[peer objectForKey: @"From"] intValue];
|
||||||
"\nPort: %@"
|
if (from == TR_PEER_FROM_INCOMING)
|
||||||
"\nFrom: %@", "Inspector -> Peers tab -> table row tooltip"),
|
[components addObject: NSLocalizedString(@"From: incoming connection", "Inspector -> Peers tab -> table row tooltip")];
|
||||||
[[peerDic objectForKey: @"Progress"] floatValue] * 100.0,
|
else if (from == TR_PEER_FROM_CACHE)
|
||||||
[peerDic objectForKey: @"Port"], fromString];
|
[components addObject: NSLocalizedString(@"From: cache", "Inspector -> Peers tab -> table row tooltip")];
|
||||||
|
else if (from == TR_PEER_FROM_PEX)
|
||||||
|
[components addObject: NSLocalizedString(@"From: peer exchange", "Inspector -> Peers tab -> table row tooltip")];
|
||||||
|
else
|
||||||
|
[components addObject: NSLocalizedString(@"From: tracker", "Inspector -> Peers tab -> table row tooltip")];
|
||||||
|
|
||||||
|
return [components componentsJoinedByString: @"\n"];
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
|
@ -996,15 +996,20 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
||||||
[NSNumber numberWithInt: peer->from], @"From",
|
[NSNumber numberWithInt: peer->from], @"From",
|
||||||
[NSString stringWithCString: (char *) peer->addr encoding: NSUTF8StringEncoding], @"IP",
|
[NSString stringWithCString: (char *) peer->addr encoding: NSUTF8StringEncoding], @"IP",
|
||||||
[NSString stringWithCString: (char *) peer->client encoding: NSUTF8StringEncoding], @"Client",
|
[NSString stringWithCString: (char *) peer->client encoding: NSUTF8StringEncoding], @"Client",
|
||||||
[NSNumber numberWithFloat: peer->progress], @"Progress",
|
|
||||||
[NSNumber numberWithBool: peer->isDownloading], @"UL To",
|
|
||||||
[NSNumber numberWithBool: peer->isUploading], @"DL From",
|
|
||||||
[NSNumber numberWithInt: peer->port], @"Port", nil];
|
[NSNumber numberWithInt: peer->port], @"Port", nil];
|
||||||
|
|
||||||
if (peer->isDownloading)
|
if (peer->isConnected)
|
||||||
[dic setObject: [NSNumber numberWithFloat: peer->uploadToRate] forKey: @"UL To Rate"];
|
{
|
||||||
if (peer->isUploading)
|
[dic setObject: [NSNumber numberWithFloat: peer->progress] forKey: @"Progress"];
|
||||||
[dic setObject: [NSNumber numberWithFloat: peer->downloadFromRate] forKey: @"DL From Rate"];
|
|
||||||
|
[dic setObject: [NSNumber numberWithBool: peer->isDownloading] forKey: @"UL To"];
|
||||||
|
if (peer->isDownloading)
|
||||||
|
[dic setObject: [NSNumber numberWithFloat: peer->uploadToRate] forKey: @"UL To Rate"];
|
||||||
|
|
||||||
|
[dic setObject: [NSNumber numberWithBool: peer->isUploading] forKey: @"DL From"];
|
||||||
|
if (peer->isUploading)
|
||||||
|
[dic setObject: [NSNumber numberWithFloat: peer->downloadFromRate] forKey: @"DL From Rate"];
|
||||||
|
}
|
||||||
|
|
||||||
[peerDics addObject: dic];
|
[peerDics addObject: dic];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue