From b77b25bc026abf86f2eb69a25b47ab93d1597cd4 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sun, 15 Jul 2007 04:06:04 +0000 Subject: [PATCH] if a file is 100% complete, assume can download is no --- macosx/Torrent.h | 1 + macosx/Torrent.m | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/macosx/Torrent.h b/macosx/Torrent.h index 2aa5114e5..3acb63fa4 100644 --- a/macosx/Torrent.h +++ b/macosx/Torrent.h @@ -162,6 +162,7 @@ - (BOOL) isPaused; - (BOOL) isChecking; - (BOOL) allDownloaded; +- (BOOL) isComplete; - (BOOL) isError; - (NSString *) errorMessage; diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 6852cc87e..b1591c4b1 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -320,7 +320,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 [progressString appendFormat: NSLocalizedString(@"%@ of %@ (%.2f%%)", "Torrent -> progress string"), [NSString stringForFileSize: [self downloadedValid]], [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: %@)", "Torrent -> progress string"), [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; } +- (BOOL) isComplete +{ + return fStat->cpStatus == TR_CP_COMPLETE; +} + - (BOOL) isError { return fStat->error != 0; @@ -1300,7 +1305,7 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80 - (BOOL) canChangeDownloadCheckForFiles: (NSIndexSet *) indexSet { - if ([self fileCount] <= 1) + if ([self fileCount] <= 1 || [self isComplete]) return NO; int index;