simplify the code to check if an eta string should be displayed

This commit is contained in:
Mitchell Livingston 2010-08-14 17:51:04 +00:00
parent 39b92cc682
commit 117e78dce4
1 changed files with 4 additions and 5 deletions

View File

@ -1812,11 +1812,11 @@ int trashDataFile(const char * filename)
return YES;
else if ([self isSeeding])
{
if (tr_torrentGetSeedRatio(fHandle, NULL))
if (fStat->eta != TR_ETA_NOT_AVAIL && fStat->eta != TR_ETA_UNKNOWN)
return YES;
if (tr_torrentGetSeedIdle(fHandle, NULL))
return (fStat->etaIdle != TR_ETA_NOT_AVAIL && fStat->etaIdle != TR_ETA_UNKNOWN) && fStat->etaIdle < ETA_IDLE_DISPLAY_SEC;
if (fStat->etaIdle != TR_ETA_NOT_AVAIL && fStat->etaIdle < ETA_IDLE_DISPLAY_SEC)
return YES;
}
return NO;
@ -1825,8 +1825,7 @@ int trashDataFile(const char * filename)
- (NSString *) etaString
{
const BOOL etaReg = fStat->eta != TR_ETA_NOT_AVAIL && fStat->eta != TR_ETA_UNKNOWN;
const BOOL etaIdleSeed = fStat->etaIdle != TR_ETA_NOT_AVAIL && fStat->etaIdle != TR_ETA_UNKNOWN
&& fStat->etaIdle < ETA_IDLE_DISPLAY_SEC;
const BOOL etaIdleSeed = fStat->etaIdle != TR_ETA_NOT_AVAIL && fStat->etaIdle < ETA_IDLE_DISPLAY_SEC;
NSInteger eta;
if (etaReg && etaIdleSeed)