Changeset 2080
- Timestamp:
- Jun 14, 2007, 9:50:38 PM (15 years ago)
- Location:
- branches/file_selection/macosx
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/file_selection/macosx/Controller.m
r2018 r2080 2851 2851 Torrent * torrent; 2852 2852 while ((torrent = [enumerator nextObject])) 2853 if ([torrent isActive]) 2854 { 2855 if ([torrent allDownloaded]) 2856 seeding++; 2857 else 2858 downloading++; 2859 } 2853 { 2854 if ([torrent isSeeding]) 2855 seeding++; 2856 else if ([torrent isActive]) 2857 downloading++; 2858 } 2860 2859 2861 2860 NSMenuItem * seedingItem = [fDockMenu itemWithTag: DOCK_SEEDING_TAG], -
branches/file_selection/macosx/Torrent.h
r2041 r2080 98 98 - (void) resetCache; 99 99 100 - (BOOL) allDownloaded;101 102 100 - (float) ratio; 103 101 - (int) ratioSetting; … … 167 165 - (BOOL) isWaitingToChecking; 168 166 - (BOOL) isChecking; 167 - (BOOL) allDownloaded; 169 168 - (BOOL) isError; 170 169 - (NSString *) errorMessage; -
branches/file_selection/macosx/Torrent.m
r2078 r2080 367 367 [NSString stringForFileSize: [self downloadedValid]], 368 368 [NSString stringForFileSize: [self size]], 100.0 * [self progress]]; 369 else if ([self progress] < 1.0) 370 [progressString appendFormat: NSLocalizedString(@"%@ of %@ (%.2f%%), uploaded %@ (Ratio: %@)", 371 "Torrent -> progress string"), 372 [NSString stringForFileSize: [self downloadedValid]], [NSString stringForFileSize: [self size]], 373 100.0 * [self progress], [NSString stringForFileSize: [self uploadedTotal]], 374 [NSString stringForRatio: [self ratio]]]; 369 375 else 370 376 [progressString appendFormat: NSLocalizedString(@"%@, uploaded %@ (Ratio: %@)", "Torrent -> progress string"), 371 [NSString stringForFileSize: [self downloadedValid]], 372 [NSString stringForFileSize: [self uploadedTotal]], 377 [NSString stringForFileSize: [self size]], [NSString stringForFileSize: [self uploadedTotal]], 373 378 [NSString stringForRatio: [self ratio]]]; 374 379 … … 462 467 463 468 case TR_STATUS_SEED: 469 case TR_STATUS_DONE: 464 470 [statusString setString: @""]; 465 471 if ([self totalPeers] != 1) … … 468 474 else 469 475 [statusString appendFormat: NSLocalizedString(@"Seeding to %d of 1 peer", "Torrent -> status string"), 470 [self peersDownloading]];471 472 break;473 474 case TR_STATUS_DONE:475 [statusString setString: @""];476 if ([self totalPeers] != 1)477 [statusString appendFormat:@"Uploading to %d of %d peers",478 [self peersDownloading], [self totalPeers]];479 else480 [statusString appendFormat: @"Uploading to %d of 1 peer",481 476 [self peersDownloading]]; 482 477 … … 643 638 { 644 639 tr_torrentRemoveFastResume(fHandle); 645 }646 647 - (BOOL) allDownloaded648 {649 return [self progress] >= 1.0;650 640 } 651 641 … … 1076 1066 1077 1067 case TR_STATUS_SEED: 1068 case TR_STATUS_DONE: 1078 1069 return NSLocalizedString(@"Seeding", "Torrent -> status string"); 1079 1070 break; … … 1083 1074 break; 1084 1075 1085 case TR_STATUS_DONE:1086 return @"Uploading";1087 break;1088 1089 1076 default: 1090 1077 return NSLocalizedString(@"N/A", "Torrent -> status string"); … … 1094 1081 - (float) progress 1095 1082 { 1096 return fStat->percent Done;1083 return fStat->percentComplete; 1097 1084 } 1098 1085 … … 1109 1096 - (BOOL) isSeeding 1110 1097 { 1111 return (fStat->status == TR_STATUS_SEED || fStat->status == TR_STATUS_DONE); 1112 } 1113 1114 - (BOOL) isDone 1115 { 1116 return fStat->status == TR_STATUS_DONE; 1098 return fStat->status == TR_STATUS_SEED || fStat->status == TR_STATUS_DONE; 1117 1099 } 1118 1100 … … 1130 1112 { 1131 1113 return fStat->status == TR_STATUS_CHECK; 1114 } 1115 1116 - (BOOL) allDownloaded 1117 { 1118 return fStat->cpStatus != TR_CP_INCOMPLETE; 1132 1119 } 1133 1120 -
branches/file_selection/macosx/TorrentCell.m
r1972 r2080 82 82 completeBounds = barBounds; 83 83 84 float progress = [[info objectForKey: @"Progress"] floatValue]; 85 completeBounds.size.width = progress * width; 86 84 87 if ([[info objectForKey: @"Seeding"] boolValue]) 85 88 { 86 completeBounds.size.width = width * [[info objectForKey: @"ProgressStopRatio"] floatValue]; 89 NSRect ratioBounds = completeBounds; 90 ratioBounds.size.width *= [[info objectForKey: @"ProgressStopRatio"] floatValue]; 87 91 88 92 if (completeBounds.size.width < barBounds.size.width) 89 [fLightGreenGradient fillRect: barBounds angle: -90]; 90 [fGreenGradient fillRect: completeBounds angle: -90]; 93 [fWhiteGradient fillRect: barBounds angle: -90]; 94 if (ratioBounds.size.width < completeBounds.size.width) 95 [fLightGreenGradient fillRect: completeBounds angle: -90]; 96 [fGreenGradient fillRect: ratioBounds angle: -90]; 91 97 } 92 98 else 93 99 { 94 completeBounds.size.width = [[info objectForKey: @"Progress"] floatValue] * width;95 100 if (completeBounds.size.width < barBounds.size.width) 96 101 [fWhiteGradient fillRect: barBounds angle: -90];
Note: See TracChangeset
for help on using the changeset viewer.