on second thought, the other UI's might want this value sooner or later, and it's cheaper to calculate it in the stat function
This commit is contained in:
parent
a5e0b6e5b2
commit
130c9af1d1
|
@ -1023,6 +1023,13 @@ tr_torrentStat( tr_torrent * tor )
|
|||
s->eta = TR_ETA_NOT_AVAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
if( !checkSeedRatio || s->ratio >= seedRatio || s->ratio == TR_RATIO_INF )
|
||||
s->percentRatio = 1.0;
|
||||
else if( s->ratio == TR_RATIO_NA )
|
||||
s->percentRatio = 0.0;
|
||||
else
|
||||
s->percentRatio = s->ratio / seedRatio;
|
||||
|
||||
tr_torrentUnlock( tor );
|
||||
|
||||
|
|
|
@ -1628,6 +1628,11 @@ typedef struct tr_stat
|
|||
@see tr_stat.leftUntilDone */
|
||||
float percentDone;
|
||||
|
||||
/** The percentage of the actual ratio to the seed ratio. This will be
|
||||
equal to 1 if the ratio is reached or the torrent is set to seed forever.
|
||||
Range is [0..1] */
|
||||
float percentRatio;
|
||||
|
||||
/** Speed all data being sent for this torrent. (KiB/s)
|
||||
This includes piece data, protocol messages, and TCP overhead */
|
||||
double rawUploadSpeed;
|
||||
|
|
|
@ -343,13 +343,7 @@ int trashDataFile(const char * filename)
|
|||
|
||||
- (CGFloat) progressStopRatio
|
||||
{
|
||||
double seedRatio;
|
||||
if (!tr_torrentGetSeedRatio(fHandle, seedRatio) || [self ratio] >= seedRatio || [self ratio] == TR_RATIO_INF)
|
||||
return 1.0;
|
||||
else if ([self ratio] == TR_RATIO_NA)
|
||||
return 0.0;
|
||||
else
|
||||
return [self ratio] / seedRatio;
|
||||
return fStat->percentRatio;
|
||||
}
|
||||
|
||||
- (BOOL) usesSpeedLimit: (BOOL) upload
|
||||
|
|
Loading…
Reference in New Issue