Ignore:
Timestamp:
Jul 8, 2006, 8:49:54 PM (16 years ago)
Author:
livings124
Message:

Have start and stop use actual torrents instead of indexes...this could be useful later.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r552 r554  
    487487}
    488488
    489 - (void) resumeTorrent: (id) sender
    490 {
    491     [self resumeTorrentWithIndex: [fTableView selectedRowIndexes]];
     489- (void) resumeSelectedTorrents: (id) sender
     490{
     491    [self resumeTorrents: [self torrentsAtIndexes: [fTableView selectedRowIndexes]]];
    492492}
    493493
    494494- (void) resumeAllTorrents: (id) sender
    495495{
    496     [self resumeTorrentWithIndex: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fTorrents count])]];
    497 }
    498 
    499 - (void) resumeTorrentWithIndex: (NSIndexSet *) indexSet
    500 {
    501     unsigned int i;
    502     for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
    503         [[fTorrents objectAtIndex: i] startTransfer];
     496    [self resumeTorrents: fTorrents];
     497}
     498
     499- (void) resumeTorrents: (NSArray *) torrents;
     500{
     501    [torrents makeObjectsPerformSelector: @selector(startTransfer)];
    504502   
    505503    [self updateUI: nil];
     
    508506}
    509507
    510 - (void) stopTorrent: (id) sender
    511 {
    512     [self stopTorrentWithIndex: [fTableView selectedRowIndexes]];
     508- (void) stopSelectedTorrents: (id) sender
     509{
     510    [self stopTorrents: [self torrentsAtIndexes: [fTableView selectedRowIndexes]]];
    513511}
    514512
    515513- (void) stopAllTorrents: (id) sender
    516514{
    517     [self stopTorrentWithIndex: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fTorrents count])]];
    518 }
    519 
    520 - (void) stopTorrentWithIndex: (NSIndexSet *) indexSet
     515    [self stopTorrents: fTorrents];
     516}
     517
     518- (void) stopTorrents: (NSArray *) torrents;
    521519{
    522520    //don't want any of these starting then stopping
    523     unsigned int i;
     521    NSEnumerator * enumerator = [torrents objectEnumerator];
    524522    Torrent * torrent;
    525     for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
    526     {
    527         torrent = [fTorrents objectAtIndex: i];
     523    while ((torrent = [enumerator nextObject]))
    528524        [torrent setWaitToStart: NO];
    529     }
    530 
    531     for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
    532         [[fTorrents objectAtIndex: i] stopTransfer];
     525
     526    [torrents makeObjectsPerformSelector: @selector(stopTransfer)];
    533527   
    534528    [self updateUI: nil];
     
    14441438        [item setImage: [NSImage imageNamed: @"PauseSelected.png"]];
    14451439        [item setTarget: self];
    1446         [item setAction: @selector(stopTorrent:)];
     1440        [item setAction: @selector(stopSelectedTorrents:)];
    14471441    }
    14481442    else if ([ident isEqualToString: TOOLBAR_RESUME_SELECTED])
     
    14531447        [item setImage: [NSImage imageNamed: @"ResumeSelected.png"]];
    14541448        [item setTarget: self];
    1455         [item setAction: @selector(resumeTorrent:)];
     1449        [item setAction: @selector(resumeSelectedTorrents:)];
    14561450    }
    14571451    else
     
    16461640
    16471641    //enable pause item
    1648     if (action == @selector(stopTorrent:))
     1642    if (action == @selector(stopSelectedTorrents:))
    16491643    {
    16501644        if (!canUseMenu)
     
    16651659   
    16661660    //enable resume item
    1667     if (action == @selector(resumeTorrent:))
     1661    if (action == @selector(resumeSelectedTorrents:))
    16681662    {
    16691663        if (!canUseMenu)
Note: See TracChangeset for help on using the changeset viewer.