1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-10 06:02:57 +00:00

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 //for network view make sure progress indicator hides itself (get around a Tiger bug)
if (view == fNetworkView && [fPortStatusImage image]) if (![NSApp isOnLeopardOrBetter] && view == fNetworkView && [fPortStatusImage image])
[fPortStatusProgress setDisplayedWhenStopped: NO]; [fPortStatusProgress setDisplayedWhenStopped: NO];
} }

View file

@ -874,7 +874,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
- (int) etaRatio - (int) etaRatio
{ {
if (![self isSeeding]) if (![self isSeeding])
return -1; return TR_ETA_UNKNOWN;
float uploadRate = [self uploadRate]; float uploadRate = [self uploadRate];
if (uploadRate < 0.1) 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; 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 - (float) notAvailableDesired
{ {
return (float)(fStat->leftUntilDone - fStat->desiredAvailable) / [self size]; return 1.0 - (float)fStat->desiredAvailable / [self sizeLeft];
} }
- (BOOL) isActive - (BOOL) isActive

View file

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