Changeset 7521


Ignore:
Timestamp:
Dec 29, 2008, 2:39:41 AM (12 years ago)
Author:
livings124
Message:

small streamline of filter code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r7513 r7521  
    18071807{
    18081808    NSString * sortType = [fDefaults stringForKey: @"Sort"];
    1809     BOOL asc = ![fDefaults boolForKey: @"SortReverse"];
     1809    const BOOL asc = ![fDefaults boolForKey: @"SortReverse"];
    18101810   
    18111811    NSSortDescriptor * orderDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"orderValue" ascending: asc] autorelease];
     
    18861886    //get all the torrents in the table
    18871887    NSMutableArray * previousTorrents;
    1888     if ([fDisplayedTorrents count] > 0 && ![[fDisplayedTorrents objectAtIndex: 0] isKindOfClass: [Torrent class]])
     1888    if ([fDisplayedTorrents count] > 0 && [[fDisplayedTorrents objectAtIndex: 0] isKindOfClass: [TorrentGroup class]])
    18891889    {
    18901890        previousTorrents = [NSMutableArray array];
     
    19191919        filterTracker = filterText && [[fDefaults stringForKey: @"FilterSearchType"] isEqualToString: FILTER_TYPE_TRACKER];
    19201920   
    1921     NSMutableIndexSet * indexes = [NSMutableIndexSet indexSet];
     1921    NSMutableArray * allTorrents = [NSMutableArray arrayWithCapacity: [fTorrents count]];
    19221922   
    19231923    //get count of each type
    1924     NSInteger index = -1;
    19251924    for (Torrent * torrent in fTorrents)
    19261925    {
    1927         index++;
    1928        
    19291926        //check status
    19301927        if ([torrent isActive] && ![torrent isCheckingWaiting])
     
    19881985        }
    19891986       
    1990         [indexes addIndex: index];
    1991     }
    1992    
    1993     NSArray * allTorrents = [fTorrents objectsAtIndexes: indexes];
     1987        [allTorrents addObject: torrent];
     1988    }
    19941989   
    19951990    //set button tooltips
     
    20162011       
    20172012        NSSortDescriptor * groupDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"groupOrderValue" ascending: YES] autorelease];
    2018         allTorrents = [allTorrents sortedArrayUsingDescriptors: [NSArray arrayWithObject: groupDescriptor]];
     2013        [allTorrents sortUsingDescriptors: [NSArray arrayWithObject: groupDescriptor]];
    20192014       
    20202015        NSMutableArray * groupTorrents;
Note: See TracChangeset for help on using the changeset viewer.