1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-31 03:12:44 +00:00

show N/A for peer counts when there hasn't been a scrape/announce yet

This commit is contained in:
Mitchell Livingston 2009-09-28 15:16:23 +00:00
parent 32c197a985
commit 79b5c3e596
3 changed files with 15 additions and 9 deletions

View file

@ -316,6 +316,9 @@ trackerNew( tr_announcer * announcer,
tracker->announce = tr_strdup( announce );
tracker->scrape = tr_strdup( scrape );
generateKeyParam( tracker->key_param, KEYLEN );
tracker->seederCount = -1;
tracker->leecherCount = -1;
tracker->downloadCount = -1;
return tracker;
}

View file

@ -1232,7 +1232,7 @@ void tr_torrentPeersFree( tr_peer_stat * peerStats,
typedef struct
{
/* how many downloads this tracker knows of */
/* how many downloads this tracker knows of (-1 means it does not know) */
int downloadCount;
/* whether or not we've ever sent this tracker an announcement */
@ -1293,7 +1293,7 @@ typedef struct
if "hasScraped" is false, this field is undefined */
time_t lastScrapeTime;
/* number of leechers this tracker knows of */
/* number of leechers this tracker knows of (-1 means it does not know) */
int leecherCount;
/* when the next periodic announce message will be sent out.
@ -1304,7 +1304,7 @@ typedef struct
if "willScrape" is false, this field is undefined */
time_t nextScrapeTime;
/* number of seeders this tracker knows of */
/* number of seeders this tracker knows of (-1 means it does not know) */
int seederCount;
/* which tier this tracker is in */

View file

@ -134,20 +134,23 @@ NSMutableSet * fTrackerIconLoading;
[nameString drawInRect: nameRect];
//count strings
NSString * seederBaseString = [NSLocalizedString(@"Seeders", "tracker peer stat") stringByAppendingFormat: @": %d",
[node totalSeeders]];
NSString * seederBaseString = [NSLocalizedString(@"Seeders", "tracker peer stat") stringByAppendingFormat: @": %@",
[node totalSeeders] != -1 ? [NSString stringWithFormat: @"%d", [node totalSeeders]]
: NSLocalizedString(@"N/A", "tracker peer stat")];
NSAttributedString * seederString = [self attributedStatusWithString: seederBaseString color: statusColor];
const NSRect seederRect = [self rectForCountWithString: seederString withAboveRect: nameRect inBounds: cellFrame];
[seederString drawInRect: seederRect];
NSString * leecherBaseString = [NSLocalizedString(@"Leechers", "tracker peer stat") stringByAppendingFormat: @": %d",
[node totalLeechers]];
NSString * leecherBaseString = [NSLocalizedString(@"Leechers", "tracker peer stat") stringByAppendingFormat: @": %@",
[node totalLeechers] != -1 ? [NSString stringWithFormat: @"%d", [node totalLeechers]]
: NSLocalizedString(@"N/A", "tracker peer stat")];
NSAttributedString * leecherString = [self attributedStatusWithString: leecherBaseString color: statusColor];
const NSRect leecherRect = [self rectForCountWithString: leecherString withAboveRect: seederRect inBounds: cellFrame];
[leecherString drawInRect: leecherRect];
NSString * downloadedBaseString = [NSLocalizedString(@"Downloaded", "tracker peer stat") stringByAppendingFormat: @": %d",
[node totalDownloaded]];
NSString * downloadedBaseString = [NSLocalizedString(@"Downloaded", "tracker peer stat") stringByAppendingFormat: @": %@",
[node totalDownloaded] != -1 ? [NSString stringWithFormat: @"%d", [node totalDownloaded]]
: NSLocalizedString(@"N/A", "tracker peer stat")];
NSAttributedString * downloadedString = [self attributedStatusWithString: downloadedBaseString color: statusColor];
const NSRect downloadedRect = [self rectForCountWithString: downloadedString withAboveRect: leecherRect inBounds: cellFrame];
[downloadedString drawInRect: downloadedRect];