Changeset 7505
- Timestamp:
- Dec 26, 2008, 12:16:19 AM (12 years ago)
- Location:
- trunk/macosx
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/Controller.m
r7468 r7505 2114 2114 if (groupRows) 2115 2115 { 2116 NSArray * oldTorrentGroups = nil; 2117 if ([fDisplayedTorrents count] > 0 && [[fDisplayedTorrents objectAtIndex: 0] isKindOfClass: [TorrentGroup class]]) 2118 oldTorrentGroups = [NSArray arrayWithArray: fDisplayedTorrents]; 2119 2116 2120 [fDisplayedTorrents removeAllObjects]; 2117 2121 … … 2120 2124 2121 2125 NSMutableArray * groupTorrents; 2122 for (NSInteger i = 0, oldGroupValue = -2; i < [allTorrents count]; i++) 2123 { 2124 torrent = [allTorrents objectAtIndex: i]; 2126 NSInteger lastGroupValue = -2, currentOldGroupIndex = 0; 2127 NSEnumerator * enumerator = [allTorrents objectEnumerator]; 2128 while ((torrent = [enumerator nextObject])) 2129 { 2125 2130 NSInteger groupValue = [torrent groupValue]; 2126 if (groupValue != oldGroupValue)2131 if (groupValue != lastGroupValue) 2127 2132 { 2128 TorrentGroup * group = [[TorrentGroup alloc] initWithGroup: groupValue]; 2133 TorrentGroup * group = nil; 2134 2135 //try to see if the group already exists 2136 for (; oldTorrentGroups && currentOldGroupIndex < [oldTorrentGroups count]; currentOldGroupIndex++) 2137 { 2138 TorrentGroup * currentGroup = [oldTorrentGroups objectAtIndex: currentOldGroupIndex]; 2139 if ([currentGroup groupIndex] == groupValue) 2140 { 2141 group = currentGroup; 2142 [[currentGroup torrents] removeAllObjects]; 2143 break; 2144 } 2145 } 2146 2147 if (!group) 2148 group = [[[TorrentGroup alloc] initWithGroup: groupValue] autorelease]; 2149 [fDisplayedTorrents addObject: group]; 2150 2129 2151 groupTorrents = [group torrents]; 2130 2152 2131 [fDisplayedTorrents addObject: group]; 2132 [group release]; 2133 2134 oldGroupValue = groupValue; 2153 lastGroupValue = groupValue; 2135 2154 } 2136 2155 -
trunk/macosx/NSStringAdditions.m
r7032 r7505 148 148 - (NSComparisonResult) compareFinder: (NSString *) string 149 149 { 150 NSInteger comparisonOptions = [NSApp isOnLeopardOrBetter] ? (NSCaseInsensitiveSearch | NSNumericSearch151 152 150 const NSInteger comparisonOptions = [NSApp isOnLeopardOrBetter] 151 ? (NSCaseInsensitiveSearch | NSNumericSearch | NSWidthInsensitiveSearch | NSForcedOrderingSearch) 152 : (NSCaseInsensitiveSearch | NSNumericSearch); 153 153 return [self compare: string options: comparisonOptions range: NSMakeRange(0, [self length]) locale: [NSLocale currentLocale]]; 154 154 } … … 156 156 - (NSComparisonResult) compareNumeric: (NSString *) string 157 157 { 158 NSInteger comparisonOptions = [NSApp isOnLeopardOrBetter] ? (NSNumericSearch | NSForcedOrderingSearch) : NSNumericSearch;158 const NSInteger comparisonOptions = [NSApp isOnLeopardOrBetter] ? (NSNumericSearch | NSForcedOrderingSearch) : NSNumericSearch; 159 159 return [self compare: string options: comparisonOptions range: NSMakeRange(0, [self length]) locale: [NSLocale currentLocale]]; 160 160 }
Note: See TracChangeset
for help on using the changeset viewer.