1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 17:17:31 +00:00

move status from peer table column to tooltip

This commit is contained in:
Mitchell Livingston 2007-11-20 13:08:10 +00:00
parent 0a61e04757
commit c37b0c1dad
4 changed files with 41 additions and 30 deletions

View file

@ -788,28 +788,6 @@ typedef enum
NSNumber * rate;
return (rate = [peer objectForKey: @"DL From Rate"]) ? [NSString stringForSpeedAbbrev: [rate floatValue]] : @"";
}
else if ([ident isEqualToString: @"Status"])
{
switch ([[peer objectForKey: @"Status"] intValue])
{
case TR_PEER_STATUS_HANDSHAKE:
return NSLocalizedString(@"Handshaking", "peer -> status");
case TR_PEER_STATUS_PEER_IS_CHOKED:
return NSLocalizedString(@"Peer is Choked", "peer -> status");
case TR_PEER_STATUS_CLIENT_IS_CHOKED:
return NSLocalizedString(@"Choked", "peer -> status");
case TR_PEER_STATUS_CLIENT_IS_INTERESTED:
return NSLocalizedString(@"Choked & Interested", "peer -> status");
case TR_PEER_STATUS_READY:
return NSLocalizedString(@"Ready", "peer -> status");
case TR_PEER_STATUS_REQUEST_SENT:
return NSLocalizedString(@"Request Sent", "peer -> status");
case TR_PEER_STATUS_ACTIVE:
return NSLocalizedString(@"Active", "peer -> status");
case TR_PEER_STATUS_ACTIVE_AND_CHOKED:
return NSLocalizedString(@"Active & Interested", "peer -> status");
}
}
else
return [peer objectForKey: @"IP"];
}
@ -841,7 +819,7 @@ typedef enum
if (tableView == fPeerTable)
{
NSDictionary * peer = [fPeers objectAtIndex: row];
NSMutableArray * components = [NSMutableArray arrayWithCapacity: 4];
NSMutableArray * components = [NSMutableArray arrayWithCapacity: 5];
[components addObject: [NSString stringWithFormat: NSLocalizedString(@"Progress: %.1f%%",
"Inspector -> Peers tab -> table row tooltip"), [[peer objectForKey: @"Progress"] floatValue] * 100.0]];
@ -872,6 +850,34 @@ typedef enum
break;
}
switch ([[peer objectForKey: @"Status"] intValue])
{
case TR_PEER_STATUS_HANDSHAKE:
[components addObject: NSLocalizedString(@"Handshaking", "peer -> status")];
break;
case TR_PEER_STATUS_PEER_IS_CHOKED:
[components addObject: NSLocalizedString(@"Peer is Choked", "peer -> status")];
break;
case TR_PEER_STATUS_CLIENT_IS_CHOKED:
[components addObject: NSLocalizedString(@"Choked", "peer -> status")];
break;
case TR_PEER_STATUS_CLIENT_IS_INTERESTED:
[components addObject: NSLocalizedString(@"Choked & Interested", "peer -> status")];
break;
case TR_PEER_STATUS_READY:
[components addObject: NSLocalizedString(@"Ready", "peer -> status")];
break;
case TR_PEER_STATUS_REQUEST_SENT:
[components addObject: NSLocalizedString(@"Request Sent", "peer -> status")];
break;
case TR_PEER_STATUS_ACTIVE:
[components addObject: NSLocalizedString(@"Active", "peer -> status")];
break;
case TR_PEER_STATUS_ACTIVE_AND_CHOKED:
[components addObject: NSLocalizedString(@"Active & Interested", "peer -> status")];
break;
}
return [components componentsJoinedByString: @"\n"];
}
return nil;

View file

@ -24,6 +24,8 @@
#import "PrefsWindow.h"
#warning elliminate this class
@implementation PrefsWindow
- (void) keyDown: (NSEvent *) event

View file

@ -69,23 +69,26 @@ tr_handle * fLib;
fStatsWindowInstance = nil;
}
#warning make like pref window panel
@end
@implementation StatsWindowController (Private)
- (void) updateStats
{
tr_session_stats stats;
tr_getCumulativeSessionStats(fLib, &stats);
tr_session_stats statsAll, statsSession;
tr_getCumulativeSessionStats(fLib, &statsAll);
tr_getSessionStats(fLib, &statsSession);
[fUploadedField setStringValue: [NSString stringForLargeFileSizeGigs: stats.uploadedGigs bytes: stats.uploadedBytes]];
[fDownloadedField setStringValue: [NSString stringForLargeFileSizeGigs: stats.downloadedGigs bytes: stats.downloadedBytes]];
[fRatioField setStringValue: [NSString stringForRatio: stats.ratio]];
[fUploadedField setStringValue: [NSString stringForLargeFileSizeGigs: statsAll.uploadedGigs bytes: statsAll.uploadedBytes]];
[fDownloadedField setStringValue: [NSString stringForLargeFileSizeGigs: statsAll.downloadedGigs bytes: statsAll.downloadedBytes]];
[fRatioField setStringValue: [NSString stringForRatio: statsAll.ratio]];
[fTimeField setStringValue: [self timeString: stats.secondsActive]];
[fTimeField setStringValue: [self timeString: statsAll.secondsActive]];
[fNumOpenedField setStringValue: [NSString stringWithFormat: NSLocalizedString(@"%d Times", "stats window -> times opened"),
stats.sessionCount]];
statsAll.sessionCount]];
}
- (NSString *) timeString: (uint64_t) seconds