the new way of determining the unwanted width of the progress bar wasn't cutting it, so use the old way

This commit is contained in:
Mitchell Livingston 2009-11-07 02:22:57 +00:00
parent cd6ff1211f
commit 2f94ecf170
4 changed files with 14 additions and 11 deletions

View File

@ -144,6 +144,7 @@
- (CGFloat) progress;
- (CGFloat) progressDone;
- (CGFloat) progressLeft;
- (CGFloat) checkingProgress;
- (NSInteger) eta;

View File

@ -616,12 +616,10 @@ int trashDataFile(const char * filename)
tr_tracker_info * trackerStructs = tr_new(tr_tracker_info, oldTrackerCount-1);
NSInteger newCount = 0;
for (NSInteger oldIndex = 0; oldIndex < oldTrackerCount; ++newCount, ++oldIndex)
for (NSInteger oldIndex = 0; oldIndex < oldTrackerCount; ++oldIndex)
{
if (![trackers member: [NSString stringWithUTF8String: fInfo->trackers[oldIndex].announce]])
trackerStructs[newCount] = fInfo->trackers[oldIndex];
else
--newCount;
trackerStructs[newCount++] = fInfo->trackers[oldIndex];
}
const tr_announce_list_err result = tr_torrentSetAnnounceList(fHandle, trackerStructs, newCount);
@ -730,6 +728,11 @@ int trashDataFile(const char * filename)
return fStat->percentDone;
}
- (CGFloat) progressLeft
{
return (CGFloat)[self sizeLeft] / [self size];
}
- (CGFloat) checkingProgress
{
return fStat->recheckProgress;
@ -1038,8 +1041,8 @@ int trashDataFile(const char * filename)
break;
case TR_STATUS_CHECK:
string = [NSString localizedStringWithFormat: NSLocalizedString(@"Checking existing data (%.2f%%)",
"Torrent -> status string"), 100.0 * [self checkingProgress]];
string = [NSString localizedStringWithFormat: @"%@ (%.2f%%)",
NSLocalizedString(@"Checking existing data", "Torrent -> status string"), 100.0 * [self checkingProgress]];
break;
case TR_STATUS_DOWNLOAD:
@ -1073,8 +1076,8 @@ int trashDataFile(const char * filename)
return NSLocalizedString(@"Paused", "Torrent -> status string");
case TR_STATUS_CHECK:
return [NSString localizedStringWithFormat: NSLocalizedString(@"Checking existing data (%.2f%%)",
"Torrent -> status string"), 100.0 * [self checkingProgress]];
return [NSString localizedStringWithFormat: @"%@ (%.2f%%)",
NSLocalizedString(@"Checking existing data", "Torrent -> status string"), 100.0 * [self checkingProgress]];
case TR_STATUS_CHECK_WAIT:
return [NSLocalizedString(@"Waiting to check existing data", "Torrent -> status string") stringByAppendingEllipsis];

View File

@ -633,8 +633,7 @@
{
if (![torrent allDownloaded])
{
//the ratio of total progress to total width equals ratio of progress of amount wanted to wanted width
const CGFloat widthRemaining = floorf(NSWidth(barRect) * (1.0 - [torrent progressDone]) / [torrent progress]);
const CGFloat widthRemaining = floorf(NSWidth(barRect) * [torrent progressLeft]);
NSRect wantedRect;
NSDivideRect(missingRect, &wantedRect, &missingRect, widthRemaining, NSMinXEdge);

View File

@ -567,7 +567,7 @@
//place menu below button
NSRect rect = [fTorrentCell iconRectForBounds: [self rectOfRow: row]];
NSPoint location = rect.origin;
location.y += rect.size.height + 5.0f;
location.y += rect.size.height + 5.0;
if ([NSApp isOnSnowLeopardOrBetter])
{