small efficiency change for file inspector stats

This commit is contained in:
Mitchell Livingston 2009-11-07 04:48:02 +00:00
parent beaa865fb8
commit c824db3f85
1 changed files with 10 additions and 2 deletions

View File

@ -1229,6 +1229,9 @@ int trashDataFile(const char * filename)
if ([self isComplete]) if ([self isComplete])
return 1.0; return 1.0;
if ([self fileCount] == 1)
return [self progress];
if (!fFileStat) if (!fFileStat)
[self updateFileStat]; [self updateFileStat];
@ -1252,15 +1255,20 @@ int trashDataFile(const char * filename)
- (BOOL) canChangeDownloadCheckForFile: (NSInteger) index - (BOOL) canChangeDownloadCheckForFile: (NSInteger) index
{ {
NSAssert2(index < [self fileCount], @"Index %d is greater than file count %d", index, [self fileCount]);
if ([self fileCount] == 1 || [self isComplete])
return NO;
if (!fFileStat) if (!fFileStat)
[self updateFileStat]; [self updateFileStat];
return [self fileCount] > 1 && fFileStat[index].progress < 1.0; return fFileStat[index].progress < 1.0;
} }
- (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet - (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet
{ {
if ([self fileCount] <= 1 || [self isComplete]) if ([self fileCount] == 1 || [self isComplete])
return NO; return NO;
if (!fFileStat) if (!fFileStat)