Changeset 12612


Ignore:
Timestamp:
Aug 2, 2011, 12:43:26 PM (10 years ago)
Author:
livings124
Message:

first go at bringing the libT queue to the Mac client

Location:
trunk/macosx
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/AddMagnetWindowController.m

    r11617 r12612  
    200200- (void) confirmAdd
    201201{
    202     [fTorrent setWaitToStart: [fStartCheck state] == NSOnState];
    203202    [fTorrent setGroupValue: fGroupValue];
     203   
     204    if ([fStartCheck state] == NSOnState)
     205        [fTorrent startTransfer];
    204206   
    205207    [self close];
  • trunk/macosx/AddWindowController.m

    r11617 r12612  
    288288    [fTimer invalidate];
    289289    fTimer = nil;
    290    
    291     [fTorrent setWaitToStart: [fStartCheck state] == NSOnState];
    292290    [fTorrent setGroupValue: fGroupValue];
    293291   
    294292    if (fTorrentFile && [fDeleteCheck state] == NSOnState)
    295293        [Torrent trashFile: fTorrentFile];
     294   
     295    if ([fStartCheck state] == NSOnState)
     296        [fTorrent startTransfer];
    296297   
    297298    [fFileController setTorrent: nil]; //avoid a crash when window tries to update
  • trunk/macosx/Controller.h

    r12598 r12612  
    186186
    187187- (void) updateTorrentsInQueue;
    188 - (NSUInteger) numToStartFromQueue: (BOOL) downloadQueue;
    189188
    190189- (void) torrentFinishedDownloading: (NSNotification *) notification;
  • trunk/macosx/Controller.m

    r12598 r12612  
    287287        tr_bencDictAddStr(&settings, TR_PREFS_KEY_DOWNLOAD_DIR, [[[fDefaults stringForKey: @"DownloadFolder"]
    288288                                                                    stringByExpandingTildeInPath] UTF8String]);
     289        tr_bencDictAddBool(&settings, TR_PREFS_KEY_DOWNLOAD_QUEUE_ENABLED, [fDefaults boolForKey: @"Queue"]);
     290        tr_bencDictAddInt(&settings, TR_PREFS_KEY_DOWNLOAD_QUEUE_SIZE, [fDefaults integerForKey: @"QueueDownloadNumber"]);
    289291        tr_bencDictAddInt(&settings, TR_PREFS_KEY_IDLE_LIMIT, [fDefaults integerForKey: @"IdleLimitMinutes"]);
    290292        tr_bencDictAddBool(&settings, TR_PREFS_KEY_IDLE_LIMIT_ENABLED, [fDefaults boolForKey: @"IdleLimitCheck"]);
     
    308310        tr_bencDictAddBool(&settings, TR_PREFS_KEY_PEX_ENABLED, [fDefaults boolForKey: @"PEXGlobal"]);
    309311        tr_bencDictAddBool(&settings, TR_PREFS_KEY_PORT_FORWARDING, [fDefaults boolForKey: @"NatTraversal"]);
     312        tr_bencDictAddInt(&settings, TR_PREFS_KEY_QUEUE_STALLED_MINUTES, [fDefaults integerForKey: @"StalledMinutes"]);
    310313        tr_bencDictAddReal(&settings, TR_PREFS_KEY_RATIO, [fDefaults floatForKey: @"RatioLimit"]);
    311314        tr_bencDictAddBool(&settings, TR_PREFS_KEY_RATIO_ENABLED, [fDefaults boolForKey: @"RatioCheck"]);
     
    316319        tr_bencDictAddStr(&settings, TR_PREFS_KEY_RPC_USERNAME,  [[fDefaults stringForKey: @"RPCUsername"] UTF8String]);
    317320        tr_bencDictAddBool(&settings, TR_PREFS_KEY_RPC_WHITELIST_ENABLED,  [fDefaults boolForKey: @"RPCUseWhitelist"]);
     321        tr_bencDictAddBool(&settings, TR_PREFS_KEY_SEED_QUEUE_ENABLED, [fDefaults boolForKey: @"QueueSeed"]);
     322        tr_bencDictAddInt(&settings, TR_PREFS_KEY_SEED_QUEUE_SIZE, [fDefaults integerForKey: @"QueueSeedNumber"]);
    318323        tr_bencDictAddBool(&settings, TR_PREFS_KEY_START, [fDefaults boolForKey: @"AutoStartDownload"]);
    319324        tr_bencDictAddBool(&settings, TR_PREFS_KEY_SCRIPT_TORRENT_DONE_ENABLED, [fDefaults boolForKey: @"DoneScriptEnabled"]);
     
    447452    if (history)
    448453    {
     454        NSMutableArray * waitToStartTorrents = [NSMutableArray arrayWithCapacity: (([history count] > 0 && !fPauseOnLaunch) ? [history count]-1 : 0)]; //theoretical max without doing a lot of work
     455       
    449456        for (NSDictionary * historyItem in history)
    450457        {
     
    453460            {
    454461                [fTorrents addObject: torrent];
     462               
     463                NSNumber * waitToStart;
     464                if (!fPauseOnLaunch && (waitToStart = [historyItem objectForKey: @"WaitToStart"]) && [waitToStart boolValue])
     465                    [waitToStartTorrents addObject: torrent];
     466               
    455467                [torrent release];
    456468            }
    457469        }
     470       
     471        //now that all are loaded, let's set those in the queue to waiting
     472        for (Torrent * torrent in waitToStartTorrents)
     473            [torrent startTransfer];
    458474    }
    459475   
     
    491507                    name: @"MakeWindowKey" object: nil];
    492508   
     509#warning look at this
    493510    [nc addObserver: self selector: @selector(updateTorrentsInQueue)
    494511                    name: @"UpdateQueue" object: nil];
     
    882899        else
    883900        {
    884             [torrent setWaitToStart: [fDefaults boolForKey: @"AutoStartDownload"]];
     901            if ([fDefaults boolForKey: @"AutoStartDownload"])
     902                [torrent startTransfer];
    885903           
    886904            [torrent update];
     
    951969    else
    952970    {
    953         [torrent setWaitToStart: [fDefaults boolForKey: @"AutoStartDownload"]];
     971        if ([fDefaults boolForKey: @"AutoStartDownload"])
     972            [torrent startTransfer];
    954973       
    955974        [torrent update];
     
    11761195{
    11771196    for (Torrent * torrent in torrents)
    1178         [torrent setWaitToStart: YES];
     1197        [torrent startTransfer];
    11791198   
    11801199    [self updateTorrentsInQueue];
     
    11911210   
    11921211    for (Torrent * torrent in fTorrents)
    1193         if (![torrent isActive] && [torrent waitingToStart])
     1212        if ([torrent waitingToStart])
    11941213            [torrents addObject: torrent];
    11951214   
     
    12011220    //iterate through instead of all at once to ensure no conflicts
    12021221    for (Torrent * torrent in torrents)
    1203     {
    1204         tr_inf( "restarting a torrent in resumeTorrentsNoWait" );
    1205         [torrent startTransfer];
    1206     }
    1207    
     1222        [torrent startTransferNoQueue];
     1223   
     1224    #warning change to updateTorrentsInQueue?
    12081225    [self updateUI];
    12091226    [self applyFilter];
     
    12241241- (void) stopTorrents: (NSArray *) torrents
    12251242{
     1243#warning look into stopping all without starting any
    12261244    //don't want any of these starting then stopping
    1227     for (Torrent * torrent in torrents)
    1228         [torrent setWaitToStart: NO];
     1245    /*for (Torrent * torrent in torrents)
     1246        [torrent setWaitToStart: NO];*/
    12291247
    12301248    [torrents makeObjectsPerformSelector: @selector(stopTransfer)];
     
    13251343    [selectedValues removeObjectsInArray: torrents];
    13261344   
     1345#warning look into stopping all without starting any
    13271346    //don't want any of these starting then stopping
    1328     for (Torrent * torrent in torrents)
    1329         [torrent setWaitToStart: NO];
     1347    /*for (Torrent * torrent in torrents)
     1348        [torrent setWaitToStart: NO];*/
    13301349   
    13311350    [fTorrents removeObjectsInArray: torrents];
     
    17081727}
    17091728
     1729#warning rename? remove?
    17101730- (void) updateTorrentsInQueue
    17111731{
    1712     NSUInteger desiredDownloadActive = [fDefaults boolForKey: @"Queue"] ? [self numToStartFromQueue: YES] : NSUIntegerMax,
    1713                 desiredSeedActive = [fDefaults boolForKey: @"QueueSeed"] ? [self numToStartFromQueue: NO] : NSUIntegerMax;
    1714    
    1715     for (Torrent * torrent in fTorrents)
    1716     {
    1717         if (desiredDownloadActive == 0 && desiredSeedActive == 0)
    1718             break;
    1719        
    1720         if (![torrent isActive] && ![torrent isChecking] && [torrent waitingToStart])
    1721         {
    1722             if (![torrent allDownloaded])
    1723             {
    1724                 if (desiredDownloadActive > 0)
    1725                 {
    1726                     tr_inf( "restarting download torrent in mac queue" );
    1727                     [torrent startTransfer];
    1728                     if ([torrent isActive])
    1729                         --desiredDownloadActive;
    1730                     [torrent update];
    1731                 }
    1732             }
    1733             else
    1734             {
    1735                 if (desiredSeedActive > 0)
    1736                 {
    1737                     tr_inf( "restarting seed torrent in mac queue" );
    1738                     [torrent startTransfer];
    1739                     if ([torrent isActive])
    1740                         --desiredSeedActive;
    1741                     [torrent update];
    1742                 }
    1743             }
    1744         }
    1745     }
    1746    
    17471732    [self updateUI];
    17481733    [self applyFilter];
    17491734    [[fWindow toolbar] validateVisibleItems];
    17501735    [self updateTorrentHistory];
    1751 }
    1752 
    1753 - (NSUInteger) numToStartFromQueue: (BOOL) downloadQueue
    1754 {
    1755     if (![fDefaults boolForKey: downloadQueue ? @"Queue" : @"QueueSeed"])
    1756         return 0;
    1757    
    1758     NSUInteger desired = [fDefaults integerForKey: downloadQueue ? @"QueueDownloadNumber" : @"QueueSeedNumber"];
    1759        
    1760     for (Torrent * torrent in fTorrents)
    1761     {
    1762         if (desired == 0)
    1763             break;
    1764        
    1765         if ([torrent isChecking])
    1766             --desired;
    1767         else if ([torrent isActive] && ![torrent isStalled] && ![torrent isError])
    1768         {
    1769             if ([torrent allDownloaded] != downloadQueue)
    1770                 --desired;
    1771         }
    1772         else;
    1773     }
    1774    
    1775     return desired;
    17761736}
    17771737
     
    18091769        [[NSDistributedNotificationCenter defaultCenter] postNotificationName: @"com.apple.DownloadFileFinished"
    18101770            object: [torrent dataLocation]];
    1811        
    1812         if ([torrent isActive] && [fDefaults boolForKey: @"QueueSeed"] && [self numToStartFromQueue: NO] == 0)
    1813         {
    1814             [torrent stopTransfer];
    1815             [torrent setWaitToStart: YES];
    1816         }
    18171771    }
    18181772   
     
    18201774}
    18211775
     1776#warning remove?
    18221777- (void) torrentRestartedDownloading: (NSNotification *) notification
    18231778{
    1824     Torrent * torrent = [notification object];
    1825     if ([torrent isActive] && [fDefaults boolForKey: @"Queue"] && [self numToStartFromQueue: YES] == 0)
    1826     {
    1827         [torrent stopTransfer];
    1828         [torrent setWaitToStart: YES];
    1829     }
    1830    
    18311779    [self updateTorrentsInQueue];
    18321780}
     
    27012649            NSUInteger insertIndex = topTorrent ? [fTorrents indexOfObject: topTorrent] + 1 : 0;
    27022650            NSIndexSet * insertIndexes = [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(insertIndex, [movingTorrents count])];
     2651            for (Torrent * torrent in movingTorrents)
     2652                [torrent setQueueIndex: insertIndex++];
    27032653            [fTorrents insertObjects: movingTorrents atIndexes: insertIndexes];
    27042654        }
     
    41654115}
    41664116
     4117#warning handle queue state changes
    41674118- (void) rpcCallback: (tr_rpc_callback_type) type forTorrentStruct: (struct tr_torrent *) torrentStruct
    41684119{
  • trunk/macosx/PrefsController.m

    r12576 r12612  
    763763- (void) setQueue: (id) sender
    764764{
     765    //let's just do both - easier that way
     766    tr_sessionSetQueueEnabled(fHandle, TR_DOWN, [fDefaults boolForKey: @"Queue"]);
     767    tr_sessionSetQueueEnabled(fHandle, TR_UP, [fDefaults boolForKey: @"QueueSeed"]);
     768   
    765769    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateQueue" object: self];
    766770}
     
    768772- (void) setQueueNumber: (id) sender
    769773{
    770     [fDefaults setInteger: [sender intValue] forKey: sender == fQueueDownloadField ? @"QueueDownloadNumber" : @"QueueSeedNumber"];
    771     [self setQueue: nil];
     774    const NSInteger number = [sender intValue];
     775    const BOOL seed = sender == fQueueSeedField;
     776   
     777    [fDefaults setInteger: number forKey: seed ? @"QueueSeedNumber" : @"QueueDownloadNumber"];
     778   
     779    tr_sessionSetQueueSize(fHandle, seed ? TR_UP : TR_DOWN, number);
     780   
     781    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateQueue" object: self];
    772782}
    773783
    774784- (void) setStalled: (id) sender
    775785{
     786#warning do something here
     787   
    776788    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateQueue" object: self];
    777789}
     
    780792{
    781793    [fDefaults setInteger: [sender intValue] forKey: @"StalledMinutes"];
    782     [self setStalled: nil];
     794    tr_sessionSetQueueStalledMinutes(fHandle, [fDefaults integerForKey: @"StalledMinutes"]);
     795   
     796    [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateQueue" object: self];
    783797}
    784798
     
    12221236    [fDefaults setInteger: idleLimitMin forKey: @"IdleLimitMinutes"];
    12231237   
     1238    //queue
     1239    const BOOL downloadQueue = tr_sessionGetQueueEnabled(fHandle, TR_DOWN);
     1240    [fDefaults setBool: downloadQueue forKey: @"Queue"];
     1241   
     1242    const int downloadQueueNum = tr_sessionGetQueueSize(fHandle, TR_DOWN);
     1243    [fDefaults setInteger: downloadQueueNum forKey: @"QueueDownloadNumber"];
     1244   
     1245    const BOOL seedQueue = tr_sessionGetQueueEnabled(fHandle, TR_UP);
     1246    [fDefaults setBool: seedQueue forKey: @"QueueSeed"];
     1247    [fDefaults setBool: downloadQueue forKey: @"Queue"];
     1248   
     1249    const int seedQueueNum = tr_sessionGetQueueSize(fHandle, TR_UP);
     1250    [fDefaults setInteger: seedQueueNum forKey: @"QueueSeedNumber"];
     1251   
    12241252    //done script
    12251253    const BOOL doneScriptEnabled = tr_sessionIsTorrentDoneScriptEnabled(fHandle);
  • trunk/macosx/Torrent.h

    r12325 r12612  
    4848    NSDate * fPreviousFinishedIndexesDate;
    4949   
    50     BOOL fWaitToStart, fStalled;
    51    
    5250    NSInteger fGroupValue;
    5351   
     
    7472- (void) getAmountFinished: (float *) tab size: (NSInteger) size;
    7573- (NSIndexSet *) previousFinishedPieces;
    76 -(void) setPreviousFinishedPieces: (NSIndexSet *) indexes;
     74- (void) setPreviousFinishedPieces: (NSIndexSet *) indexes;
    7775
    7876- (void) update;
    7977
     78- (void) startTransferNoQueue;
    8079- (void) startTransfer;
    8180- (void) stopTransfer;
    8281- (void) sleep;
    8382- (void) wakeUp;
     83
     84- (void) setQueueIndex: (NSUInteger) index;
    8485
    8586- (void) manualAnnounce;
     
    113114- (uint16_t) maxPeerConnect;
    114115
    115 - (void) setWaitToStart: (BOOL) wait;
    116116- (BOOL) waitingToStart;
    117117
  • trunk/macosx/Torrent.m

    r12483 r12612  
    3838- (id) initWithPath: (NSString *) path hash: (NSString *) hashString torrentStruct: (tr_torrent *) torrentStruct
    3939        magnetAddress: (NSString *) magnetAddress lib: (tr_session *) lib
    40         waitToStart: (NSNumber *) waitToStart
    4140        groupValue: (NSNumber *) groupValue
    4241        timeMachineExcludeLocation: (NSString *) timeMachineExclude
     
    104103{
    105104    self = [self initWithPath: path hash: nil torrentStruct: NULL magnetAddress: nil lib: lib
    106             waitToStart: nil groupValue: nil
     105            groupValue: nil
    107106            timeMachineExcludeLocation: nil
    108107            downloadFolder: location
     
    120119{
    121120    self = [self initWithPath: nil hash: nil torrentStruct: torrentStruct magnetAddress: nil lib: lib
    122             waitToStart: nil groupValue: nil
     121            groupValue: nil
    123122            timeMachineExcludeLocation: nil
    124123            downloadFolder: location
     
    131130{
    132131    self = [self initWithPath: nil hash: nil torrentStruct: nil magnetAddress: address
    133             lib: lib waitToStart: nil groupValue: nil
     132            lib: lib groupValue: nil
    134133            timeMachineExcludeLocation: nil
    135134            downloadFolder: location legacyIncompleteFolder: nil];
     
    145144                magnetAddress: nil
    146145                lib: lib
    147                 waitToStart: [history objectForKey: @"WaitToStart"]
    148146                groupValue: [history objectForKey: @"GroupValue"]
    149147                timeMachineExcludeLocation: [history objectForKey: @"TimeMachineExcludeLocation"]
     
    159157        {
    160158            fStat = tr_torrentStat(fHandle);
    161             [self startTransfer];
     159            [self startTransferNoQueue];
    162160        }
     161       
     162        //fWaitToStart = waitToStart && [waitToStart boolValue];
     163       
    163164       
    164165        //upgrading from versions < 1.30: get old added, activity, and done dates
     
    195196                                        [self hashString], @"TorrentHash",
    196197                                        [NSNumber numberWithBool: [self isActive]], @"Active",
    197                                         [NSNumber numberWithBool: fWaitToStart], @"WaitToStart",
     198                                        [NSNumber numberWithBool: [self waitingToStart]], @"WaitToStart",
    198199                                        [NSNumber numberWithInt: fGroupValue], @"GroupValue", nil];
    199200   
     
    290291- (void) update
    291292{
    292     //get previous status values before update
    293     BOOL wasChecking = NO, wasError = NO, wasStalled = NO;
    294     if (fStat != NULL)
    295     {
    296         wasChecking = [self isChecking];
    297         wasError = [self isError];
    298         wasStalled = fStalled;
    299     }
    300    
    301293    fStat = tr_torrentStat(fHandle);
    302    
    303     //check if stalled (stored because based on time and needs to check if it was previously stalled)
    304     fStalled = [self isActive] && [fDefaults boolForKey: @"CheckStalled"]
    305                 && [self stalledMinutes] > [fDefaults integerForKey: @"StalledMinutes"];
    306    
    307     //update queue for checking (from downloading to seeding), stalled, or error
    308     if ((wasChecking && ![self isChecking]) || (wasStalled != fStalled) || (!wasError && [self isError] && [self isActive]))
    309         [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateQueue" object: self];
    310294   
    311295    //when the data first appears, update time machine exclusion
     
    314298}
    315299
     300- (void) startTransferNoQueue
     301{
     302    if (![self isActive] && [self alertForRemainingDiskSpace])
     303    {
     304        tr_torrentStartNow(fHandle);
     305        [self update];
     306       
     307        //capture, specifically, stop-seeding settings changing to unlimited
     308        [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateOptions" object: nil];
     309    }
     310}
     311
     312#warning merge
    316313- (void) startTransfer
    317314{
    318     fWaitToStart = NO;
    319    
    320     if (![self isActive] && [self alertForRemainingDiskSpace])
    321     {
    322         tr_ninf( fInfo->name, "restarting via startTransfer" );
     315    if (![self isActive] && ![self waitingToStart] && [self alertForRemainingDiskSpace])
     316    {
    323317        tr_torrentStart(fHandle);
    324318        [self update];
     
    331325- (void) stopTransfer
    332326{
    333     fWaitToStart = NO;
    334    
    335     if ([self isActive])
     327    if ([self isActive] || [self waitingToStart])
    336328    {
    337329        tr_torrentStop(fHandle);
    338330        [self update];
    339331       
     332        #warning still needed?
    340333        [[NSNotificationCenter defaultCenter] postNotificationName: @"UpdateQueue" object: self];
    341334    }
     
    357350}
    358351
     352- (void) setQueueIndex: (NSUInteger) index
     353{
     354    tr_torrentSetQueuePosition(fHandle, index);
     355}
     356
    359357- (void) manualAnnounce
    360358{
     
    476474    return tr_torrentGetPeerLimit(fHandle);
    477475}
    478 
    479 - (void) setWaitToStart: (BOOL) wait
    480 {
    481     fWaitToStart = wait;
    482 }
    483 
    484476- (BOOL) waitingToStart
    485477{
    486     return fWaitToStart;
     478    return fStat->activity == TR_STATUS_DOWNLOAD_WAIT || fStat->activity == TR_STATUS_SEED_WAIT;
    487479}
    488480
     
    623615- (NSString *) name
    624616{
     617#warning remove
     618    //return [NSString stringWithFormat: @"%d  %@", fStat->queuePosition, [NSString stringWithUTF8String: fInfo->name]];
    625619    return fInfo->name != NULL ? [NSString stringWithUTF8String: fInfo->name] : fHashString;
    626620}
     
    841835- (BOOL) isActive
    842836{
    843     return fStat->activity != TR_STATUS_STOPPED;
     837    return fStat->activity != TR_STATUS_STOPPED && fStat->activity != TR_STATUS_DOWNLOAD_WAIT && fStat->activity != TR_STATUS_SEED_WAIT;
    844838}
    845839
     
    10511045        {
    10521046            case TR_STATUS_STOPPED:
    1053                 if (fWaitToStart)
    1054                 {
    1055                     string = ![self allDownloaded]
    1056                             ? [NSLocalizedString(@"Waiting to download", "Torrent -> status string") stringByAppendingEllipsis]
    1057                             : [NSLocalizedString(@"Waiting to seed", "Torrent -> status string") stringByAppendingEllipsis];
    1058                 }
    1059                 else if ([self isFinishedSeeding])
     1047                if ([self isFinishedSeeding])
    10601048                    string = NSLocalizedString(@"Seeding complete", "Torrent -> status string");
    10611049                else
    10621050                    string = NSLocalizedString(@"Paused", "Torrent -> status string");
    10631051                break;
    1064 
     1052           
     1053            case TR_STATUS_DOWNLOAD_WAIT:
     1054                string = [NSLocalizedString(@"Waiting to download", "Torrent -> status string") stringByAppendingEllipsis];
     1055                break;
     1056               
     1057            case TR_STATUS_SEED_WAIT:
     1058                string = [NSLocalizedString(@"Waiting to seed", "Torrent -> status string") stringByAppendingEllipsis];
     1059                break;
     1060           
    10651061            case TR_STATUS_CHECK_WAIT:
    10661062                string = [NSLocalizedString(@"Waiting to check existing data", "Torrent -> status string") stringByAppendingEllipsis];
     
    11051101        }
    11061102       
    1107         if (fStalled)
     1103        if ([self isStalled])
    11081104            string = [NSLocalizedString(@"Stalled", "Torrent -> status string") stringByAppendingFormat: @", %@", string];
    11091105    }
     
    11311127    {
    11321128        case TR_STATUS_STOPPED:
    1133             if (fWaitToStart)
    1134             {
    1135                 string = ![self allDownloaded]
    1136                         ? [NSLocalizedString(@"Waiting to download", "Torrent -> status string") stringByAppendingEllipsis]
    1137                         : [NSLocalizedString(@"Waiting to seed", "Torrent -> status string") stringByAppendingEllipsis];
    1138             }
    1139             else if ([self isFinishedSeeding])
     1129            if ([self isFinishedSeeding])
    11401130                string = NSLocalizedString(@"Seeding complete", "Torrent -> status string");
    11411131            else
    11421132                string = NSLocalizedString(@"Paused", "Torrent -> status string");
    11431133            break;
     1134       
     1135        case TR_STATUS_DOWNLOAD_WAIT:
     1136            string = [NSLocalizedString(@"Waiting to download", "Torrent -> status string") stringByAppendingEllipsis];
     1137           
     1138        case TR_STATUS_SEED_WAIT:
     1139            string = [NSLocalizedString(@"Waiting to seed", "Torrent -> status string") stringByAppendingEllipsis];
    11441140
    11451141        case TR_STATUS_CHECK_WAIT:
     
    11811177    {
    11821178        case TR_STATUS_STOPPED:
     1179        case TR_STATUS_DOWNLOAD_WAIT:
     1180        case TR_STATUS_SEED_WAIT:
    11831181        {
    11841182            NSString * string = NSLocalizedString(@"Paused", "Torrent -> status string");
    11851183           
    11861184            NSString * extra = nil;
    1187             if (fWaitToStart)
     1185            if ([self waitingToStart])
    11881186            {
    1189                 extra = ![self allDownloaded]
     1187                extra = fStat->activity == TR_STATUS_DOWNLOAD_WAIT
    11901188                        ? NSLocalizedString(@"Waiting to download", "Torrent -> status string")
    11911189                        : NSLocalizedString(@"Waiting to seed", "Torrent -> status string");
     
    12111209        case TR_STATUS_SEED:
    12121210            return NSLocalizedString(@"Seeding", "Torrent -> status string");
    1213        
    1214         default:
    1215             NSAssert1(NO, @"Unknown activity %d for state string", fStat->activity);
    1216             return nil;
    12171211    }
    12181212}
     
    15371531- (BOOL) isStalled
    15381532{
    1539     return fStalled;
     1533    return fStat->isStalled;
    15401534}
    15411535
     
    15681562    if (![self isActive]) //paused
    15691563    {
    1570         if (fWaitToStart)
     1564        if ([self waitingToStart])
    15711565            return 1;
    15721566        else
     
    16141608- (id) initWithPath: (NSString *) path hash: (NSString *) hashString torrentStruct: (tr_torrent *) torrentStruct
    16151609        magnetAddress: (NSString *) magnetAddress lib: (tr_session *) lib
    1616         waitToStart: (NSNumber *) waitToStart
    16171610        groupValue: (NSNumber *) groupValue
    16181611        timeMachineExcludeLocation: (NSString *) timeMachineExclude
     
    16701663    fHashString = [[NSString alloc] initWithUTF8String: fInfo->hashString];
    16711664   
    1672     fWaitToStart = waitToStart && [waitToStart boolValue];
    16731665    fResumeOnWake = NO;
    16741666   
Note: See TracChangeset for help on using the changeset viewer.