Changeset 2335


Ignore:
Timestamp:
Jul 13, 2007, 2:57:20 AM (15 years ago)
Author:
livings124
Message:

use new functions for setting multiple file dl/priorities

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/FileOutlineView.m

    r2318 r2335  
    106106        Torrent * torrent = [(InfoWindowController *)[[self window] windowController] selectedTorrent];
    107107       
    108         if ([[item objectForKey: @"IsFolder"] boolValue]
    109                 || ![torrent canChangeDownloadCheckForFiles: [item objectForKey: @"Indexes"]])
     108        NSIndexSet * indexSet = [item objectForKey: @"Indexes"];
     109        if ([[item objectForKey: @"IsFolder"] boolValue] || ![torrent canChangeDownloadCheckForFiles: indexSet])
    110110            [fNormalColor set];
    111111        else
    112112        {
    113             NSIndexSet * indexSet = [item objectForKey: @"Indexes"];
    114113            if ([torrent hasFilePriority: TR_PRI_HIGH forIndexes: indexSet])
    115114                [fHighPriorityColor set];
  • trunk/macosx/Torrent.m

    r2327 r2335  
    148148                    [NSNumber numberWithInt: fDownloadLimit], @"DownloadLimit",
    149149                    [NSNumber numberWithBool: fWaitToStart], @"WaitToStart",
    150                     [self orderValue], @"OrderValue",
    151                     nil];
     150                    [self orderValue], @"OrderValue", nil];
    152151   
    153152    if (fIncompleteFolder)
     
    13141313- (void) setFileCheckState: (int) state forIndexes: (NSIndexSet *) indexSet
    13151314{
    1316     #warning multiples
    1317     int index;
     1315    int count = [indexSet count], i = 0, index;
     1316    int * files = malloc(count * sizeof(int));
     1317   
    13181318    for (index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex: index])
    1319         tr_torrentSetFileDL(fHandle, index, state != NSOffState);
     1319    {
     1320        files[i] = index;
     1321        i++;
     1322    }
     1323    tr_torrentSetFileDLs(fHandle, files, count, state != NSOffState);
     1324    free(files);
    13201325   
    13211326    [self update];
     
    13261331- (void) setFilePriority: (int) priority forIndexes: (NSIndexSet *) indexSet
    13271332{
    1328     #warning multiples
    1329     int index;
     1333    int count = [indexSet count], i = 0, index;
     1334    int * files = malloc(count * sizeof(int));
     1335   
    13301336    for (index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex: index])
    1331         tr_torrentSetFilePriority(fHandle, index, priority);
     1337    {
     1338        files[i] = index;
     1339        i++;
     1340    }
     1341
     1342    tr_torrentSetFilePriorities(fHandle, files, count, priority);
     1343    free(files);
    13321344}
    13331345
Note: See TracChangeset for help on using the changeset viewer.