1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 16:52:39 +00:00

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

This commit is contained in:
Mitchell Livingston 2007-07-13 03:11:50 +00:00
parent 35dc48dc1d
commit 5975ae7a59

View file

@ -613,20 +613,13 @@
return NO; return NO;
Torrent * torrent = [fTorrents objectAtIndex: 0]; Torrent * torrent = [fTorrents objectAtIndex: 0];
NSIndexSet * indexSet = [fFileOutline selectedRowIndexes], * itemIndexes; NSIndexSet * indexSet = [fFileOutline selectedRowIndexes];
NSMutableIndexSet * usedIndexes = [NSMutableIndexSet indexSet]; NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
int i, index, state = (menuItem == fFileCheckItem) ? NSOnState : NSOffState; int i, index, state = (menuItem == fFileCheckItem) ? NSOnState : NSOffState;
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
{ [itemIndexes addIndexes: [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"]];
itemIndexes = [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"];
if (![usedIndexes containsIndexes: itemIndexes]) return [torrent checkForFiles: itemIndexes] != state && [torrent canChangeDownloadCheckForFiles: itemIndexes];
{
if ([torrent checkForFiles: itemIndexes] != state && [torrent canChangeDownloadCheckForFiles: itemIndexes])
return YES;
[usedIndexes addIndexes: itemIndexes];
}
}
return NO;
} }
if (action == @selector(setOnlySelectedCheck:)) if (action == @selector(setOnlySelectedCheck:))
@ -635,20 +628,13 @@
return NO; return NO;
Torrent * torrent = [fTorrents objectAtIndex: 0]; Torrent * torrent = [fTorrents objectAtIndex: 0];
NSIndexSet * indexSet = [fFileOutline selectedRowIndexes], * itemIndexes; NSIndexSet * indexSet = [fFileOutline selectedRowIndexes];
NSMutableIndexSet * usedIndexes = [NSMutableIndexSet indexSet]; NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
int i, index; int i, index;
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
{ [itemIndexes addIndexes: [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"]];
itemIndexes = [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"];
if (![usedIndexes containsIndexes: itemIndexes]) return [torrent canChangeDownloadCheckForFiles: itemIndexes];
{
if ([torrent canChangeDownloadCheckForFiles: itemIndexes])
return YES;
[usedIndexes addIndexes: itemIndexes];
}
}
return NO;
} }
if (action == @selector(setPriority:)) if (action == @selector(setPriority:))