]> granicus.if.org Git - transmission/commitdiff
experiment in improving calculation of the availability bar
authorMitchell Livingston <livings124@transmissionbt.com>
Wed, 16 Apr 2008 12:32:07 +0000 (12:32 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Wed, 16 Apr 2008 12:32:07 +0000 (12:32 +0000)
macosx/PrefsController.m
macosx/Torrent.m
macosx/TorrentCell.m

index cb1ddcb99ab1b38acd9343203d8a607b0e8656f3..c1b32915490b69e914a0bc2acfe4466307f6999b 100644 (file)
             }
     }
     
-    //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];
 }
 
index 920bc76f419b5f0d2c164e223a65304cafbbca3c..423b4bb9c1740094400434761c2aaebb0797bad7 100644 (file)
@@ -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
index c80358cee6b6935ef274e4d97d8a7358ed7571d6..53bb592899b3ab9391f804296cd49eefe739aab2 100644 (file)
             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;