Changeset 1519
- Timestamp:
- Mar 2, 2007, 1:34:06 AM (15 years ago)
- Location:
- trunk/macosx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/InfoWindowController.m
r1514 r1519 61 61 - (NSArray *) peerSortDescriptors; 62 62 63 - (void) setFileCheckState: (int) state forItem: (NSMutableDictionary *) item;64 - (NSMutableDictionary *) resetFileCheckStateForItemParent: (NSMutableDictionary *) originalChild;65 66 63 - (int) stateSettingToPopUpIndex: (int) index; 67 64 - (int) popUpIndexToStateSetting: (int) index; … … 108 105 [fFileOutline setDoubleAction: @selector(revealFile:)]; 109 106 110 [[NSNotificationCenter defaultCenter] addObserver: self111 selector: @selector(fileFinished:) name: @"FileFinished" object: nil];112 113 107 //set blank inspector 114 108 [self updateInfoForTorrents: [NSArray array]]; … … 117 111 - (void) dealloc 118 112 { 119 [[NSNotificationCenter defaultCenter] removeObserver: self];120 121 113 if (fTorrents) 122 114 [fTorrents release]; … … 730 722 else if ([[tableColumn identifier] isEqualToString: @"Check"]) 731 723 { 732 /*if (!item)724 if (!item) 733 725 { 734 726 [(NSButtonCell *)cell setImagePosition: NSNoImage]; … … 739 731 [(NSButtonCell *)cell setImagePosition: NSImageOnly]; 740 732 [cell setEnabled: [[item objectForKey: @"IsFolder"] boolValue] ? [[item objectForKey: @"Remaining"] intValue] > 0 741 : [[item objectForKey: @"Progress"] floatValue] < 1.0]; */742 [(NSButtonCell *)cell setImagePosition: NSNoImage];733 : [[item objectForKey: @"Progress"] floatValue] < 1.0]; 734 //[(NSButtonCell *)cell setImagePosition: NSNoImage]; 743 735 } 744 736 else; … … 748 740 forTableColumn: (NSTableColumn *) tableColumn byItem: (id) item 749 741 { 742 Torrent * torrent = [fTorrents objectAtIndex: 0]; 750 743 int state = [object intValue] != NSOffState ? NSOnState : NSOffState; 751 744 752 [ self setFileCheckState: state forItem: item];753 NSMutableDictionary * topItem = [ selfresetFileCheckStateForItemParent: item];745 [torrent setFileCheckState: state forFileItem: item]; 746 NSMutableDictionary * topItem = [torrent resetFileCheckStateForItemParent: item]; 754 747 755 748 [fFileOutline reloadItem: topItem reloadChildren: YES]; 756 }757 758 - (void) fileFinished: (NSNotification *) notification759 {760 NSMutableDictionary * item = [notification object];761 762 [item setObject: [NSNumber numberWithInt: NSOnState] forKey: @"Check"];763 NSMutableDictionary * topItem = [self resetFileCheckStateForItemParent: item];764 765 [fFileOutline reloadItem: topItem reloadChildren: YES];766 }767 768 - (void) setFileCheckState: (int) state forItem: (NSMutableDictionary *) item769 {770 [item setObject: [NSNumber numberWithInt: state] forKey: @"Check"];771 772 if (![[item objectForKey: @"IsFolder"] boolValue])773 return;774 775 NSMutableDictionary * child;776 NSEnumerator * enumerator = [[item objectForKey: @"Children"] objectEnumerator];777 while ((child = [enumerator nextObject]))778 if (state != [[child objectForKey: @"Check"] intValue])779 [self setFileCheckState: state forItem: child];780 }781 782 - (NSMutableDictionary *) resetFileCheckStateForItemParent: (NSMutableDictionary *) originalChild783 {784 NSMutableDictionary * item;785 if (!(item = [originalChild objectForKey: @"Parent"]))786 return originalChild;787 788 int state = INVALID;789 790 NSMutableDictionary * child;791 NSEnumerator * enumerator = [[item objectForKey: @"Children"] objectEnumerator];792 while ((child = [enumerator nextObject]))793 {794 if (state == INVALID)795 {796 state = [[child objectForKey: @"Check"] intValue];797 if (state == NSMixedState)798 break;799 }800 else if (state != [[child objectForKey: @"Check"] intValue])801 {802 state = NSMixedState;803 break;804 }805 else;806 }807 808 if (state != [[item objectForKey: @"Check"] intValue])809 {810 [item setObject: [NSNumber numberWithInt: state] forKey: @"Check"];811 return [self resetFileCheckStateForItemParent: item];812 }813 else814 return originalChild;815 749 } 816 750 -
trunk/macosx/Torrent.h
r1514 r1519 173 173 - (float) swarmSpeed; 174 174 175 - (BOOL) updateFileProgress;176 177 175 - (NSNumber *) orderValue; 178 176 - (void) setOrderValue: (int) orderValue; … … 180 178 - (NSArray *) fileList; 181 179 - (int) fileCount; 180 - (BOOL) updateFileProgress; 181 - (void) setFileCheckState: (int) state forFileItem: (NSMutableDictionary *) item; 182 - (NSMutableDictionary *) resetFileCheckStateForItemParent: (NSMutableDictionary *) originalChild; 182 183 183 184 - (NSDate *) date; -
trunk/macosx/Torrent.m
r1517 r1519 30 30 #define MAX_PIECES 324 31 31 #define BLANK_PIECE -99 32 33 #define INVALID -99 32 34 33 35 @interface Torrent (Private) … … 1044 1046 } 1045 1047 1048 - (NSNumber *) orderValue 1049 { 1050 return [NSNumber numberWithInt: fOrderValue]; 1051 } 1052 1053 - (void) setOrderValue: (int) orderValue 1054 { 1055 fOrderValue = orderValue; 1056 } 1057 1058 - (NSArray *) fileList 1059 { 1060 return fFileList; 1061 } 1062 1063 - (int) fileCount 1064 { 1065 return fInfo->fileCount; 1066 } 1067 1046 1068 - (BOOL) updateFileProgress 1047 1069 { … … 1068 1090 forKey: @"Remaining"]; 1069 1091 1070 [[NSNotificationCenter defaultCenter] postNotificationName: @"FileFinished" object: item]; 1092 [item setObject: [NSNumber numberWithInt: NSOnState] forKey: @"Check"]; 1093 [self resetFileCheckStateForItemParent: item]; 1071 1094 } 1072 1095 } … … 1078 1101 } 1079 1102 1080 - (NSNumber *) orderValue 1081 { 1082 return [NSNumber numberWithInt: fOrderValue]; 1083 } 1084 1085 - (void) setOrderValue: (int) orderValue 1086 { 1087 fOrderValue = orderValue; 1088 } 1089 1090 - (NSArray *) fileList 1091 { 1092 return fFileList; 1093 } 1094 1095 - (int) fileCount 1096 { 1097 return fInfo->fileCount; 1103 - (void) setFileCheckState: (int) state forFileItem: (NSMutableDictionary *) item 1104 { 1105 [item setObject: [NSNumber numberWithInt: state] forKey: @"Check"]; 1106 1107 if (![[item objectForKey: @"IsFolder"] boolValue]) 1108 return; 1109 1110 NSMutableDictionary * child; 1111 NSEnumerator * enumerator = [[item objectForKey: @"Children"] objectEnumerator]; 1112 while ((child = [enumerator nextObject])) 1113 if (state != [[child objectForKey: @"Check"] intValue]) 1114 [self setFileCheckState: state forFileItem: child]; 1115 } 1116 1117 - (NSMutableDictionary *) resetFileCheckStateForItemParent: (NSMutableDictionary *) originalChild 1118 { 1119 NSMutableDictionary * item; 1120 if (!(item = [originalChild objectForKey: @"Parent"])) 1121 return originalChild; 1122 1123 int state = INVALID; 1124 1125 NSMutableDictionary * child; 1126 NSEnumerator * enumerator = [[item objectForKey: @"Children"] objectEnumerator]; 1127 while ((child = [enumerator nextObject])) 1128 { 1129 if (state == INVALID) 1130 { 1131 state = [[child objectForKey: @"Check"] intValue]; 1132 if (state == NSMixedState) 1133 break; 1134 } 1135 else if (state != [[child objectForKey: @"Check"] intValue]) 1136 { 1137 state = NSMixedState; 1138 break; 1139 } 1140 else; 1141 } 1142 1143 if (state != [[item objectForKey: @"Check"] intValue]) 1144 { 1145 [item setObject: [NSNumber numberWithInt: state] forKey: @"Check"]; 1146 return [self resetFileCheckStateForItemParent: item]; 1147 } 1148 else 1149 return originalChild; 1098 1150 } 1099 1151
Note: See TracChangeset
for help on using the changeset viewer.