experiment in improving calculation of the availability bar

This commit is contained in:
Mitchell Livingston 2008-04-16 12:32:07 +00:00
parent a818d74f35
commit 5acb4297ae
3 changed files with 5 additions and 6 deletions

View File

@ -666,8 +666,8 @@
}
}
//for network view make sure progress indicator hides itself
if (view == fNetworkView && [fPortStatusImage image])
//for network view make sure progress indicator hides itself (get around a Tiger bug)
if (![NSApp isOnLeopardOrBetter] && view == fNetworkView && [fPortStatusImage image])
[fPortStatusProgress setDisplayedWhenStopped: NO];
}

View File

@ -874,7 +874,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
- (int) etaRatio
{
if (![self isSeeding])
return -1;
return TR_ETA_UNKNOWN;
float uploadRate = [self uploadRate];
if (uploadRate < 0.1)
@ -887,10 +887,9 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
return (float)MAX([self downloadedTotal], [self haveTotal]) * (stopRatio - ratio) / uploadRate / 1024.0;
}
#warning when stats change, elliminate the use of size and make use of just the 2 fields
- (float) notAvailableDesired
{
return (float)(fStat->leftUntilDone - fStat->desiredAvailable) / [self size];
return 1.0 - (float)fStat->desiredAvailable / [self sizeLeft];
}
- (BOOL) isActive

View File

@ -677,7 +677,7 @@
if ([torrent isActive] && ![torrent allDownloaded] && ![torrent isChecking]
&& [fDefaults boolForKey: @"DisplayProgressBarAvailable"])
{
int notAvailableWidth = MIN(ceil(barRect.size.width * [torrent notAvailableDesired]), rightWidth);
int notAvailableWidth = ceil(rightWidth * [torrent notAvailableDesired]);
if (notAvailableWidth > 0)
{
rightWidth -= notAvailableWidth;