Changeset 3535


Ignore:
Timestamp:
Oct 24, 2007, 6:49:59 PM (14 years ago)
Author:
livings124
Message:

display all trackers in the announce list in the inspector's tooltip

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoWindowController.m

    r3485 r3535  
    317317        [fSizeField setStringValue: [NSString stringForFileSize: [torrent size]]];
    318318       
     319        NSArray * allTrackers = [torrent allTrackers], * subTrackers;
     320        NSMutableArray * trackerStrings = [NSMutableArray arrayWithCapacity: [allTrackers count]];
     321        NSEnumerator * enumerator = [allTrackers objectEnumerator];
     322        while ((subTrackers = [enumerator nextObject]))
     323            [trackerStrings addObject: [subTrackers componentsJoinedByString: @", "]];
     324        [fTrackerField setToolTip: [trackerStrings componentsJoinedByString: @"\n"]];
     325       
    319326        NSString * hashString = [torrent hashString];
    320327        [fPiecesField setStringValue: [NSString stringWithFormat: @"%d, %@", [torrent pieceCount],
     
    11081115    NSString * tracker = [[torrent trackerAddress] stringByAppendingString: [torrent trackerAddressAnnounce]];
    11091116    [fTrackerField setStringValue: tracker];
    1110     [fTrackerField setToolTip: tracker];
    11111117   
    11121118    NSString * location = [torrent dataLocation];
  • trunk/macosx/Torrent.h

    r3485 r3535  
    133133- (NSString *) trackerAddress;
    134134- (NSString *) trackerAddressAnnounce;
     135- (NSArray *) allTrackers;
    135136
    136137- (NSString *) comment;
  • trunk/macosx/Torrent.m

    r3520 r3535  
    616616{
    617617    return [NSString stringWithUTF8String: fStat->tracker->announce];
     618}
     619
     620- (NSArray *) allTrackers
     621{
     622    NSMutableArray * trackers = [NSMutableArray arrayWithCapacity: fInfo->trackerTiers], * subTrackers;
     623   
     624    int i, j;
     625    for (i = 0; i < fInfo->trackerTiers; i++)
     626    {
     627        subTrackers = [NSMutableArray arrayWithCapacity: fInfo->trackerList[i].count];
     628        for (j = 0; j < fInfo->trackerList[i].count; j++)
     629            [subTrackers addObject: [NSString stringWithFormat: @"http://%s:%d",
     630                fInfo->trackerList[i].list[j].address, fInfo->trackerList[i].list[j].port]];
     631       
     632        [trackers addObject: subTrackers];
     633    }
     634   
     635    return trackers;
    618636}
    619637
Note: See TracChangeset for help on using the changeset viewer.