Changeset 11178


Ignore:
Timestamp:
Aug 14, 2010, 7:44:43 PM (12 years ago)
Author:
livings124
Message:

don't set an idle eta if the transfer is currently uploading

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r11174 r11178  
    11871187            }
    11881188
    1189             if( tr_torrentGetSeedIdle( tor, &seedIdleMinutes ) )
     1189            if( tor->etaULSpeed_KBps < 1 && tr_torrentGetSeedIdle( tor, &seedIdleMinutes ) )
    11901190                s->etaIdle = seedIdleMinutes * 60 - s->idleSecs;
    11911191            else
  • trunk/macosx/Controller.h

    r10465 r11178  
    200200- (void) torrentFinishedDownloading: (NSNotification *) notification;
    201201- (void) torrentRestartedDownloading: (NSNotification *) notification;
    202 - (void) torrentStoppedForRatio: (NSNotification *) notification;
     202- (void) torrentFinishedSeeding: (NSNotification *) notification;
    203203
    204204- (void) updateTorrentHistory;
  • trunk/macosx/Controller.m

    r11104 r11178  
    535535                    name: @"TorrentRestartedDownloading" object: nil];
    536536   
     537    [nc addObserver: self selector: @selector(torrentFinishedSeeding:)
     538                    name: @"TorrentFinishedSeeding" object: nil];
     539   
    537540    //avoids need of setting delegate
    538541    [nc addObserver: self selector: @selector(torrentTableViewSelectionDidChange:)
     
    550553    [nc addObserver: fWindow selector: @selector(makeKeyWindow)
    551554                    name: @"MakeWindowKey" object: nil];
    552    
    553     //check if torrent should now start
    554     [nc addObserver: self selector: @selector(torrentStoppedForRatio:)
    555                     name: @"TorrentStoppedForRatio" object: nil];
    556555   
    557556    [nc addObserver: self selector: @selector(updateTorrentsInQueue)
     
    19571956}
    19581957
    1959 - (void) torrentStoppedForRatio: (NSNotification *) notification
     1958- (void) torrentFinishedSeeding: (NSNotification *) notification
    19601959{
    19611960    Torrent * torrent = [notification object];
  • trunk/macosx/Torrent.m

    r11177 r11178  
    17871787    fStat = tr_torrentStat(fHandle);
    17881788   
    1789     [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentStoppedForRatio" object: self];
     1789    [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedSeeding" object: self];
    17901790}
    17911791
     
    17941794    fStat = tr_torrentStat(fHandle);
    17951795   
    1796     #warning fix
    1797     [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentStoppedForRatio" object: self];
     1796    [[NSNotificationCenter defaultCenter] postNotificationName: @"TorrentFinishedSeeding" object: self];
    17981797}
    17991798
     
    18131812    else if ([self isSeeding])
    18141813    {
    1815         if (fStat->eta != TR_ETA_NOT_AVAIL && fStat->eta != TR_ETA_UNKNOWN)
     1814        //ratio: show if it's set at all
     1815        if (tr_torrentGetSeedRatio(fHandle, NULL))
    18161816            return YES;
    1817            
     1817       
     1818        //idle: show only if remaining time is less than cap
    18181819        if (fStat->etaIdle != TR_ETA_NOT_AVAIL && fStat->etaIdle < ETA_IDLE_DISPLAY_SEC)
    18191820            return YES;
     
    18251826- (NSString *) etaString
    18261827{
    1827     const BOOL etaReg = fStat->eta != TR_ETA_NOT_AVAIL && fStat->eta != TR_ETA_UNKNOWN;
    1828     const BOOL etaIdleSeed = fStat->etaIdle != TR_ETA_NOT_AVAIL && fStat->etaIdle < ETA_IDLE_DISPLAY_SEC;
    1829    
    18301828    NSInteger eta;
    1831     if (etaReg && etaIdleSeed)
    1832         eta = MIN(fStat->eta, fStat->etaIdle);
    1833     else if (etaReg)
     1829    BOOL fromIdle;
     1830    //don't check for both, since if there's a regular ETA, the torrent isn't idle so it's meaningless
     1831    if (fStat->eta != TR_ETA_NOT_AVAIL && fStat->eta != TR_ETA_UNKNOWN)
     1832    {
    18341833        eta = fStat->eta;
    1835     else if (etaIdleSeed)
     1834        fromIdle = NO;
     1835    }
     1836    else if (fStat->etaIdle != TR_ETA_NOT_AVAIL && fStat->etaIdle < ETA_IDLE_DISPLAY_SEC)
     1837    {
    18361838        eta = fStat->etaIdle;
     1839        fromIdle = YES;
     1840    }
    18371841    else
    18381842        return NSLocalizedString(@"remaining time unknown", "Torrent -> eta string");
    18391843   
    1840     return [NSString stringWithFormat: NSLocalizedString(@"%@ remaining", "Torrent -> eta string"),
    1841             [NSString timeString: eta showSeconds: YES maxFields: 2]];
     1844    NSString * idleString = [NSString stringWithFormat: NSLocalizedString(@"%@ remaining", "Torrent -> eta string"),
     1845                                [NSString timeString: eta showSeconds: YES maxFields: 2]];
     1846    if (fromIdle)
     1847        idleString = [idleString stringByAppendingFormat: @" (%@)", NSLocalizedString(@"inactive", "Torrent -> eta string")];
     1848   
     1849    return idleString;
    18421850}
    18431851
Note: See TracChangeset for help on using the changeset viewer.