Ignore:
Timestamp:
Nov 14, 2010, 6:33:57 PM (12 years ago)
Author:
livings124
Message:

use number formatters when displaying the number of transfers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r11403 r11416  
    17861786- (void) setBottomCountText: (BOOL) filtering
    17871787{
     1788    NSNumberFormatter * numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
     1789    [numberFormatter setNumberStyle: NSNumberFormatterDecimalStyle];
     1790    [numberFormatter setMaximumFractionDigits: 0];
     1791   
    17881792    NSString * totalTorrentsString;
    1789     NSInteger totalCount = [fTorrents count];
     1793    NSUInteger totalCount = [fTorrents count];
    17901794    if (totalCount != 1)
    1791         totalTorrentsString = [NSString stringWithFormat: NSLocalizedString(@"%d transfers", "Status bar transfer count"), totalCount];
     1795        totalTorrentsString = [NSString stringWithFormat: NSLocalizedString(@"%@ transfers", "Status bar transfer count"),
     1796                                [numberFormatter stringFromNumber: [NSNumber numberWithUnsignedInteger: totalCount]]];
    17921797    else
    17931798        totalTorrentsString = NSLocalizedString(@"1 transfer", "Status bar transfer count");
     
    17951800    if (filtering)
    17961801    {
    1797         NSInteger count = [fTableView numberOfRows]; //have to factor in collapsed rows
     1802        NSUInteger count = [fTableView numberOfRows]; //have to factor in collapsed rows
    17981803        if (count > 0 && ![[fDisplayedTorrents objectAtIndex: 0] isKindOfClass: [Torrent class]])
    17991804            count -= [fDisplayedTorrents count];
    18001805       
    1801         totalTorrentsString = [NSString stringWithFormat: NSLocalizedString(@"%d of %@", "Status bar transfer count"),
    1802                                 count, totalTorrentsString];
     1806        totalTorrentsString = [NSString stringWithFormat: NSLocalizedString(@"%@ of %@", "Status bar transfer count"),
     1807                                [numberFormatter stringFromNumber: [NSNumber numberWithUnsignedInteger: count]],
     1808                                totalTorrentsString];
    18031809    }
    18041810   
Note: See TracChangeset for help on using the changeset viewer.