Changeset 1514
- Timestamp:
- Feb 23, 2007, 7:17:31 PM (15 years ago)
- Location:
- trunk/macosx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/InfoWindowController.m
r1512 r1514 108 108 [fFileOutline setDoubleAction: @selector(revealFile:)]; 109 109 110 [[NSNotificationCenter defaultCenter] addObserver: self 111 selector: @selector(fileFinished:) name: @"FileFinished" object: nil]; 112 110 113 //set blank inspector 111 114 [self updateInfoForTorrents: [NSArray array]]; … … 114 117 - (void) dealloc 115 118 { 116 [fTorrents release]; 119 [[NSNotificationCenter defaultCenter] removeObserver: self]; 120 121 if (fTorrents) 122 [fTorrents release]; 117 123 if (fPeers) 118 124 [fPeers release]; … … 400 406 return; 401 407 402 [[fTorrents objectAtIndex: 0] updateFileProgress];403 [fFileOutline reloadData];408 if ([[fTorrents objectAtIndex: 0] updateFileProgress]) 409 [fFileOutline reloadData]; 404 410 } 405 411 … … 711 717 712 718 - (void) outlineView: (NSOutlineView *) outlineView willDisplayCell: (id) cell 713 forTableColumn: (NSTableColumn *) tableColumn item: (id) item719 forTableColumn: (NSTableColumn *) tableColumn item: (id) item 714 720 { 715 721 if ([[tableColumn identifier] isEqualToString: @"Name"]) … … 724 730 else if ([[tableColumn identifier] isEqualToString: @"Check"]) 725 731 { 726 /*[(NSButtonCell *)cell setImagePosition: item ? NSImageOnly : NSNoImage]; 727 [cell setEnabled: NO];*/ 732 /*if (!item) 733 { 734 [(NSButtonCell *)cell setImagePosition: NSNoImage]; 735 [cell setEnabled: NO]; 736 return; 737 } 738 739 [(NSButtonCell *)cell setImagePosition: NSImageOnly]; 740 [cell setEnabled: [[item objectForKey: @"IsFolder"] boolValue] ? [[item objectForKey: @"Remaining"] intValue] > 0 741 : [[item objectForKey: @"Progress"] floatValue] < 1.0];*/ 728 742 [(NSButtonCell *)cell setImagePosition: NSNoImage]; 729 743 } … … 737 751 738 752 [self setFileCheckState: state forItem: item]; 753 NSMutableDictionary * topItem = [self resetFileCheckStateForItemParent: item]; 754 755 [fFileOutline reloadItem: topItem reloadChildren: YES]; 756 } 757 758 - (void) fileFinished: (NSNotification *) notification 759 { 760 NSMutableDictionary * item = [notification object]; 761 762 [item setObject: [NSNumber numberWithInt: NSOnState] forKey: @"Check"]; 739 763 NSMutableDictionary * topItem = [self resetFileCheckStateForItemParent: item]; 740 764 -
trunk/macosx/Torrent.h
r1512 r1514 173 173 - (float) swarmSpeed; 174 174 175 - ( void) updateFileProgress;175 - (BOOL) updateFileProgress; 176 176 177 177 - (NSNumber *) orderValue; -
trunk/macosx/Torrent.m
r1512 r1514 1044 1044 } 1045 1045 1046 - (void) updateFileProgress 1047 { 1048 float * progress = tr_torrentCompletion( fHandle ); 1046 - (BOOL) updateFileProgress 1047 { 1048 BOOL change = NO; 1049 float * progress = tr_torrentCompletion(fHandle); 1050 NSNumber * progressNum; 1051 NSMutableDictionary * item, * dict; 1049 1052 1050 1053 int i, fileCount = [self fileCount]; 1051 1054 for (i = 0; i < fileCount; i++) 1052 [[fFileFlatList objectAtIndex: i] setObject: [NSNumber numberWithFloat: progress[i]] forKey: @"Progress"]; 1055 { 1056 if (!(progressNum = [[fFileFlatList objectAtIndex: i] objectForKey: @"Progress"]) 1057 || [progressNum floatValue] != progress[i]) 1058 { 1059 item = [fFileFlatList objectAtIndex: i]; 1060 [item setObject: [NSNumber numberWithFloat: progress[i]] forKey: @"Progress"]; 1061 change = YES; 1062 1063 if (progress[i] == 1.0) 1064 { 1065 dict = item; 1066 while ((dict = [dict objectForKey: @"Parent"])) 1067 [dict setObject: [NSNumber numberWithInt: [[dict objectForKey: @"Remaining"] intValue]-1] 1068 forKey: @"Remaining"]; 1069 1070 [[NSNotificationCenter defaultCenter] postNotificationName: @"FileFinished" object: item]; 1071 } 1072 } 1073 } 1053 1074 1054 1075 free(progress); 1076 1077 return change; 1055 1078 } 1056 1079 … … 1257 1280 1258 1281 if (isFolder) 1282 { 1259 1283 [dict setObject: [NSMutableArray array] forKey: @"Children"]; 1284 [dict setObject: [NSNumber numberWithInt: 1] forKey: @"Remaining"]; 1285 } 1260 1286 else 1261 1287 { … … 1270 1296 else 1271 1297 { 1298 if (isFolder) 1299 [dict setObject: [NSNumber numberWithInt: [[dict objectForKey: @"Remaining"] intValue]+1] forKey: @"Remaining"]; 1300 1272 1301 int dictState = [[dict objectForKey: @"Check"] intValue]; 1273 1302 if (dictState != NSMixedState && dictState != state)
Note: See TracChangeset
for help on using the changeset viewer.