1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 09:13:06 +00:00

insignificant filtering improvements

This commit is contained in:
Mitchell Livingston 2008-02-11 00:16:47 +00:00
parent 27adbf8ba8
commit b223f16bde

View file

@ -1804,7 +1804,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
[previousTorrents addObjectsFromArray: [dict objectForKey: @"Torrents"]]; [previousTorrents addObjectsFromArray: [dict objectForKey: @"Torrents"]];
} }
else else
previousTorrents = [NSMutableArray arrayWithArray: fDisplayedTorrents]; previousTorrents = fDisplayedTorrents;
NSArray * selectedValues = [fTableView selectedValues]; NSArray * selectedValues = [fTableView selectedValues];
@ -1908,7 +1908,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
[indexes addIndex: i]; [indexes addIndex: i];
} }
[fDisplayedTorrents setArray: [fTorrents objectsAtIndexes: indexes]]; NSArray * allTorrents = [fTorrents objectsAtIndexes: indexes];
//set button tooltips //set button tooltips
[fNoFilterButton setCount: [fTorrents count]]; [fNoFilterButton setCount: [fTorrents count]];
@ -1918,7 +1918,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
[fPauseFilterButton setCount: paused]; [fPauseFilterButton setCount: paused];
//clear display cache for not-shown torrents //clear display cache for not-shown torrents
[previousTorrents removeObjectsInArray: fDisplayedTorrents]; [previousTorrents removeObjectsInArray: allTorrents];
enumerator = [previousTorrents objectEnumerator]; enumerator = [previousTorrents objectEnumerator];
while ((torrent = [enumerator nextObject])) while ((torrent = [enumerator nextObject]))
[torrent setPreviousAmountFinished: NULL]; [torrent setPreviousAmountFinished: NULL];
@ -1928,13 +1928,13 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
if (groupRows) if (groupRows)
{ {
NSSortDescriptor * groupDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"groupOrderValue" ascending: YES] autorelease]; NSSortDescriptor * groupDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"groupOrderValue" ascending: YES] autorelease];
[fDisplayedTorrents sortUsingDescriptors: [NSArray arrayWithObject: groupDescriptor]]; allTorrents = [allTorrents sortedArrayUsingDescriptors: [NSArray arrayWithObject: groupDescriptor]];
NSMutableArray * groups = [NSMutableArray array], * groupTorrents; NSMutableArray * groups = [NSMutableArray array], * groupTorrents;
int oldGroupValue = -2; int oldGroupValue = -2;
for (i = 0; i < [fDisplayedTorrents count]; i++) for (i = 0; i < [allTorrents count]; i++)
{ {
Torrent * torrent = [fDisplayedTorrents objectAtIndex: i]; Torrent * torrent = [allTorrents objectAtIndex: i];
int groupValue = [torrent groupValue]; int groupValue = [torrent groupValue];
if (groupValue != oldGroupValue) if (groupValue != oldGroupValue)
{ {
@ -1951,6 +1951,8 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
[fDisplayedTorrents setArray: groups]; [fDisplayedTorrents setArray: groups];
} }
else
[fDisplayedTorrents setArray: allTorrents];
//actually sort //actually sort
[self sortTorrentsIgnoreSelected]; [self sortTorrentsIgnoreSelected];