Changeset 499


Ignore:
Timestamp:
Jul 1, 2006, 10:13:29 PM (17 years ago)
Author:
livings124
Message:

Slight cleanup from last commit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r498 r499  
    10701070        return;
    10711071    else;
    1072 
    1073     //sort torrents by order value
    1074     NSArray * sortedTorrents;
    1075     if ([torrents count] > 1)
    1076     {
    1077         NSSortDescriptor * orderDescriptor = [[[NSSortDescriptor alloc] initWithKey:
    1078                                                     @"orderValue" ascending: YES] autorelease];
    1079         NSArray * descriptors = [[NSArray alloc] initWithObjects: orderDescriptor, nil];
    1080                    
    1081         sortedTorrents = [torrents sortedArrayUsingDescriptors: descriptors];
    1082         [descriptors release];
    1083     }
    1084     else
    1085         sortedTorrents = torrents;
    1086 
     1072   
     1073    //determine the number of downloads needed to start
    10871074    int desiredActive = [fDefaults integerForKey: @"WaitToStartNumber"];
    10881075           
     1076    NSEnumerator * enumerator = [fTorrents objectEnumerator];
    10891077    Torrent * torrent;
    1090     NSEnumerator * enumerator = [fTorrents objectEnumerator];
    10911078    while ((torrent = [enumerator nextObject]))
    10921079        if ([torrent isActive] && ![torrent isSeeding])
     
    10961083                break;
    10971084        }
     1085   
     1086    //sort torrents by order value
     1087    NSArray * sortedTorrents;
     1088    if ([torrents count] > 1 && desiredActive > 0)
     1089    {
     1090        NSSortDescriptor * orderDescriptor = [[[NSSortDescriptor alloc] initWithKey:
     1091                                                    @"orderValue" ascending: YES] autorelease];
     1092        NSArray * descriptors = [[NSArray alloc] initWithObjects: orderDescriptor, nil];
     1093                   
     1094        sortedTorrents = [torrents sortedArrayUsingDescriptors: descriptors];
     1095        [descriptors release];
     1096    }
     1097    else
     1098        sortedTorrents = torrents;
    10981099
    10991100    enumerator = [sortedTorrents objectEnumerator];
Note: See TracChangeset for help on using the changeset viewer.