1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-31 03:12:44 +00:00

improve how we search the message window's message array

This commit is contained in:
Mitchell Livingston 2012-01-08 17:05:12 +00:00
parent 685d04fa56
commit bb16b6b4e2

View file

@ -442,16 +442,11 @@
const NSInteger level = [[NSUserDefaults standardUserDefaults] integerForKey: @"MessageLevel"];
NSString * filterString = [fFilterField stringValue];
NSMutableArray * tempMessages = [NSMutableArray arrayWithCapacity: [fMessages count]]; //rough guess
NSIndexSet * indexes = [fMessages indexesOfObjectsWithOptions: NSEnumerationConcurrent passingTest: ^BOOL(id message, NSUInteger idx, BOOL * stop) {
return [[(NSDictionary *)message objectForKey: @"Level"] integerValue] <= level && [self shouldIncludeMessageForFilter: filterString message: message];
}];
for (NSDictionary * message in fMessages)
{
if ([[message objectForKey: @"Level"] integerValue] <= level
&& [self shouldIncludeMessageForFilter: filterString message: message])
[tempMessages addObject: message];
}
[tempMessages sortUsingDescriptors: [fMessageTable sortDescriptors]];
NSArray * tempMessages = [[fMessages objectsAtIndexes: indexes] sortedArrayUsingDescriptors: [fMessageTable sortDescriptors]];
const BOOL onLion = [NSApp isOnLionOrBetter];