Changeset 11416


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

use number formatters when displaying the number of transfers

Location:
trunk/macosx
Files:
3 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   
  • trunk/macosx/FilterButton.m

    r9844 r11416  
    4242   
    4343    fCount = count;
     44   
     45    NSNumberFormatter * numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
     46    [numberFormatter setNumberStyle: NSNumberFormatterDecimalStyle];
     47    [numberFormatter setMaximumFractionDigits: 0];
     48   
    4449    [self setToolTip: fCount == 1 ? NSLocalizedString(@"1 transfer", "Filter Button -> tool tip")
    45         : [NSString stringWithFormat: NSLocalizedString(@"%d transfers", "Filter Bar Button -> tool tip"), fCount]];
     50        : [NSString stringWithFormat: NSLocalizedString(@"%@ transfers", "Filter Bar Button -> tool tip"),
     51            [numberFormatter stringFromNumber: [NSNumber numberWithUnsignedInteger: fCount]]]];
    4652}
    4753
  • trunk/macosx/PrefsController.m

    r11385 r11416  
    504504    if (exists)
    505505    {
    506         NSNumberFormatter * numberFormatter = [[NSNumberFormatter alloc] init];
     506        NSNumberFormatter * numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
    507507        [numberFormatter setNumberStyle: NSNumberFormatterDecimalStyle];
    508508        [numberFormatter setMaximumFractionDigits: 0];
    509509        NSString * countString = [numberFormatter stringFromNumber: [NSNumber numberWithInt: tr_blocklistGetRuleCount(fHandle)]];
    510         [numberFormatter release];
    511510       
    512511        [fBlocklistMessageField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ IP address rules in list",
Note: See TracChangeset for help on using the changeset viewer.