Changeset 5535


Ignore:
Timestamp:
Apr 6, 2008, 2:02:08 PM (14 years ago)
Author:
livings124
Message:

adjustments to rounding when displaying speeds and file size

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r5534 r5535  
    22212221            icon = [[GroupsController groups] imageForIndex: index isSmall: YES];
    22222222            toolTip = [NSString stringWithFormat: @"%@: %@", NSLocalizedString(@"Group", "Groups -> Button"),
    2223                          [[GroupsController groups] nameForIndex: index]];
     2223                        [[GroupsController groups] nameForIndex: index]];
    22242224    }
    22252225   
  • trunk/macosx/NSStringAdditions.m

    r5349 r5535  
    6767   
    6868    //attempt to have minimum of 3 digits with at least 1 decimal
    69     return [NSString localizedStringWithFormat: convertedSize < 10.0 ? @"%.2f %@" : @"%.1f %@", convertedSize, unit];
     69    NSString * formattedSize = convertedSize < 10.0 ? [NSString localizedStringWithFormat: @"%.2f", convertedSize - .005]
     70                                : [NSString localizedStringWithFormat: @"%.1f", convertedSize - .05];
     71    return [formattedSize stringByAppendingFormat: @" %@", unit];
    7072}
    7173
     
    8082        return [NSString localizedStringWithFormat: @"%.1f K", speed];
    8183    else if (speed < 102400.0) //0.98 M to 99.99 M
    82         return [NSString localizedStringWithFormat: @"%.2f M", speed / 1024.0];
     84        return [NSString localizedStringWithFormat: @"%.2f M", (speed / 1024.0) - .005];
    8385    else if (speed < 1024000.0) //100.0 M to 999.9 M
    84         return [NSString localizedStringWithFormat: @"%.1f M", speed / 1024.0];
     86        return [NSString localizedStringWithFormat: @"%.1f M", (speed / 1024.0) - .05];
    8587    else //insane speeds
    86         return [NSString localizedStringWithFormat: @"%.2f G", speed / 1048576.0];
     88        return [NSString localizedStringWithFormat: @"%.2f G", (speed / 1048576.0) - .005];
    8789}
    8890
Note: See TracChangeset for help on using the changeset viewer.