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:
parent
685d04fa56
commit
bb16b6b4e2
1 changed files with 4 additions and 9 deletions
|
@ -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];
|
||||
|
||||
|
|
Loading…
Reference in a new issue