Changeset 4073


Ignore:
Timestamp:
Dec 5, 2007, 6:44:11 PM (14 years ago)
Author:
livings124
Message:

clean up more of the dock badging code

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/BadgeView.h

    r4072 r4073  
    3333   
    3434    BOOL fQuitting;
    35     NSProgressIndicator * fQuitIndicator;
    3635}
    3736
  • trunk/macosx/BadgeView.m

    r4072 r4073  
    6464    if (fQuitting)
    6565    {
     66        [self badge: [NSImage imageNamed: @"UploadBadge"] string: @"Quitting" atHeight: 0.0];
    6667        return;
    6768    }
     
    7778        tr_torrentRates(fLib, &downloadRate, &uploadRate);
    7879       
     80        BOOL upload;
     81        if ((upload = checkUpload && uploadRate >= 0.1))
     82            [self badge: [NSImage imageNamed: @"UploadBadge"] string: [NSString stringForSpeedAbbrev: uploadRate] atHeight: 0.0];
    7983        if (checkDownload && downloadRate >= 0.1)
    80             downloadRateString = [NSString stringForSpeedAbbrev: downloadRate];
    81         if (checkUpload && uploadRate >= 0.1)
    82             uploadRateString = [NSString stringForSpeedAbbrev: uploadRate];
    83        
    84         if (uploadRateString || downloadRateString)
    8584        {
    86            if (uploadRateString)
    87                 [self badge: [NSImage imageNamed: @"UploadBadge"] string: uploadRateString atHeight: 0.0];
    88            
    89             if (downloadRateString)
    90             {
    91                 //download rate above upload rate
    92                 float bottom = uploadRateString ? [[NSImage imageNamed: @"UploadBadge"] size].height + BETWEEN_PADDING : 0.0;
    93                 [self badge: [NSImage imageNamed: @"DownloadBadge"] string: downloadRateString atHeight: bottom];
    94             }
     85            //download rate above upload rate
     86            float bottom = upload ? [[NSImage imageNamed: @"UploadBadge"] size].height + BETWEEN_PADDING : 0.0;
     87            [self badge: [NSImage imageNamed: @"DownloadBadge"] string: [NSString stringForSpeedAbbrev: downloadRate] atHeight: bottom];
    9588        }
    9689    }
Note: See TracChangeset for help on using the changeset viewer.