Changeset 554


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.

Location:
trunk/macosx
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r548 r554  
    9090- (void) torrentNumberChanged;
    9191
    92 - (void) resumeTorrent:             (id) sender;
     92- (void) resumeSelectedTorrents:    (id) sender;
    9393- (void) resumeAllTorrents:         (id) sender;
    94 - (void) resumeTorrentWithIndex:    (NSIndexSet *) indexSet;
    95 - (void) stopTorrent:               (id) sender;
     94- (void) resumeTorrents:            (NSArray *) torrents;
     95- (void) stopSelectedTorrents:      (id) sender;
    9696- (void) stopAllTorrents:           (id) sender;
    97 - (void) stopTorrentWithIndex:      (NSIndexSet *) indexSet;
     97- (void) stopTorrents:              (NSArray *) torrents;
    9898
    9999- (void) removeWithIndex: (NSIndexSet *) indexSet
  • 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)
  • trunk/macosx/English.lproj/MainMenu.nib/classes.nib

    r530 r554  
    1313                removeNoDelete = id;
    1414                resumeAllTorrents = id;
    15                 resumeTorrent = id;
     15                resumeSelectedTorrents = id;
    1616                revealFile = id;
    1717                setInfoTab = id;
     
    2525                showPreferenceWindow = id;
    2626                stopAllTorrents = id;
    27                 stopTorrent = id;
     27                stopSelectedTorrents = id;
    2828                toggleAdvancedBar = id;
    2929                toggleSmallView = id;
  • trunk/macosx/English.lproj/MainMenu.nib/info.nib

    r533 r554  
    3030        <key>IBOpenObjects</key>
    3131        <array>
     32                <integer>456</integer>
    3233                <integer>29</integer>
    3334        </array>
  • trunk/macosx/TorrentTableView.m

    r537 r554  
    104104
    105105                if ([torrent isPaused])
    106                         [fController resumeTorrentWithIndex: [NSIndexSet indexSetWithIndex: row]];
     106                        [fController resumeTorrents: [fController torrentsAtIndexes: [NSIndexSet indexSetWithIndex: row]]];
    107107                else if ([torrent isActive])
    108                         [fController stopTorrentWithIndex: [NSIndexSet indexSetWithIndex: row]];
     108            [fController stopTorrents: [fController torrentsAtIndexes: [NSIndexSet indexSetWithIndex: row]]];
    109109                else;
    110110    }
Note: See TracChangeset for help on using the changeset viewer.