From 5acb4297ae08b891c795b24f8a2a9ee91e5479bb Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Wed, 16 Apr 2008 12:32:07 +0000 Subject: [PATCH] experiment in improving calculation of the availability bar --- macosx/PrefsController.m | 4 ++-- macosx/Torrent.m | 5 ++--- macosx/TorrentCell.m | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/macosx/PrefsController.m b/macosx/PrefsController.m index cb1ddcb99..c1b329154 100644 --- a/macosx/PrefsController.m +++ b/macosx/PrefsController.m @@ -666,8 +666,8 @@ } } - //for network view make sure progress indicator hides itself - if (view == fNetworkView && [fPortStatusImage image]) + //for network view make sure progress indicator hides itself (get around a Tiger bug) + if (![NSApp isOnLeopardOrBetter] && view == fNetworkView && [fPortStatusImage image]) [fPortStatusProgress setDisplayedWhenStopped: NO]; } diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 920bc76f4..423b4bb9c 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -874,7 +874,7 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void * - (int) etaRatio { if (![self isSeeding]) - return -1; + return TR_ETA_UNKNOWN; float uploadRate = [self uploadRate]; if (uploadRate < 0.1) @@ -887,10 +887,9 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void * return (float)MAX([self downloadedTotal], [self haveTotal]) * (stopRatio - ratio) / uploadRate / 1024.0; } -#warning when stats change, elliminate the use of size and make use of just the 2 fields - (float) notAvailableDesired { - return (float)(fStat->leftUntilDone - fStat->desiredAvailable) / [self size]; + return 1.0 - (float)fStat->desiredAvailable / [self sizeLeft]; } - (BOOL) isActive diff --git a/macosx/TorrentCell.m b/macosx/TorrentCell.m index c80358cee..53bb59289 100644 --- a/macosx/TorrentCell.m +++ b/macosx/TorrentCell.m @@ -677,7 +677,7 @@ if ([torrent isActive] && ![torrent allDownloaded] && ![torrent isChecking] && [fDefaults boolForKey: @"DisplayProgressBarAvailable"]) { - int notAvailableWidth = MIN(ceil(barRect.size.width * [torrent notAvailableDesired]), rightWidth); + int notAvailableWidth = ceil(rightWidth * [torrent notAvailableDesired]); if (notAvailableWidth > 0) { rightWidth -= notAvailableWidth; -- 2.40.0