mirror of
https://github.com/transmission/transmission
synced 2025-02-25 15:32:33 +00:00
remove "connected dot" from peer inspector, and append speed string properly to torrents with errors
This commit is contained in:
parent
60a983d845
commit
a388c58a05
6 changed files with 29 additions and 70 deletions
|
@ -31,7 +31,7 @@
|
|||
@interface InfoWindowController : NSWindowController
|
||||
{
|
||||
NSArray * fTorrents, * fPeers, * fFiles;
|
||||
NSImage * fAppIcon, * fDotGreen, * fDotRed, * fLockImage;
|
||||
NSImage * fAppIcon, * fLockImage;
|
||||
|
||||
BOOL fCanResizeVertical;
|
||||
|
||||
|
|
|
@ -67,8 +67,6 @@
|
|||
{
|
||||
//get images
|
||||
fAppIcon = [NSImage imageNamed: @"NSApplicationIcon"];
|
||||
fDotGreen = [NSImage imageNamed: @"GreenDot.tiff"];
|
||||
fDotRed = [NSImage imageNamed: @"RedDot.tiff"];
|
||||
|
||||
//window location and size
|
||||
NSPanel * window = (NSPanel *)[self window];
|
||||
|
@ -798,9 +796,7 @@
|
|||
NSString * ident = [column identifier];
|
||||
NSDictionary * peer = [fPeers objectAtIndex: row];
|
||||
|
||||
if ([ident isEqualToString: @"Connected"])
|
||||
return [[peer objectForKey: @"Connected"] boolValue] ? fDotGreen : fDotRed;
|
||||
else if ([ident isEqualToString: @"Encryption"])
|
||||
if ([ident isEqualToString: @"Encryption"])
|
||||
{
|
||||
if ([[peer objectForKey: @"Encryption"] boolValue])
|
||||
{
|
||||
|
@ -814,7 +810,7 @@
|
|||
else if ([ident isEqualToString: @"Client"])
|
||||
return [peer objectForKey: @"Client"];
|
||||
else if ([ident isEqualToString: @"Progress"])
|
||||
return [peer objectForKey: @"Progress"]; //returning nil is fine
|
||||
return [peer objectForKey: @"Progress"];
|
||||
else if ([ident isEqualToString: @"UL To"])
|
||||
{
|
||||
NSNumber * rate;
|
||||
|
@ -831,15 +827,6 @@
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (void) tableView: (NSTableView *) tableView willDisplayCell: (id) cell forTableColumn: (NSTableColumn *) tableColumn row: (int) row
|
||||
{
|
||||
if (tableView == fPeerTable)
|
||||
{
|
||||
if ([[tableColumn identifier] isEqualToString: @"Progress"])
|
||||
[cell setHidden: ![[[fPeers objectAtIndex: row] objectForKey: @"Connected"] boolValue]];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) tableView: (NSTableView *) tableView didClickTableColumn: (NSTableColumn *) tableColumn
|
||||
{
|
||||
if (tableView == fPeerTable)
|
||||
|
@ -854,7 +841,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (BOOL) tableView: (NSTableView *) tableView shouldSelectRow:(int) row
|
||||
- (BOOL) tableView: (NSTableView *) tableView shouldSelectRow: (int) row
|
||||
{
|
||||
return tableView != fPeerTable;
|
||||
}
|
||||
|
@ -867,15 +854,12 @@
|
|||
NSDictionary * peer = [fPeers objectAtIndex: row];
|
||||
NSMutableArray * components = [NSMutableArray arrayWithCapacity: 4];
|
||||
|
||||
if ([[peer objectForKey: @"Connected"] boolValue])
|
||||
{
|
||||
[components addObject: [NSString stringWithFormat:
|
||||
NSLocalizedString(@"Progress: %.1f%%", "Inspector -> Peers tab -> table row tooltip"),
|
||||
[[peer objectForKey: @"Progress"] floatValue] * 100.0]];
|
||||
|
||||
if ([[peer objectForKey: @"Encryption"] boolValue])
|
||||
[components addObject: NSLocalizedString(@"Encrypted Connection", "Inspector -> Peers tab -> table row tooltip")];
|
||||
}
|
||||
[components addObject: [NSString stringWithFormat:
|
||||
NSLocalizedString(@"Progress: %.1f%%", "Inspector -> Peers tab -> table row tooltip"),
|
||||
[[peer objectForKey: @"Progress"] floatValue] * 100.0]];
|
||||
|
||||
if ([[peer objectForKey: @"Encryption"] boolValue])
|
||||
[components addObject: NSLocalizedString(@"Encrypted Connection", "Inspector -> Peers tab -> table row tooltip")];
|
||||
|
||||
int port;
|
||||
if ((port = [[peer objectForKey: @"Port"] intValue]) > 0)
|
||||
|
@ -901,7 +885,7 @@
|
|||
|
||||
- (NSArray *) peerSortDescriptors
|
||||
{
|
||||
NSMutableArray * descriptors = [NSMutableArray array];
|
||||
NSMutableArray * descriptors = [NSMutableArray arrayWithCapacity: 2];
|
||||
|
||||
NSArray * oldDescriptors = [fPeerTable sortDescriptors];
|
||||
BOOL useSecond = YES, asc = YES;
|
||||
|
|
|
@ -35,6 +35,5 @@
|
|||
+ (NSString *) stringForRatio: (float) ratio;
|
||||
|
||||
- (NSComparisonResult) compareIP: (NSString *) string;
|
||||
- (NSComparisonResult) clientCompare: (NSString *) string;
|
||||
|
||||
@end
|
||||
|
|
|
@ -122,19 +122,4 @@
|
|||
return NSOrderedSame;
|
||||
}
|
||||
|
||||
- (NSComparisonResult) clientCompare: (NSString *) string
|
||||
{
|
||||
BOOL selfBlank = [self isEqualToString: @""],
|
||||
newBlank = [string isEqualToString: @""];
|
||||
|
||||
if (selfBlank && newBlank)
|
||||
return NSOrderedSame;
|
||||
else if (selfBlank)
|
||||
return NSOrderedDescending;
|
||||
else if (newBlank)
|
||||
return NSOrderedAscending;
|
||||
else
|
||||
return [self caseInsensitiveCompare: string];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -803,26 +803,17 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
peer = &peers[i];
|
||||
|
||||
dic = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithBool: peer->isConnected], @"Connected",
|
||||
[NSNumber numberWithInt: peer->from], @"From",
|
||||
[NSString stringWithCString: (char *) peer->addr encoding: NSUTF8StringEncoding], @"IP",
|
||||
[NSNumber numberWithInt: peer->port], @"Port", nil];
|
||||
[NSNumber numberWithInt: peer->port], @"Port",
|
||||
[NSNumber numberWithFloat: peer->progress], @"Progress",
|
||||
[NSNumber numberWithBool: peer->isEncrypted], @"Encryption",
|
||||
[NSString stringWithCString: (char *)peer->client encoding: NSUTF8StringEncoding], @"Client", nil];
|
||||
|
||||
if (peer->isConnected)
|
||||
{
|
||||
[dic setObject: [NSNumber numberWithFloat: peer->progress] forKey: @"Progress"];
|
||||
|
||||
if (peer->isDownloading)
|
||||
[dic setObject: [NSNumber numberWithFloat: peer->uploadToRate] forKey: @"UL To Rate"];
|
||||
if (peer->isUploading)
|
||||
[dic setObject: [NSNumber numberWithFloat: peer->downloadFromRate] forKey: @"DL From Rate"];
|
||||
|
||||
[dic setObject: [NSNumber numberWithBool: peer->isEncrypted] forKey: @"Encryption"];
|
||||
|
||||
[dic setObject: [NSString stringWithCString: (char *)peer->client encoding: NSUTF8StringEncoding] forKey: @"Client"];
|
||||
}
|
||||
else
|
||||
[dic setObject: @"" forKey: @"Client"]; //needed to be set here for client sort
|
||||
if (peer->isDownloading)
|
||||
[dic setObject: [NSNumber numberWithFloat: peer->uploadToRate] forKey: @"UL To Rate"];
|
||||
if (peer->isUploading)
|
||||
[dic setObject: [NSNumber numberWithFloat: peer->downloadFromRate] forKey: @"DL From Rate"];
|
||||
|
||||
[peerDics addObject: dic];
|
||||
}
|
||||
|
@ -945,16 +936,16 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
|
|||
|
||||
if (fStalled)
|
||||
string = [NSLocalizedString(@"Stalled, ", "Torrent -> status string") stringByAppendingString: string];
|
||||
|
||||
//append even if error
|
||||
if ([self isActive] && ![self isChecking])
|
||||
{
|
||||
if (fStat->status == TR_STATUS_DOWNLOAD)
|
||||
string = [string stringByAppendingFormat: @" - DL: %@, UL: %@",
|
||||
[NSString stringForSpeed: [self downloadRate]], [NSString stringForSpeed: [self uploadRate]]];
|
||||
else
|
||||
string = [string stringByAppendingFormat: @" - UL: %@", [NSString stringForSpeed: [self uploadRate]]];
|
||||
}
|
||||
}
|
||||
|
||||
//append even if error
|
||||
if ([self isActive] && ![self isChecking])
|
||||
{
|
||||
if (fStat->status == TR_STATUS_DOWNLOAD)
|
||||
string = [string stringByAppendingFormat: @" - DL: %@, UL: %@",
|
||||
[NSString stringForSpeed: [self downloadRate]], [NSString stringForSpeed: [self uploadRate]]];
|
||||
else
|
||||
string = [string stringByAppendingFormat: @" - UL: %@", [NSString stringForSpeed: [self uploadRate]]];
|
||||
}
|
||||
|
||||
return string;
|
||||
|
|
BIN
macosx/en.lproj/InfoWindow.nib/keyedobjects.nib
generated
BIN
macosx/en.lproj/InfoWindow.nib/keyedobjects.nib
generated
Binary file not shown.
Loading…
Reference in a new issue