efficiencies in processing peer info in inspector

This commit is contained in:
Mitchell Livingston 2007-05-09 03:49:27 +00:00
parent a4fe974a38
commit 93bb89e3d3
2 changed files with 12 additions and 8 deletions

View File

@ -682,13 +682,20 @@
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: @"Connected"] boolValue] ? [peer objectForKey: @"Progress"] : [NSNumber numberWithInt: 0]; {
NSNumber * progress;
return (progress = [peer objectForKey: @"Progress"]) ? progress : [NSNumber numberWithInt: 0];
}
else if ([ident isEqualToString: @"UL To"]) else if ([ident isEqualToString: @"UL To"])
return [[peer objectForKey: @"Connected"] boolValue] && [[peer objectForKey: @"UL To"] boolValue] {
? [NSString stringForSpeedAbbrev: [[peer objectForKey: @"UL To Rate"] floatValue]] : @""; NSNumber * rate;
return (rate = [peer objectForKey: @"UL To Rate"]) ? [NSString stringForSpeedAbbrev: [rate floatValue]] : @"";
}
else if ([ident isEqualToString: @"DL From"]) else if ([ident isEqualToString: @"DL From"])
return [[peer objectForKey: @"Connected"] boolValue] && [[peer objectForKey: @"DL From"] boolValue] {
? [NSString stringForSpeedAbbrev: [[peer objectForKey: @"DL From Rate"] floatValue]] : @""; NSNumber * rate;
return (rate = [peer objectForKey: @"DL From Rate"]) ? [NSString stringForSpeedAbbrev: [rate floatValue]] : @"";
}
else else
return [peer objectForKey: @"IP"]; return [peer objectForKey: @"IP"];
} }

View File

@ -1005,11 +1005,8 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
{ {
[dic setObject: [NSNumber numberWithFloat: peer->progress] forKey: @"Progress"]; [dic setObject: [NSNumber numberWithFloat: peer->progress] forKey: @"Progress"];
[dic setObject: [NSNumber numberWithBool: peer->isDownloading] forKey: @"UL To"];
if (peer->isDownloading) if (peer->isDownloading)
[dic setObject: [NSNumber numberWithFloat: peer->uploadToRate] forKey: @"UL To Rate"]; [dic setObject: [NSNumber numberWithFloat: peer->uploadToRate] forKey: @"UL To Rate"];
[dic setObject: [NSNumber numberWithBool: peer->isUploading] forKey: @"DL From"];
if (peer->isUploading) if (peer->isUploading)
[dic setObject: [NSNumber numberWithFloat: peer->downloadFromRate] forKey: @"DL From Rate"]; [dic setObject: [NSNumber numberWithFloat: peer->downloadFromRate] forKey: @"DL From Rate"];