mirror of
https://github.com/transmission/transmission
synced 2025-03-10 22:22:58 +00:00
adjustments to rounding when displaying speeds and file size
This commit is contained in:
parent
0663eb4dd4
commit
aca7155f19
2 changed files with 7 additions and 5 deletions
|
@ -2220,7 +2220,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
default:
|
||||
icon = [[GroupsController groups] imageForIndex: index isSmall: YES];
|
||||
toolTip = [NSString stringWithFormat: @"%@: %@", NSLocalizedString(@"Group", "Groups -> Button"),
|
||||
[[GroupsController groups] nameForIndex: index]];
|
||||
[[GroupsController groups] nameForIndex: index]];
|
||||
}
|
||||
|
||||
[[fGroupFilterMenu itemAtIndex: 0] setImage: icon];
|
||||
|
|
|
@ -66,7 +66,9 @@
|
|||
}
|
||||
|
||||
//attempt to have minimum of 3 digits with at least 1 decimal
|
||||
return [NSString localizedStringWithFormat: convertedSize < 10.0 ? @"%.2f %@" : @"%.1f %@", convertedSize, unit];
|
||||
NSString * formattedSize = convertedSize < 10.0 ? [NSString localizedStringWithFormat: @"%.2f", convertedSize - .005]
|
||||
: [NSString localizedStringWithFormat: @"%.1f", convertedSize - .05];
|
||||
return [formattedSize stringByAppendingFormat: @" %@", unit];
|
||||
}
|
||||
|
||||
+ (NSString *) stringForSpeed: (float) speed
|
||||
|
@ -79,11 +81,11 @@
|
|||
if (speed < 1000.0) //0.0 K to 999.9 K
|
||||
return [NSString localizedStringWithFormat: @"%.1f K", speed];
|
||||
else if (speed < 102400.0) //0.98 M to 99.99 M
|
||||
return [NSString localizedStringWithFormat: @"%.2f M", speed / 1024.0];
|
||||
return [NSString localizedStringWithFormat: @"%.2f M", (speed / 1024.0) - .005];
|
||||
else if (speed < 1024000.0) //100.0 M to 999.9 M
|
||||
return [NSString localizedStringWithFormat: @"%.1f M", speed / 1024.0];
|
||||
return [NSString localizedStringWithFormat: @"%.1f M", (speed / 1024.0) - .05];
|
||||
else //insane speeds
|
||||
return [NSString localizedStringWithFormat: @"%.2f G", speed / 1048576.0];
|
||||
return [NSString localizedStringWithFormat: @"%.2f G", (speed / 1048576.0) - .005];
|
||||
}
|
||||
|
||||
+ (NSString *) stringForRatio: (float) ratio
|
||||
|
|
Loading…
Add table
Reference in a new issue