1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 09:13:06 +00:00

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

This commit is contained in:
Mitchell Livingston 2009-03-05 04:59:24 +00:00
parent 19a8b5a99d
commit d4b7ec04b8
2 changed files with 5 additions and 11 deletions

View file

@ -23,6 +23,7 @@
*****************************************************************************/
#import "NSStringAdditions.h"
#import "utils.h"
#import <transmission.h>
@implementation NSString (NSStringAdditions)
@ -92,18 +93,12 @@
+ (NSString *) stringForRatio: (CGFloat) ratio
{
//N/A is different than libtransmission's
if (ratio == TR_RATIO_NA)
return NSLocalizedString(@"N/A", "No Ratio");
else if (ratio == TR_RATIO_INF)
return [NSString stringWithUTF8String: "\xE2\x88\x9E"];
else;
if (ratio <= 9.995f) //0.00 to 9.99
return [NSString localizedStringWithFormat: @"%.2f", ratio];
else if (ratio <= 99.95f) //10.0 to 99.9
return [NSString localizedStringWithFormat: @"%.1f", ratio];
else //rest are single digit
return [NSString localizedStringWithFormat: @"%.0f", ratio];
char buf[50];
return [NSString stringWithUTF8String: tr_strratio(buf, sizeof(buf), ratio, "\xE2\x88\x9E")];
}
+ (NSString *) timeString: (uint64_t) seconds showSeconds: (BOOL) showSeconds

View file

@ -601,7 +601,6 @@
}
const BOOL upload = menu == fUploadMenu;
const BOOL limit = [fMenuTorrent usesSpeedLimit: upload];
item = [menu itemWithTag: ACTION_MENU_LIMIT_TAG];
@ -630,7 +629,7 @@
}
}
tr_ratiolimit mode = [fMenuTorrent ratioSetting];
const tr_ratiolimit mode = [fMenuTorrent ratioSetting];
item = [menu itemWithTag: ACTION_MENU_LIMIT_TAG];
[item setState: mode == TR_RATIOLIMIT_SINGLE ? NSOnState : NSOffState];