Ignore:
Timestamp:
Nov 7, 2009, 4:08:42 AM (13 years ago)
Author:
livings124
Message:

the red unavailable bar wasn't showing if none of the desired data was available

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/TorrentCell.m

    r9487 r9488  
    630630    }
    631631   
     632    if (![torrent allDownloaded])
     633    {
     634        const CGFloat widthRemaining = floorf(NSWidth(barRect) * [torrent progressLeft]);
     635       
     636        NSRect wantedRect;
     637        NSDivideRect(missingRect, &wantedRect, &missingRect, widthRemaining, NSMinXEdge);
     638       
     639        //not-available section
     640        if ([torrent isActive] && ![torrent isChecking] && [fDefaults boolForKey: @"DisplayProgressBarAvailable"]
     641            && [torrent availableDesired] < 1.0)
     642        {
     643            NSRect unavailableRect;
     644            NSDivideRect(wantedRect, &wantedRect, &unavailableRect, floorf(NSWidth(wantedRect) * [torrent availableDesired]),
     645                        NSMinXEdge);
     646           
     647            [[ProgressGradients progressRedGradient] drawInRect: unavailableRect angle: 90];
     648        }
     649       
     650        //remaining section
     651        [[ProgressGradients progressWhiteGradient] drawInRect: wantedRect angle: 90];
     652    }
     653   
     654    //unwanted section
    632655    if (!NSIsEmptyRect(missingRect))
    633     {
    634         if (![torrent allDownloaded])
    635         {
    636             const CGFloat widthRemaining = floorf(NSWidth(barRect) * [torrent progressLeft]);
    637            
    638             NSRect wantedRect;
    639             NSDivideRect(missingRect, &wantedRect, &missingRect, widthRemaining, NSMinXEdge);
    640            
    641             //not-available section
    642             if ([torrent isActive] && ![torrent isChecking] && [fDefaults boolForKey: @"DisplayProgressBarAvailable"]
    643                 && [torrent availableDesired] > 0.0)
    644             {
    645                 NSRect unavailableRect;
    646                 NSDivideRect(wantedRect, &wantedRect, &unavailableRect, floorf([torrent availableDesired] * NSWidth(wantedRect)),
    647                             NSMinXEdge);
    648                
    649                 [[ProgressGradients progressRedGradient] drawInRect: unavailableRect angle: 90];
    650             }
    651            
    652             //remaining section
    653             [[ProgressGradients progressWhiteGradient] drawInRect: wantedRect angle: 90];
    654         }
    655        
    656         //unwanted section
    657656        [[ProgressGradients progressLightGrayGradient] drawInRect: missingRect angle: 90];
    658     }
    659657}
    660658
Note: See TracChangeset for help on using the changeset viewer.