combine some progress string code and release an attributes dictionary when it's not needed

This commit is contained in:
Mitchell Livingston 2007-09-28 13:42:28 +00:00
parent dc7a374fb3
commit 2ac0980ea5
2 changed files with 13 additions and 12 deletions

View File

@ -48,6 +48,13 @@
}
else
{
//attributes not needed anymore
if (fAttributes)
{
[fAttributes release];
fAttributes = nil;
}
[super drawWithFrame: cellFrame inView: controlView];
if ([self floatValue] >= 1.0)
{

View File

@ -954,6 +954,9 @@ static int static_lastid = 0;
else
string = [NSString stringWithFormat: NSLocalizedString(@"Downloading from %d of 1 peer",
"Torrent -> status string"), [self peersSendingToUs]];
string = [string stringByAppendingFormat: @" - DL: %@, UL: %@",
[NSString stringForSpeed: [self downloadRate]], [NSString stringForSpeed: [self uploadRate]]];
break;
case TR_STATUS_SEED:
@ -964,6 +967,9 @@ static int static_lastid = 0;
else
string = [NSString stringWithFormat: NSLocalizedString(@"Seeding to %d of 1 peer", "Torrent -> status string"),
[self peersGettingFromUs]];
string = [string stringByAppendingFormat: @" - UL: %@", [NSString stringForSpeed: [self uploadRate]]];
break;
case TR_STATUS_STOPPING:
@ -978,18 +984,6 @@ static int static_lastid = 0;
string = [NSLocalizedString(@"Stalled, ", "Torrent -> status string") stringByAppendingString: string];
}
if ([self isActive] && ![self isChecking])
{
NSString * stringToAppend;
if (![self allDownloaded])
stringToAppend = [NSString stringWithFormat: NSLocalizedString(@"DL: %@, ", "Torrent -> status string"),
[NSString stringForSpeed: [self downloadRate]]];
else
stringToAppend = @"";
string = [string stringByAppendingFormat: @" - %@UL: %@", stringToAppend, [NSString stringForSpeed: [self uploadRate]]];
}
return string;
}