Changeset 3947
- Timestamp:
- Nov 23, 2007, 5:42:49 PM (14 years ago)
- Location:
- trunk/macosx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/Torrent.h
r3946 r3947 154 154 - (float) progressDone; 155 155 - (float) progressLeft; 156 156 157 - (int) eta; 157 - (NSString * ) etaString; 158 - (int) etaRatio; 159 - (NSString * ) etaString: (int) eta; 158 160 159 161 - (float) notAvailableDesired; -
trunk/macosx/Torrent.m
r3946 r3947 724 724 } 725 725 726 - (NSString * ) etaString 727 { 728 int eta = [self eta]; 726 - (int) etaRatio 727 { 728 if (![self isSeeding]) 729 return -1; 730 731 float uploadRate = [self uploadRate]; 732 if (uploadRate < 0.1) 733 return -1; 734 735 float stopRatio = [self actualStopRatio], ratio = [self ratio]; 736 if (stopRatio == INVALID || ratio >= stopRatio) 737 return -1; 738 739 return (float)MAX([self downloadedTotal], [self haveVerified]) * (stopRatio - ratio) / uploadRate / 1024.0; 740 } 741 742 - (NSString * ) etaString: (int) eta 743 { 729 744 if (eta < 0) 730 745 return @""; … … 869 884 if (fStat->status == TR_STATUS_DOWNLOAD) 870 885 { 871 string = [self eta] >= 0 872 ? [string stringByAppendingFormat: NSLocalizedString(@" - %@ remaining", "Torrent -> progress string"), [self etaString]] 886 int eta = [self eta]; 887 string = eta >= 0 ? [string stringByAppendingFormat: NSLocalizedString(@" - %@ remaining", "Torrent -> progress string"), 888 [self etaString: eta]] 873 889 : [string stringByAppendingString: NSLocalizedString(@" - remaining time unknown", "Torrent -> progress string")]; 874 890 } 891 else if ([self isSeeding] && fRatioSetting != NSOffState) 892 { 893 int eta = [self etaRatio]; 894 string = eta >= 0 ? [string stringByAppendingFormat: NSLocalizedString(@" - %@ remaining", "Torrent -> progress string"), 895 [self etaString: eta]] 896 : [string stringByAppendingString: NSLocalizedString(@" - remaining time unknown", "Torrent -> progress string")]; 897 } 898 else; 875 899 876 900 return string; … … 1007 1031 { 1008 1032 case TR_STATUS_DOWNLOAD: 1009 return [self eta] >= 0 ? [self etaString ] : NSLocalizedString(@"Unknown", "Torrent -> remaining time");1033 return [self eta] >= 0 ? [self etaString: [self eta]] : NSLocalizedString(@"Unknown", "Torrent -> remaining time"); 1010 1034 1011 1035 case TR_STATUS_SEED:
Note: See TracChangeset
for help on using the changeset viewer.