Changeset 14119


Ignore:
Timestamp:
Jul 14, 2013, 2:35:57 PM (8 years ago)
Author:
livings124
Message:

Simplify the torrent complete callback method.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Torrent.m

    r14118 r14119  
    5050
    5151- (void) startQueue;
    52 - (void) completenessChange: (NSDictionary *) statusInfo;
     52- (void) completenessChange: (tr_completeness) status wasRunning: (BOOL) wasRunning;
    5353- (void) ratioLimitHit;
    5454- (void) idleLimitHit;
     
    7373{
    7474    dispatch_async(dispatch_get_main_queue(), ^{
    75         NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt: status], @"Status",
    76                                [NSNumber numberWithBool: wasRunning], @"WasRunning", nil];
    77         [(Torrent *)torrentData completenessChange: dict];
     75        [(Torrent *)torrentData completenessChange: status wasRunning: wasRunning];
    7876    });
    7977}
     
    18271825
    18281826//status has been retained
    1829 - (void) completenessChange: (NSDictionary *) statusInfo
     1827- (void) completenessChange: (tr_completeness) status wasRunning: (BOOL) wasRunning
    18301828{
    18311829    fStat = tr_torrentStat(fHandle); //don't call update yet to avoid auto-stop
    18321830   
    1833     switch ([[statusInfo objectForKey: @"Status"] intValue])
     1831    switch (status)
    18341832    {
    18351833        case TR_SEED:
    18361834        case TR_PARTIAL_SEED:
    1837             [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedDownloading" object: self userInfo: [[statusInfo retain] autorelease]];
     1835        {
     1836            NSDictionary * statusInfo = @{ @"Status" : @(status), @"WasRunning" : @(wasRunning) };
     1837            [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedDownloading" object: self userInfo: statusInfo];
    18381838           
    18391839            //quarantine the finished data
     
    18501850           
    18511851            break;
    1852        
     1852        }
    18531853        case TR_LEECH:
    18541854            [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentRestartedDownloading" object: self];
    18551855            break;
    18561856    }
    1857     [statusInfo release];
    18581857   
    18591858    [self update];
Note: See TracChangeset for help on using the changeset viewer.