Changeset 5540
- Timestamp:
- Apr 6, 2008, 2:44:30 PM (14 years ago)
- Location:
- trunk/macosx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/NSStringAdditions.m
r5535 r5540 67 67 68 68 //attempt to have minimum of 3 digits with at least 1 decimal 69 NSString * formattedSize = convertedSize < 10.0 ? [NSString localizedStringWithFormat: @"%.2f", convertedSize - .005] 70 : [NSString localizedStringWithFormat: @"%.1f", convertedSize - .05]; 71 return [formattedSize stringByAppendingFormat: @" %@", unit]; 69 return convertedSize < 10.0 ? [NSString localizedStringWithFormat: @"%.2f %@", convertedSize - .005, unit] 70 : [NSString localizedStringWithFormat: @"%.1f %@", convertedSize - .05, unit]; 72 71 } 73 72 … … 80 79 { 81 80 if (speed < 1000.0) //0.0 K to 999.9 K 82 return [NSString localizedStringWithFormat: @"%.1f K", speed ];81 return [NSString localizedStringWithFormat: @"%.1f K", speed - .05]; 83 82 else if (speed < 102400.0) //0.98 M to 99.99 M 84 83 return [NSString localizedStringWithFormat: @"%.2f M", (speed / 1024.0) - .005]; -
trunk/macosx/Torrent.m
r5524 r5540 871 871 float uploadRate = [self uploadRate]; 872 872 if (uploadRate < 0.1) 873 return -1;873 return TR_ETA_UNKNOWN; 874 874 875 875 float stopRatio = [self actualStopRatio], ratio = [self ratio]; 876 876 if (stopRatio == INVALID || ratio >= stopRatio) 877 return -1;877 return TR_ETA_UNKNOWN; 878 878 879 879 return (float)MAX([self downloadedTotal], [self haveVerified]) * (stopRatio - ratio) / uploadRate / 1024.0; … … 1011 1011 { 1012 1012 int eta = fStat->status == TR_STATUS_DOWNLOAD ? [self eta] : [self etaRatio]; 1013 NSString * etaString = eta >= 0 ? [NSString stringWithFormat: NSLocalizedString(@"%@ remaining", "Torrent -> progress string"), 1014 [NSString timeString: eta showSeconds: YES maxDigits: 2]] 1015 : NSLocalizedString(@"remaining time unknown", "Torrent -> progress string"); 1013 NSString * etaString; 1014 switch (eta) 1015 { 1016 case TR_ETA_UNKNOWN: 1017 etaString = NSLocalizedString(@"remaining time unknown", "Torrent -> progress string"); 1018 break; 1019 case TR_ETA_NOT_AVAIL: 1020 etaString = NSLocalizedString(@"not all available", "Torrent -> progress string"); 1021 break; 1022 default: 1023 etaString = [NSString stringWithFormat: NSLocalizedString(@"%@ remaining", "Torrent -> progress string"), 1024 [NSString timeString: eta showSeconds: YES maxDigits: 2]]; 1025 } 1016 1026 1017 1027 string = [string stringByAppendingFormat: @" - %@", etaString]; … … 1153 1163 1154 1164 int eta = [self isSeeding] ? [self etaRatio] : [self eta]; 1155 return eta >= 0 ? [NSString timeString: eta showSeconds: YES maxDigits: 2] 1156 : NSLocalizedString(@"Unknown", "Torrent -> remaining time"); 1165 switch (eta) 1166 { 1167 case TR_ETA_UNKNOWN: 1168 return NSLocalizedString(@"Unknown", "Torrent -> remaining time string"); 1169 break; 1170 case TR_ETA_NOT_AVAIL: 1171 return NSLocalizedString(@"Not all available", "Torrent -> remaining time string"); 1172 default: 1173 return [NSString stringWithFormat: NSLocalizedString(@"%@ remaining", "Torrent -> remaining time string"), 1174 [NSString timeString: eta showSeconds: YES maxDigits: 2]]; 1175 } 1157 1176 } 1158 1177
Note: See TracChangeset
for help on using the changeset viewer.