Changeset 6325


Ignore:
Timestamp:
Jul 11, 2008, 9:48:43 PM (13 years ago)
Author:
livings124
Message:

#1042: show "in progress" in the inspector when announcing/scraping

Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoWindowController.m

    r6262 r6325  
    13961396   
    13971397    int announceNext = [torrent nextAnnounceTime];
    1398     [fAnnounceNextField setStringValue: announceNext > 0 ? [NSString timeString: announceNext showSeconds: YES] : @""];
     1398    NSString * announceNextString;
     1399    switch (announceNext)
     1400    {
     1401        case STAT_TIME_NOW:
     1402            announceNextString = [NSLocalizedString(@"In progress", "Inspector -> tracker tab") stringByAppendingEllipsis];
     1403            break;
     1404        case STAT_TIME_NONE:
     1405            announceNextString = @"";
     1406            break;
     1407        default:
     1408            announceNextString = [NSString timeString: announceNext showSeconds: YES];
     1409    }
     1410    [fAnnounceNextField setStringValue: announceNextString];
    13991411   
    14001412    //scrape fields
     
    14191431   
    14201432    int scrapeNext = [torrent nextScrapeTime];
    1421     [fScrapeNextField setStringValue: scrapeNext > 0 ? [NSString timeString: scrapeNext showSeconds: YES] : @""];
     1433    NSString * scrapeNextString;
     1434    switch (scrapeNext)
     1435    {
     1436        case STAT_TIME_NOW:
     1437            scrapeNextString = [NSLocalizedString(@"In progress", "Inspector -> tracker tab") stringByAppendingEllipsis];
     1438            break;
     1439        case STAT_TIME_NONE:
     1440            scrapeNextString = @"";
     1441            break;
     1442        default:
     1443            scrapeNextString = [NSString timeString: scrapeNext showSeconds: YES];
     1444    }
     1445    [fScrapeNextField setStringValue: scrapeNextString];
    14221446}
    14231447
  • trunk/macosx/Torrent.h

    r6265 r6325  
    3434    TORRENT_FILE_DEFAULT
    3535} torrentFileState;
     36
     37#define STAT_TIME_NONE -1
     38#define STAT_TIME_NOW -2
    3639
    3740@interface Torrent : NSObject
  • trunk/macosx/Torrent.m

    r6265 r6325  
    734734{
    735735    int date = fStat->nextAnnounceTime;
    736     if (date <= 0)
    737         return -1;
    738    
    739     NSTimeInterval difference = [[NSDate dateWithTimeIntervalSince1970: date] timeIntervalSinceNow];
    740     return difference > 0 ? (int)difference : -1;
     736    NSTimeInterval difference;
     737    switch (date)
     738    {
     739        case 0:
     740            return STAT_TIME_NONE;
     741        case 1:
     742            return STAT_TIME_NOW;
     743        default:
     744            difference = [[NSDate dateWithTimeIntervalSince1970: date] timeIntervalSinceNow];
     745            return difference > 0 ? (int)difference : STAT_TIME_NONE;
     746    }
    741747}
    742748
     
    760766{
    761767    int date = fStat->nextScrapeTime;
    762     if (date <= 0)
    763         return -1;
    764    
    765     NSTimeInterval difference = [[NSDate dateWithTimeIntervalSince1970: date] timeIntervalSinceNow];
    766     return difference > 0 ? (int)difference : -1;
     768    NSTimeInterval difference;
     769    switch (date)
     770    {
     771        case 0:
     772            return STAT_TIME_NONE;
     773        case 1:
     774            return STAT_TIME_NOW;
     775        default:
     776            difference = [[NSDate dateWithTimeIntervalSince1970: date] timeIntervalSinceNow];
     777            return difference > 0 ? (int)difference : STAT_TIME_NONE;
     778    }
    767779}
    768780
Note: See TracChangeset for help on using the changeset viewer.