Changeset 10861


Ignore:
Timestamp:
Jun 25, 2010, 10:19:28 PM (12 years ago)
Author:
livings124
Message:

#3320 When a download completes at the same time seeding completes, still show a Growl notification and play a sound

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r10559 r10861  
    18891889    Torrent * torrent = [notification object];
    18901890   
    1891     if ([torrent isActive])
     1891    if ([[[notification userInfo] objectForKey: @"WasRunning"] boolValue])
    18921892    {
    18931893        if (!fSoundPlaying && [fDefaults boolForKey: @"PlayDownloadSound"])
     
    19191919            object: [torrent dataLocation]];
    19201920       
    1921         if ([fDefaults boolForKey: @"QueueSeed"] && [self numToStartFromQueue: NO] == 0)
     1921        if ([torrent isActive] && [fDefaults boolForKey: @"QueueSeed"] && [self numToStartFromQueue: NO] == 0)
    19221922        {
    19231923            [torrent stopTransfer];
     
    19321932{
    19331933    Torrent * torrent = [notification object];
    1934     if ([torrent isActive])
    1935     {
    1936         if ([fDefaults boolForKey: @"Queue"] && [self numToStartFromQueue: YES] == 0)
    1937         {
    1938             [torrent stopTransfer];
    1939             [torrent setWaitToStart: YES];
    1940         }
     1934    if ([torrent isActive] && [fDefaults boolForKey: @"Queue"] && [self numToStartFromQueue: YES] == 0)
     1935    {
     1936        [torrent stopTransfer];
     1937        [torrent setWaitToStart: YES];
    19411938    }
    19421939   
  • trunk/macosx/Torrent.m

    r10832 r10861  
    4444    index: (NSInteger) index flatList: (NSMutableArray *) flatFileList;
    4545
    46 - (void) completenessChange: (NSNumber *) status;
     46- (void) completenessChange: (NSDictionary *) statusInfo;
    4747- (void) ratioLimitHit;
    4848- (void) metadataRetrieved;
     
    5454@end
    5555
    56 void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, void * torrentData)
    57 {
    58     [(Torrent *)torrentData performSelectorOnMainThread: @selector(completenessChange:)
    59         withObject: [[NSNumber alloc] initWithInt: status] waitUntilDone: NO];
     56void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, tr_bool wasRunning, void * torrentData)
     57{
     58    NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithInt: status], @"Status",
     59                            [NSNumber numberWithBool: wasRunning], @"WasRunning", nil];
     60    [(Torrent *)torrentData performSelectorOnMainThread: @selector(completenessChange:) withObject: dict waitUntilDone: NO];
    6061}
    6162
     
    17441745
    17451746//status has been retained
    1746 - (void) completenessChange: (NSNumber *) status
     1747- (void) completenessChange: (NSDictionary *) statusInfo
    17471748{
    17481749    fStat = tr_torrentStat(fHandle); //don't call update yet to avoid auto-stop
    17491750   
    1750     switch ([status intValue])
     1751    switch ([[statusInfo objectForKey: @"Status"] intValue])
    17511752    {
    17521753        case TR_SEED:
    17531754        case TR_PARTIAL_SEED:
    1754             [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedDownloading" object: self];
     1755            //simpler to create a new dictionary than to use statusInfo - avoids retention chicanery
     1756            [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedDownloading" object: self
     1757                userInfo: [NSDictionary dictionaryWithObject: [statusInfo objectForKey: @"WasRunning"] forKey: @"WasRunning"]];
    17551758            break;
    17561759       
     
    17591762            break;
    17601763    }
    1761     [status release];
     1764    [statusInfo release];
    17621765   
    17631766    [self update];
Note: See TracChangeset for help on using the changeset viewer.