Ignore:
Timestamp:
Dec 30, 2006, 7:24:09 PM (15 years ago)
Author:
livings124
Message:

move ratio from mac code to libT code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/StringAdditions.m

    r1081 r1302  
    2424
    2525#import "StringAdditions.h"
     26#import <transmission.h>
    2627
    2728@implementation NSString (StringAdditions)
     
    9495}
    9596
    96 + (NSString *) stringForRatioWithDownload: (uint64_t) down upload: (uint64_t) up
     97+ (NSString *) stringForRatio: (float) ratio
    9798{
    98     if (down == 0)
    99         return up == 0 ? NSLocalizedString(@"N/A", "No Ratio") : [NSString stringWithUTF8String: "\xE2\x88\x9E"];
    100 
    101     float ratio = (float) up / (float) down;
    102     if (ratio < 10.0)
     99    if (ratio == TR_RATIO_NA)
     100        return NSLocalizedString(@"N/A", "No Ratio");
     101    else if (ratio == TR_RATIO_INF)
     102        return [NSString stringWithUTF8String: "\xE2\x88\x9E"];
     103    else if (ratio < 10.0)
    103104        return [NSString stringWithFormat: @"%.2f", ratio];
    104105    else if (ratio < 100.0)
Note: See TracChangeset for help on using the changeset viewer.