#import "FileOutlineView.h"
#import "FileOutlineController.h"
#import "FileListNode.h"
+#import "PeerProgressIndicatorCell.h"
#import "TrackerTableView.h"
#import "PiecesView.h"
#import "QuickLookController.h"
return nil;
}
+- (void) tableView: (NSTableView *) tableView willDisplayCell: (id) cell forTableColumn: (NSTableColumn *) tableColumn
+ row: (NSInteger) row
+{
+ if (tableView == fPeerTable)
+ {
+ NSString * ident = [tableColumn identifier];
+
+ if ([ident isEqualToString: @"Progress"])
+ {
+ NSDictionary * peer = [fPeers objectAtIndex: row];
+ [(PeerProgressIndicatorCell *)cell setSeed: [[peer objectForKey: @"Seed"] boolValue]];
+ }
+ }
+}
+
- (void) tableView: (NSTableView *) tableView didClickTableColumn: (NSTableColumn *) tableColumn
{
if (tableView == fPeerTable)
NSDictionary * peer = [fPeers objectAtIndex: row];
NSMutableArray * components = [NSMutableArray arrayWithCapacity: 5];
- [components addObject: [NSString localizedStringWithFormat: NSLocalizedString(@"Progress: %.1f%%",
- "Inspector -> Peers tab -> table row tooltip"), [[peer objectForKey: @"Progress"] floatValue] * 100.0]];
+ CGFloat progress = [[peer objectForKey: @"Progress"] floatValue];
+
+ NSString * seedStatus;
+ if (progress < 1.0 && [[peer objectForKey: @"Seed"] boolValue])
+ seedStatus = [NSString stringWithFormat: @" (%@)", NSLocalizedString(@"Partial Seed",
+ "Inspector -> Peers tab -> table row tooltip")];
+ else
+ seedStatus = @"";
+
+ [components addObject: [NSString localizedStringWithFormat: NSLocalizedString(@"Progress: %.1f%%%@",
+ "Inspector -> Peers tab -> table row tooltip"), progress * 100.0, seedStatus]];
if ([[peer objectForKey: @"Encryption"] boolValue])
[components addObject: NSLocalizedString(@"Encrypted Connection", "Inspector -> Peers tab -> table row tooltip")];
[super dealloc];
}
+- (void) setSeed: (BOOL) seed
+{
+ fSeed = seed;
+}
+
- (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) controlView
{
if ([[NSUserDefaults standardUserDefaults] boolForKey: @"DisplayPeerProgressBarNumber"])
}
[super drawWithFrame: cellFrame inView: controlView];
- if ([self floatValue] >= 1.0f)
+ if (fSeed)
{
NSImage * checkImage = [NSImage imageNamed: @"CompleteCheck.png"];
[checkImage setFlipped: YES];
for (int i = 0; i < totalPeers; i++)
{
tr_peer_stat * peer = &peers[i];
- NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithCapacity: 9];
+ NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithCapacity: 10];
[dict setObject: [NSNumber numberWithInt: peer->from] forKey: @"From"];
[dict setObject: [NSString stringWithUTF8String: peer->addr] forKey: @"IP"];
[dict setObject: [NSNumber numberWithInt: peer->port] forKey: @"Port"];
[dict setObject: [NSNumber numberWithFloat: peer->progress] forKey: @"Progress"];
+ [dict setObject: [NSNumber numberWithBool: peer->isSeed] forKey: @"Seed"];
[dict setObject: [NSNumber numberWithBool: peer->isEncrypted] forKey: @"Encryption"];
[dict setObject: [NSString stringWithUTF8String: peer->client] forKey: @"Client"];
[dict setObject: [NSString stringWithUTF8String: peer->flagStr] forKey: @"Flags"];