Changeset 2336


Ignore:
Timestamp:
Jul 13, 2007, 3:11:50 AM (15 years ago)
Author:
livings124
Message:

simplify some file view code...speed difference should be negligible

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoWindowController.m

    r2327 r2336  
    614614       
    615615        Torrent * torrent = [fTorrents objectAtIndex: 0];
    616         NSIndexSet * indexSet = [fFileOutline selectedRowIndexes], * itemIndexes;
    617         NSMutableIndexSet * usedIndexes = [NSMutableIndexSet indexSet];
     616        NSIndexSet * indexSet = [fFileOutline selectedRowIndexes];
     617        NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
    618618        int i, index, state = (menuItem == fFileCheckItem) ? NSOnState : NSOffState;
    619619        for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
    620         {
    621             itemIndexes = [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"];
    622             if (![usedIndexes containsIndexes: itemIndexes])
    623             {
    624                 if ([torrent checkForFiles: itemIndexes] != state && [torrent canChangeDownloadCheckForFiles: itemIndexes])
    625                     return YES;
    626                 [usedIndexes addIndexes: itemIndexes];
    627             }
    628         }
    629         return NO;
     620            [itemIndexes addIndexes: [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"]];
     621       
     622        return [torrent checkForFiles: itemIndexes] != state && [torrent canChangeDownloadCheckForFiles: itemIndexes];
    630623    }
    631624   
     
    636629       
    637630        Torrent * torrent = [fTorrents objectAtIndex: 0];
    638         NSIndexSet * indexSet = [fFileOutline selectedRowIndexes], * itemIndexes;
    639         NSMutableIndexSet * usedIndexes = [NSMutableIndexSet indexSet];
     631        NSIndexSet * indexSet = [fFileOutline selectedRowIndexes];
     632        NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
    640633        int i, index;
    641634        for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
    642         {
    643             itemIndexes = [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"];
    644             if (![usedIndexes containsIndexes: itemIndexes])
    645             {
    646                 if ([torrent canChangeDownloadCheckForFiles: itemIndexes])
    647                     return YES;
    648                 [usedIndexes addIndexes: itemIndexes];
    649             }
    650         }
    651         return NO;
     635            [itemIndexes addIndexes: [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"]];
     636           
     637        return [torrent canChangeDownloadCheckForFiles: itemIndexes];
    652638    }
    653639   
Note: See TracChangeset for help on using the changeset viewer.