]> granicus.if.org Git - transmission/commitdiff
the red unavailable bar wasn't showing if none of the desired data was available
authorMitchell Livingston <livings124@transmissionbt.com>
Sat, 7 Nov 2009 04:08:42 +0000 (04:08 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Sat, 7 Nov 2009 04:08:42 +0000 (04:08 +0000)
macosx/TorrentCell.m

index 9819b89816d3642cb8eb440e44c47c82f427fdef..7d8f515424c78bf32599aa26ed6af09d90b25b1c 100644 (file)
         }
     }
     
-    if (!NSIsEmptyRect(missingRect))
+    if (![torrent allDownloaded])
     {
-        if (![torrent allDownloaded])
+        const CGFloat widthRemaining = floorf(NSWidth(barRect) * [torrent progressLeft]);
+        
+        NSRect wantedRect;
+        NSDivideRect(missingRect, &wantedRect, &missingRect, widthRemaining, NSMinXEdge);
+        
+        //not-available section
+        if ([torrent isActive] && ![torrent isChecking] && [fDefaults boolForKey: @"DisplayProgressBarAvailable"]
+            && [torrent availableDesired] < 1.0)
         {
-            const CGFloat widthRemaining = floorf(NSWidth(barRect) * [torrent progressLeft]);
-            
-            NSRect wantedRect;
-            NSDivideRect(missingRect, &wantedRect, &missingRect, widthRemaining, NSMinXEdge);
+            NSRect unavailableRect;
+            NSDivideRect(wantedRect, &wantedRect, &unavailableRect, floorf(NSWidth(wantedRect) * [torrent availableDesired]),
+                        NSMinXEdge);
             
-            //not-available section
-            if ([torrent isActive] && ![torrent isChecking] && [fDefaults boolForKey: @"DisplayProgressBarAvailable"]
-                && [torrent availableDesired] > 0.0)
-            {
-                NSRect unavailableRect;
-                NSDivideRect(wantedRect, &wantedRect, &unavailableRect, floorf([torrent availableDesired] * NSWidth(wantedRect)),
-                            NSMinXEdge);
-                
-                [[ProgressGradients progressRedGradient] drawInRect: unavailableRect angle: 90];
-            }
-            
-            //remaining section
-            [[ProgressGradients progressWhiteGradient] drawInRect: wantedRect angle: 90];
+            [[ProgressGradients progressRedGradient] drawInRect: unavailableRect angle: 90];
         }
         
-        //unwanted section
-        [[ProgressGradients progressLightGrayGradient] drawInRect: missingRect angle: 90];
+        //remaining section
+        [[ProgressGradients progressWhiteGradient] drawInRect: wantedRect angle: 90];
     }
+    
+    //unwanted section
+    if (!NSIsEmptyRect(missingRect))
+        [[ProgressGradients progressLightGrayGradient] drawInRect: missingRect angle: 90];
 }
 
 - (void) drawPiecesBar: (NSRect) barRect