if a file is 100% complete, assume can download is no

This commit is contained in:
Mitchell Livingston 2007-07-15 04:06:04 +00:00
parent 1c7c8072b4
commit b77b25bc02
2 changed files with 8 additions and 2 deletions

View File

@ -162,6 +162,7 @@
- (BOOL) isPaused; - (BOOL) isPaused;
- (BOOL) isChecking; - (BOOL) isChecking;
- (BOOL) allDownloaded; - (BOOL) allDownloaded;
- (BOOL) isComplete;
- (BOOL) isError; - (BOOL) isError;
- (NSString *) errorMessage; - (NSString *) errorMessage;

View File

@ -320,7 +320,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
[progressString appendFormat: NSLocalizedString(@"%@ of %@ (%.2f%%)", "Torrent -> progress string"), [progressString appendFormat: NSLocalizedString(@"%@ of %@ (%.2f%%)", "Torrent -> progress string"),
[NSString stringForFileSize: [self downloadedValid]], [NSString stringForFileSize: [self downloadedValid]],
[NSString stringForFileSize: [self size]], 100.0 * [self progress]]; [NSString stringForFileSize: [self size]], 100.0 * [self progress]];
else if ([self progress] < 1.0) else if (![self isComplete])
[progressString appendFormat: NSLocalizedString(@"%@ of %@ (%.2f%%), uploaded %@ (Ratio: %@)", [progressString appendFormat: NSLocalizedString(@"%@ of %@ (%.2f%%), uploaded %@ (Ratio: %@)",
"Torrent -> progress string"), "Torrent -> progress string"),
[NSString stringForFileSize: [self downloadedValid]], [NSString stringForFileSize: [self size]], [NSString stringForFileSize: [self downloadedValid]], [NSString stringForFileSize: [self size]],
@ -1081,6 +1081,11 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
return fStat->cpStatus != TR_CP_INCOMPLETE; return fStat->cpStatus != TR_CP_INCOMPLETE;
} }
- (BOOL) isComplete
{
return fStat->cpStatus == TR_CP_COMPLETE;
}
- (BOOL) isError - (BOOL) isError
{ {
return fStat->error != 0; return fStat->error != 0;
@ -1300,7 +1305,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
- (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet - (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet
{ {
if ([self fileCount] <= 1) if ([self fileCount] <= 1 || [self isComplete])
return NO; return NO;
int index; int index;