Ignore:
Timestamp:
Mar 5, 2009, 4:59:24 AM (13 years ago)
Author:
livings124
Message:

#1881: Displayed ratio should be truncated, not rounded (Mac)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/NSStringAdditions.m

    r8028 r8029  
    2424
    2525#import "NSStringAdditions.h"
     26#import "utils.h"
    2627#import <transmission.h>
    2728
     
    9394+ (NSString *) stringForRatio: (CGFloat) ratio
    9495{
     96    //N/A is different than libtransmission's
    9597    if (ratio == TR_RATIO_NA)
    9698        return NSLocalizedString(@"N/A", "No Ratio");
    97     else if (ratio == TR_RATIO_INF)
    98         return [NSString stringWithUTF8String: "\xE2\x88\x9E"];
    99     else;
    10099   
    101     if (ratio <= 9.995f) //0.00 to 9.99
    102         return [NSString localizedStringWithFormat: @"%.2f", ratio];
    103     else if (ratio <= 99.95f) //10.0 to 99.9
    104         return [NSString localizedStringWithFormat: @"%.1f", ratio];
    105     else //rest are single digit
    106         return [NSString localizedStringWithFormat: @"%.0f", ratio];
     100    char buf[50];
     101    return [NSString stringWithUTF8String: tr_strratio(buf, sizeof(buf), ratio, "\xE2\x88\x9E")];
    107102}
    108103
Note: See TracChangeset for help on using the changeset viewer.