]> granicus.if.org Git - transmission/commitdiff
adjustments to rounding when displaying speeds and file size
authorMitchell Livingston <livings124@transmissionbt.com>
Sun, 6 Apr 2008 14:02:08 +0000 (14:02 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Sun, 6 Apr 2008 14:02:08 +0000 (14:02 +0000)
macosx/Controller.m
macosx/NSStringAdditions.m

index 9b9fedf3c366c087d679a6fda0f32051295a7412..191eb6b6c27cecae8b202c6dd1f84cc6fd787fc7 100644 (file)
@@ -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];
index b5ce75083e18222a7eb6def8114628ddb53beaf8..b4eff0ee09178e647e85d365613ad5a009108e5c 100644 (file)
@@ -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
     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