Changeset 1283


Ignore:
Timestamp:
Dec 26, 2006, 9:02:00 PM (16 years ago)
Author:
livings124
Message:

manual announce in mac gui...only useable once per minute for each torrent

Location:
trunk/macosx
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r1119 r1283  
    140140- (void) revealFile: (id) sender;
    141141
     142- (void) announceSelectedTorrents: (id) sender;
     143
    142144- (void) showPreferenceWindow: (id) sender;
    143145
  • trunk/macosx/Controller.m

    r1257 r1283  
    6161#define UPDATE_UI_SECONDS           1.0
    6262#define AUTO_SPEED_LIMIT_SECONDS    5.0
     63
     64#define ANNOUNCE_WAIT_INTERVAL_SECONDS  -60.0
    6365
    6466#define WEBSITE_URL @"http://transmission.m0k.org/"
     
    10651067- (void) revealFile: (id) sender
    10661068{
    1067     NSIndexSet * indexSet = [fTableView selectedRowIndexes];
    1068     unsigned int i;
    1069     for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
    1070         [[fDisplayedTorrents objectAtIndex: i] revealData];
     1069    NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator];
     1070    Torrent * torrent;
     1071    while ((torrent = [enumerator nextObject]))
     1072        [torrent revealData];
     1073}
     1074
     1075- (void) announceSelectedTorrents: (id) sender
     1076{
     1077    NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator];
     1078    Torrent * torrent;
     1079    NSDate * date;
     1080    while ((torrent = [enumerator nextObject]))
     1081    {
     1082        //time interval returned will be negative
     1083        if (!(date = [torrent announceDate]) || [date timeIntervalSinceNow] <= ANNOUNCE_WAIT_INTERVAL_SECONDS)
     1084            [torrent announce];
     1085    }
    10711086}
    10721087
     
    24732488    }
    24742489   
     2490    //enable announce item
     2491    if (action == @selector(announceSelectedTorrents:))
     2492    {
     2493        if (!canUseTable)
     2494            return NO;
     2495       
     2496        NSEnumerator * enumerator = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] objectEnumerator];
     2497        Torrent * torrent;
     2498        NSDate * date;
     2499        while ((torrent = [enumerator nextObject]))
     2500        {
     2501            //time interval returned will be negative
     2502            if ([torrent isActive] &&
     2503                    (!(date = [torrent announceDate]) || [date timeIntervalSinceNow] <= ANNOUNCE_WAIT_INTERVAL_SECONDS))
     2504                return YES;
     2505        }
     2506        return NO;
     2507    }
     2508   
    24752509    //enable copy torrent file item
    24762510    if (action == @selector(copyTorrentFile:))
  • trunk/macosx/English.lproj/MainMenu.nib/classes.nib

    r1102 r1283  
    44        {
    55            ACTIONS = {
     6                announceSelectedTorrents = id;
    67                applyFilter = id;
    78                applySpeedLimit = id;
  • trunk/macosx/English.lproj/MainMenu.nib/info.nib

    r1216 r1283  
    3333        <array>
    3434                <integer>21</integer>
    35                 <integer>1848</integer>
    36                 <integer>29</integer>
    3735        </array>
    3836        <key>IBSystem Version</key>
  • trunk/macosx/InfoWindowController.m

    r1276 r1283  
    294294   
    295295    Torrent * torrent = [fTorrents objectAtIndex: 0];
    296     NSString * tracker = [[torrent tracker] stringByAppendingString: [torrent announce]];
     296    NSString * tracker = [[torrent trackerAddress] stringByAppendingString: [torrent trackerAddressAnnounce]];
    297297    [fTrackerField setStringValue: tracker];
    298298    [fTrackerField setToolTip: tracker];
  • trunk/macosx/Torrent.h

    r1242 r1283  
    3838   
    3939    BOOL         fResumeOnWake;
    40     NSDate       * fDate;
     40    NSDate       * fDate, * fAnnounceDate;
    4141   
    4242    BOOL        fUseIncompleteFolder;
     
    8282- (void)        wakeUp;
    8383
     84- (void)        announce;
     85- (NSDate *)    announceDate;
     86
    8487- (float)       ratio;
    8588- (int)         stopRatioSetting;
     
    106109- (NSString *) name;
    107110- (uint64_t)   size;
    108 - (NSString *) tracker;
    109 - (NSString *) announce;
     111- (NSString *) trackerAddress;
     112- (NSString *) trackerAddressAnnounce;
    110113
    111114- (NSString *) comment;
  • trunk/macosx/Torrent.m

    r1256 r1283  
    160160       
    161161        [fDate release];
     162       
     163        if (fAnnounceDate)
     164            [fAnnounceDate release];
    162165       
    163166        [fIcon release];
     
    463466}
    464467
     468- (void) announce
     469{
     470    if (![self isActive])
     471        return;
     472   
     473    tr_manualUpdate(fHandle);
     474   
     475    if (fAnnounceDate)
     476        [fAnnounceDate release];
     477    fAnnounceDate = [[NSDate date] retain];
     478}
     479
     480- (NSDate *) announceDate
     481{
     482    return fAnnounceDate;
     483}
     484
    465485- (float) ratio
    466486{
     
    699719}
    700720
    701 - (NSString *) tracker
     721- (NSString *) trackerAddress
    702722{
    703723    return [NSString stringWithFormat: @"http://%s:%d", fStat->trackerAddress, fStat->trackerPort];
    704724}
    705725
    706 - (NSString *) announce
     726- (NSString *) trackerAddressAnnounce
    707727{
    708728    return [NSString stringWithUTF8String: fStat->trackerAnnounce];
Note: See TracChangeset for help on using the changeset viewer.