Changeset 3316 for trunk/macosx/InfoWindowController.m
- Timestamp:
- Oct 7, 2007, 3:55:27 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/InfoWindowController.m
r3314 r3316 409 409 break; 410 410 } 411 }412 413 - (void) updateInfoGeneral414 {415 if ([fTorrents count] != 1)416 return;417 418 Torrent * torrent = [fTorrents objectAtIndex: 0];419 420 NSString * tracker = [[torrent trackerAddress] stringByAppendingString: [torrent trackerAddressAnnounce]];421 [fTrackerField setStringValue: tracker];422 [fTrackerField setToolTip: tracker];423 424 NSString * location = [torrent dataLocation];425 [fDataLocationField setStringValue: [location stringByAbbreviatingWithTildeInPath]];426 [fDataLocationField setToolTip: location];427 }428 429 - (void) updateInfoActivity430 {431 int numberSelected = [fTorrents count];432 if (numberSelected == 0)433 return;434 435 uint64_t have = 0, haveVerified = 0, downloadedTotal = 0, uploadedTotal = 0, failedHash = 0;436 Torrent * torrent;437 NSEnumerator * enumerator = [fTorrents objectEnumerator];438 while ((torrent = [enumerator nextObject]))439 {440 have += [torrent haveTotal];441 haveVerified += [torrent haveVerified];442 downloadedTotal += [torrent downloadedTotal];443 uploadedTotal += [torrent uploadedTotal];444 failedHash += [torrent failedHash];445 }446 447 if (have == 0)448 [fHaveField setStringValue: [NSString stringForFileSize: 0]];449 else if (have == haveVerified)450 [fHaveField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ verified",451 "Inspector -> Activity tab -> have"), [NSString stringForFileSize: haveVerified]]];452 else453 [fHaveField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ (%@ verified)",454 "Inspector -> Activity tab -> have"), [NSString stringForFileSize: have], [NSString stringForFileSize: haveVerified]]];455 456 [fDownloadedTotalField setStringValue: [NSString stringForFileSize: downloadedTotal]];457 [fUploadedTotalField setStringValue: [NSString stringForFileSize: uploadedTotal]];458 [fFailedHashField setStringValue: [NSString stringForFileSize: failedHash]];459 460 if (numberSelected == 1)461 {462 torrent = [fTorrents objectAtIndex: 0];463 464 [fStateField setStringValue: [torrent stateString]];465 [fProgressField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%.2f%% (%.2f%% selected)",466 "Inspector -> Activity tab -> progress"), 100.0 * [torrent progress], 100.0 * [torrent progressDone]]];467 [fRatioField setStringValue: [NSString stringForRatio: [torrent ratio]]];468 [fSwarmSpeedField setStringValue: [torrent isActive] ? [NSString stringForSpeed: [torrent swarmSpeed]] : @""];469 470 NSString * errorMessage = [torrent errorMessage];471 if (![errorMessage isEqualToString: [fErrorMessageView string]])472 {473 [fErrorMessageView setString: errorMessage];474 [fErrorMessageView setSelectable: ![errorMessage isEqualToString: @""]];475 }476 477 [fDateCompletedField setObjectValue: [torrent dateCompleted]];478 [fDateActivityField setObjectValue: [torrent dateActivity]];479 480 [fPiecesView updateView: NO];481 }482 }483 484 - (void) updateInfoPeers485 {486 if ([fTorrents count] != 1)487 return;488 Torrent * torrent = [fTorrents objectAtIndex: 0];489 490 int seeders = [torrent seeders], leechers = [torrent leechers], completed = [torrent completedFromTracker];491 [fSeedersField setStringValue: seeders > 0 ? [NSString stringWithFormat: @"%d", seeders] : @""];492 [fLeechersField setStringValue: leechers > 0 ? [NSString stringWithFormat: @"%d", leechers] : @""];493 [fCompletedFromTrackerField setStringValue: completed > 0 ? [NSString stringWithFormat: @"%d", completed] : @""];494 495 BOOL active = [torrent isActive];496 497 if (active)498 {499 int total = [torrent totalPeersConnected];500 NSString * connected = [NSString stringWithFormat:501 NSLocalizedString(@"%d Connected", "Inspector -> Peers tab -> peers"), total];502 503 if (total > 0)504 {505 NSMutableArray * components = [NSMutableArray arrayWithCapacity: 4];506 int count;507 if ((count = [torrent totalPeersTracker]) > 0)508 [components addObject: [NSString stringWithFormat:509 NSLocalizedString(@"%d tracker", "Inspector -> Peers tab -> peers"), count]];510 if ((count = [torrent totalPeersIncoming]) > 0)511 [components addObject: [NSString stringWithFormat:512 NSLocalizedString(@"%d incoming", "Inspector -> Peers tab -> peers"), count]];513 if ((count = [torrent totalPeersPex]) > 0)514 [components addObject: [NSString stringWithFormat:515 NSLocalizedString(@"%d PEX", "Inspector -> Peers tab -> peers"), count]];516 if ((count = [torrent totalPeersCache]) > 0)517 [components addObject: [NSString stringWithFormat:518 NSLocalizedString(@"%d cache", "Inspector -> Peers tab -> peers"), count]];519 520 connected = [connected stringByAppendingFormat: @": %@", [components componentsJoinedByString: @", "]];521 }522 523 [fConnectedPeersField setStringValue: connected];524 525 [fDownloadingFromField setIntValue: [torrent peersSendingToUs]];526 [fUploadingToField setIntValue: [torrent peersGettingFromUs]];527 }528 else529 {530 [fConnectedPeersField setStringValue: NSLocalizedString(@"info not available", "Inspector -> Peers tab -> peers")];531 [fDownloadingFromField setStringValue: @""];532 [fUploadingToField setStringValue: @""];533 }534 535 [fKnownField setIntValue: [torrent totalPeersKnown]];536 537 [fPeers release];538 fPeers = [[[torrent peers] sortedArrayUsingDescriptors: [self peerSortDescriptors]] retain];539 540 [fPeerTable reloadData];541 }542 543 - (void) updateInfoFiles544 {545 if ([fTorrents count] == 1)546 {547 [[fTorrents objectAtIndex: 0] updateFileStat];548 [fFileOutline reloadData];549 }550 }551 552 - (void) updateInfoOptions553 {554 if ([fTorrents count] == 0)555 return;556 557 //get bandwidth info558 NSEnumerator * enumerator = [fTorrents objectEnumerator];559 Torrent * torrent = [enumerator nextObject]; //first torrent560 561 int uploadSpeedMode = [torrent speedMode: YES],562 uploadSpeedLimit = [torrent speedLimit: YES],563 downloadSpeedMode = [torrent speedMode: NO],564 downloadSpeedLimit = [torrent speedLimit: NO];565 566 while ((torrent = [enumerator nextObject])567 && (uploadSpeedMode != INVALID || uploadSpeedLimit != INVALID568 || downloadSpeedMode != INVALID || downloadSpeedLimit != INVALID))569 {570 if (uploadSpeedMode != INVALID && uploadSpeedMode != [torrent speedMode: YES])571 uploadSpeedMode = INVALID;572 573 if (uploadSpeedLimit != INVALID && uploadSpeedLimit != [torrent speedLimit: YES])574 uploadSpeedLimit = INVALID;575 576 if (downloadSpeedMode != INVALID && downloadSpeedMode != [torrent speedMode: NO])577 downloadSpeedMode = INVALID;578 579 if (downloadSpeedLimit != INVALID && downloadSpeedLimit != [torrent speedLimit: NO])580 downloadSpeedLimit = INVALID;581 }582 583 //set upload view584 int index;585 if (uploadSpeedMode == TR_SPEEDLIMIT_SINGLE)586 index = OPTION_POPUP_LIMIT;587 else if (uploadSpeedMode == TR_SPEEDLIMIT_UNLIMITED)588 index = OPTION_POPUP_NO_LIMIT;589 else if (uploadSpeedMode == TR_SPEEDLIMIT_GLOBAL)590 index = OPTION_POPUP_GLOBAL;591 else592 index = -1;593 [fUploadLimitPopUp selectItemAtIndex: index];594 [fUploadLimitPopUp setEnabled: YES];595 596 [fUploadLimitLabel setHidden: uploadSpeedMode != TR_SPEEDLIMIT_SINGLE];597 [fUploadLimitField setHidden: uploadSpeedMode != TR_SPEEDLIMIT_SINGLE];598 if (uploadSpeedLimit != INVALID)599 [fUploadLimitField setIntValue: uploadSpeedLimit];600 else601 [fUploadLimitField setStringValue: @""];602 603 //set download view604 if (downloadSpeedMode == TR_SPEEDLIMIT_SINGLE)605 index = OPTION_POPUP_LIMIT;606 else if (downloadSpeedMode == TR_SPEEDLIMIT_UNLIMITED)607 index = OPTION_POPUP_NO_LIMIT;608 else if (downloadSpeedMode == TR_SPEEDLIMIT_GLOBAL)609 index = OPTION_POPUP_GLOBAL;610 else611 index = -1;612 [fDownloadLimitPopUp selectItemAtIndex: index];613 [fDownloadLimitPopUp setEnabled: YES];614 615 [fDownloadLimitLabel setHidden: downloadSpeedMode != TR_SPEEDLIMIT_SINGLE];616 [fDownloadLimitField setHidden: downloadSpeedMode != TR_SPEEDLIMIT_SINGLE];617 if (downloadSpeedLimit != INVALID)618 [fDownloadLimitField setIntValue: downloadSpeedLimit];619 else620 [fDownloadLimitField setStringValue: @""];621 622 //get ratio info623 enumerator = [fTorrents objectEnumerator];624 torrent = [enumerator nextObject]; //first torrent625 626 int checkRatio = [torrent ratioSetting];627 float ratioLimit = [torrent ratioLimit];628 629 while ((torrent = [enumerator nextObject]) && (checkRatio != INVALID || checkRatio != INVALID))630 {631 if (checkRatio != INVALID && checkRatio != [torrent ratioSetting])632 checkRatio = INVALID;633 634 if (ratioLimit != INVALID && ratioLimit != [torrent ratioLimit])635 ratioLimit = INVALID;636 }637 638 //set ratio view639 if (checkRatio == NSOnState)640 index = OPTION_POPUP_LIMIT;641 else if (checkRatio == NSOffState)642 index = OPTION_POPUP_NO_LIMIT;643 else if (checkRatio == NSMixedState)644 index = OPTION_POPUP_GLOBAL;645 else646 index = -1;647 [fRatioPopUp selectItemAtIndex: index];648 [fRatioPopUp setEnabled: YES];649 650 [fRatioLimitField setHidden: checkRatio != NSOnState];651 if (ratioLimit != INVALID)652 [fRatioLimitField setFloatValue: ratioLimit];653 else654 [fRatioLimitField setStringValue: @""];655 656 //set pex check657 enumerator = [fTorrents objectEnumerator];658 torrent = [enumerator nextObject]; //first torrent659 660 BOOL pexEnabled = ![torrent privateTorrent] && [torrent isPaused];661 int pexState = [torrent pex] ? NSOnState : NSOffState;662 663 while ((torrent = [enumerator nextObject]) && (pexEnabled || pexState != NSMixedState))664 {665 if (pexEnabled)666 pexEnabled = ![torrent privateTorrent] && [torrent isPaused];667 668 if (pexState != NSMixedState && pexState != ([torrent pex] ? NSOnState : NSOffState))669 pexState = NSMixedState;670 }671 672 [fPexCheck setEnabled: pexEnabled];673 [fPexCheck setState: pexState];674 [fPexCheck setToolTip: !pexEnabled ? NSLocalizedString(@"PEX can only be toggled on paused public torrents.",675 "Inspector -> pex check") : nil];676 411 } 677 412 … … 825 560 return; 826 561 562 //deselect old tab item 563 [(InfoTabButtonCell *)[fTabMatrix cellWithTag: oldTabTag] setSelectedTab: NO]; 564 827 565 //get old view 828 566 NSView * oldView = [self tabViewForTag: oldTabTag]; … … 837 575 } 838 576 577 //selected tab item 578 [(InfoTabButtonCell *)[fTabMatrix selectedCell] setSelectedTab: YES]; 579 839 580 NSRect windowRect = [window frame], viewRect = [view frame]; 840 581 … … 870 611 [[window contentView] addSubview: view]; 871 612 [view setHidden: NO]; 872 873 //change selected tab item874 if (oldTabTag != INVALID)875 [(InfoTabButtonCell *)[fTabMatrix cellWithTag: oldTabTag] setSelectedTab: NO];876 [(InfoTabButtonCell *)[fTabMatrix selectedCell] setSelectedTab: YES];877 613 } 878 614 … … 1339 1075 @implementation InfoWindowController (Private) 1340 1076 1077 - (void) updateInfoGeneral 1078 { 1079 if ([fTorrents count] != 1) 1080 return; 1081 1082 Torrent * torrent = [fTorrents objectAtIndex: 0]; 1083 1084 NSString * tracker = [[torrent trackerAddress] stringByAppendingString: [torrent trackerAddressAnnounce]]; 1085 [fTrackerField setStringValue: tracker]; 1086 [fTrackerField setToolTip: tracker]; 1087 1088 NSString * location = [torrent dataLocation]; 1089 [fDataLocationField setStringValue: [location stringByAbbreviatingWithTildeInPath]]; 1090 [fDataLocationField setToolTip: location]; 1091 } 1092 1093 - (void) updateInfoActivity 1094 { 1095 int numberSelected = [fTorrents count]; 1096 if (numberSelected == 0) 1097 return; 1098 1099 uint64_t have = 0, haveVerified = 0, downloadedTotal = 0, uploadedTotal = 0, failedHash = 0; 1100 Torrent * torrent; 1101 NSEnumerator * enumerator = [fTorrents objectEnumerator]; 1102 while ((torrent = [enumerator nextObject])) 1103 { 1104 have += [torrent haveTotal]; 1105 haveVerified += [torrent haveVerified]; 1106 downloadedTotal += [torrent downloadedTotal]; 1107 uploadedTotal += [torrent uploadedTotal]; 1108 failedHash += [torrent failedHash]; 1109 } 1110 1111 if (have == 0) 1112 [fHaveField setStringValue: [NSString stringForFileSize: 0]]; 1113 else if (have == haveVerified) 1114 [fHaveField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ verified", 1115 "Inspector -> Activity tab -> have"), [NSString stringForFileSize: haveVerified]]]; 1116 else 1117 [fHaveField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%@ (%@ verified)", 1118 "Inspector -> Activity tab -> have"), [NSString stringForFileSize: have], [NSString stringForFileSize: haveVerified]]]; 1119 1120 [fDownloadedTotalField setStringValue: [NSString stringForFileSize: downloadedTotal]]; 1121 [fUploadedTotalField setStringValue: [NSString stringForFileSize: uploadedTotal]]; 1122 [fFailedHashField setStringValue: [NSString stringForFileSize: failedHash]]; 1123 1124 if (numberSelected == 1) 1125 { 1126 torrent = [fTorrents objectAtIndex: 0]; 1127 1128 [fStateField setStringValue: [torrent stateString]]; 1129 [fProgressField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%.2f%% (%.2f%% selected)", 1130 "Inspector -> Activity tab -> progress"), 100.0 * [torrent progress], 100.0 * [torrent progressDone]]]; 1131 [fRatioField setStringValue: [NSString stringForRatio: [torrent ratio]]]; 1132 [fSwarmSpeedField setStringValue: [torrent isActive] ? [NSString stringForSpeed: [torrent swarmSpeed]] : @""]; 1133 1134 NSString * errorMessage = [torrent errorMessage]; 1135 if (![errorMessage isEqualToString: [fErrorMessageView string]]) 1136 { 1137 [fErrorMessageView setString: errorMessage]; 1138 [fErrorMessageView setSelectable: ![errorMessage isEqualToString: @""]]; 1139 } 1140 1141 [fDateCompletedField setObjectValue: [torrent dateCompleted]]; 1142 [fDateActivityField setObjectValue: [torrent dateActivity]]; 1143 1144 [fPiecesView updateView: NO]; 1145 } 1146 } 1147 1148 - (void) updateInfoPeers 1149 { 1150 if ([fTorrents count] != 1) 1151 return; 1152 Torrent * torrent = [fTorrents objectAtIndex: 0]; 1153 1154 int seeders = [torrent seeders], leechers = [torrent leechers], completed = [torrent completedFromTracker]; 1155 [fSeedersField setStringValue: seeders > 0 ? [NSString stringWithFormat: @"%d", seeders] : @""]; 1156 [fLeechersField setStringValue: leechers > 0 ? [NSString stringWithFormat: @"%d", leechers] : @""]; 1157 [fCompletedFromTrackerField setStringValue: completed > 0 ? [NSString stringWithFormat: @"%d", completed] : @""]; 1158 1159 BOOL active = [torrent isActive]; 1160 1161 if (active) 1162 { 1163 int total = [torrent totalPeersConnected]; 1164 NSString * connected = [NSString stringWithFormat: 1165 NSLocalizedString(@"%d Connected", "Inspector -> Peers tab -> peers"), total]; 1166 1167 if (total > 0) 1168 { 1169 NSMutableArray * components = [NSMutableArray arrayWithCapacity: 4]; 1170 int count; 1171 if ((count = [torrent totalPeersTracker]) > 0) 1172 [components addObject: [NSString stringWithFormat: 1173 NSLocalizedString(@"%d tracker", "Inspector -> Peers tab -> peers"), count]]; 1174 if ((count = [torrent totalPeersIncoming]) > 0) 1175 [components addObject: [NSString stringWithFormat: 1176 NSLocalizedString(@"%d incoming", "Inspector -> Peers tab -> peers"), count]]; 1177 if ((count = [torrent totalPeersPex]) > 0) 1178 [components addObject: [NSString stringWithFormat: 1179 NSLocalizedString(@"%d PEX", "Inspector -> Peers tab -> peers"), count]]; 1180 if ((count = [torrent totalPeersCache]) > 0) 1181 [components addObject: [NSString stringWithFormat: 1182 NSLocalizedString(@"%d cache", "Inspector -> Peers tab -> peers"), count]]; 1183 1184 connected = [connected stringByAppendingFormat: @": %@", [components componentsJoinedByString: @", "]]; 1185 } 1186 1187 [fConnectedPeersField setStringValue: connected]; 1188 1189 [fDownloadingFromField setIntValue: [torrent peersSendingToUs]]; 1190 [fUploadingToField setIntValue: [torrent peersGettingFromUs]]; 1191 } 1192 else 1193 { 1194 [fConnectedPeersField setStringValue: NSLocalizedString(@"info not available", "Inspector -> Peers tab -> peers")]; 1195 [fDownloadingFromField setStringValue: @""]; 1196 [fUploadingToField setStringValue: @""]; 1197 } 1198 1199 [fKnownField setIntValue: [torrent totalPeersKnown]]; 1200 1201 [fPeers release]; 1202 fPeers = [[[torrent peers] sortedArrayUsingDescriptors: [self peerSortDescriptors]] retain]; 1203 1204 [fPeerTable reloadData]; 1205 } 1206 1207 - (void) updateInfoFiles 1208 { 1209 if ([fTorrents count] == 1) 1210 { 1211 [[fTorrents objectAtIndex: 0] updateFileStat]; 1212 [fFileOutline reloadData]; 1213 } 1214 } 1215 1216 - (void) updateInfoOptions 1217 { 1218 if ([fTorrents count] == 0) 1219 return; 1220 1221 //get bandwidth info 1222 NSEnumerator * enumerator = [fTorrents objectEnumerator]; 1223 Torrent * torrent = [enumerator nextObject]; //first torrent 1224 1225 int uploadSpeedMode = [torrent speedMode: YES], 1226 uploadSpeedLimit = [torrent speedLimit: YES], 1227 downloadSpeedMode = [torrent speedMode: NO], 1228 downloadSpeedLimit = [torrent speedLimit: NO]; 1229 1230 while ((torrent = [enumerator nextObject]) 1231 && (uploadSpeedMode != INVALID || uploadSpeedLimit != INVALID 1232 || downloadSpeedMode != INVALID || downloadSpeedLimit != INVALID)) 1233 { 1234 if (uploadSpeedMode != INVALID && uploadSpeedMode != [torrent speedMode: YES]) 1235 uploadSpeedMode = INVALID; 1236 1237 if (uploadSpeedLimit != INVALID && uploadSpeedLimit != [torrent speedLimit: YES]) 1238 uploadSpeedLimit = INVALID; 1239 1240 if (downloadSpeedMode != INVALID && downloadSpeedMode != [torrent speedMode: NO]) 1241 downloadSpeedMode = INVALID; 1242 1243 if (downloadSpeedLimit != INVALID && downloadSpeedLimit != [torrent speedLimit: NO]) 1244 downloadSpeedLimit = INVALID; 1245 } 1246 1247 //set upload view 1248 int index; 1249 if (uploadSpeedMode == TR_SPEEDLIMIT_SINGLE) 1250 index = OPTION_POPUP_LIMIT; 1251 else if (uploadSpeedMode == TR_SPEEDLIMIT_UNLIMITED) 1252 index = OPTION_POPUP_NO_LIMIT; 1253 else if (uploadSpeedMode == TR_SPEEDLIMIT_GLOBAL) 1254 index = OPTION_POPUP_GLOBAL; 1255 else 1256 index = -1; 1257 [fUploadLimitPopUp selectItemAtIndex: index]; 1258 [fUploadLimitPopUp setEnabled: YES]; 1259 1260 [fUploadLimitLabel setHidden: uploadSpeedMode != TR_SPEEDLIMIT_SINGLE]; 1261 [fUploadLimitField setHidden: uploadSpeedMode != TR_SPEEDLIMIT_SINGLE]; 1262 if (uploadSpeedLimit != INVALID) 1263 [fUploadLimitField setIntValue: uploadSpeedLimit]; 1264 else 1265 [fUploadLimitField setStringValue: @""]; 1266 1267 //set download view 1268 if (downloadSpeedMode == TR_SPEEDLIMIT_SINGLE) 1269 index = OPTION_POPUP_LIMIT; 1270 else if (downloadSpeedMode == TR_SPEEDLIMIT_UNLIMITED) 1271 index = OPTION_POPUP_NO_LIMIT; 1272 else if (downloadSpeedMode == TR_SPEEDLIMIT_GLOBAL) 1273 index = OPTION_POPUP_GLOBAL; 1274 else 1275 index = -1; 1276 [fDownloadLimitPopUp selectItemAtIndex: index]; 1277 [fDownloadLimitPopUp setEnabled: YES]; 1278 1279 [fDownloadLimitLabel setHidden: downloadSpeedMode != TR_SPEEDLIMIT_SINGLE]; 1280 [fDownloadLimitField setHidden: downloadSpeedMode != TR_SPEEDLIMIT_SINGLE]; 1281 if (downloadSpeedLimit != INVALID) 1282 [fDownloadLimitField setIntValue: downloadSpeedLimit]; 1283 else 1284 [fDownloadLimitField setStringValue: @""]; 1285 1286 //get ratio info 1287 enumerator = [fTorrents objectEnumerator]; 1288 torrent = [enumerator nextObject]; //first torrent 1289 1290 int checkRatio = [torrent ratioSetting]; 1291 float ratioLimit = [torrent ratioLimit]; 1292 1293 while ((torrent = [enumerator nextObject]) && (checkRatio != INVALID || checkRatio != INVALID)) 1294 { 1295 if (checkRatio != INVALID && checkRatio != [torrent ratioSetting]) 1296 checkRatio = INVALID; 1297 1298 if (ratioLimit != INVALID && ratioLimit != [torrent ratioLimit]) 1299 ratioLimit = INVALID; 1300 } 1301 1302 //set ratio view 1303 if (checkRatio == NSOnState) 1304 index = OPTION_POPUP_LIMIT; 1305 else if (checkRatio == NSOffState) 1306 index = OPTION_POPUP_NO_LIMIT; 1307 else if (checkRatio == NSMixedState) 1308 index = OPTION_POPUP_GLOBAL; 1309 else 1310 index = -1; 1311 [fRatioPopUp selectItemAtIndex: index]; 1312 [fRatioPopUp setEnabled: YES]; 1313 1314 [fRatioLimitField setHidden: checkRatio != NSOnState]; 1315 if (ratioLimit != INVALID) 1316 [fRatioLimitField setFloatValue: ratioLimit]; 1317 else 1318 [fRatioLimitField setStringValue: @""]; 1319 1320 //set pex check 1321 enumerator = [fTorrents objectEnumerator]; 1322 torrent = [enumerator nextObject]; //first torrent 1323 1324 BOOL pexEnabled = ![torrent privateTorrent] && [torrent isPaused]; 1325 int pexState = [torrent pex] ? NSOnState : NSOffState; 1326 1327 while ((torrent = [enumerator nextObject]) && (pexEnabled || pexState != NSMixedState)) 1328 { 1329 if (pexEnabled) 1330 pexEnabled = ![torrent privateTorrent] && [torrent isPaused]; 1331 1332 if (pexState != NSMixedState && pexState != ([torrent pex] ? NSOnState : NSOffState)) 1333 pexState = NSMixedState; 1334 } 1335 1336 [fPexCheck setEnabled: pexEnabled]; 1337 [fPexCheck setState: pexState]; 1338 [fPexCheck setToolTip: !pexEnabled ? NSLocalizedString(@"PEX can only be toggled on paused public torrents.", 1339 "Inspector -> pex check") : nil]; 1340 } 1341 1341 1342 - (NSView *) tabViewForTag: (int) tag 1342 1343 {
Note: See TracChangeset
for help on using the changeset viewer.