mirror of
https://github.com/transmission/transmission
synced 2024-12-26 17:47:37 +00:00
show a checkmark in the peer inspector for partial seeds and reflect that status in the tooltip
This commit is contained in:
parent
b9b67ee2c2
commit
932815e400
4 changed files with 38 additions and 4 deletions
|
@ -28,6 +28,7 @@
|
||||||
#import "FileOutlineView.h"
|
#import "FileOutlineView.h"
|
||||||
#import "FileOutlineController.h"
|
#import "FileOutlineController.h"
|
||||||
#import "FileListNode.h"
|
#import "FileListNode.h"
|
||||||
|
#import "PeerProgressIndicatorCell.h"
|
||||||
#import "TrackerTableView.h"
|
#import "TrackerTableView.h"
|
||||||
#import "PiecesView.h"
|
#import "PiecesView.h"
|
||||||
#import "QuickLookController.h"
|
#import "QuickLookController.h"
|
||||||
|
@ -910,6 +911,21 @@ typedef enum
|
||||||
return nil;
|
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
|
- (void) tableView: (NSTableView *) tableView didClickTableColumn: (NSTableColumn *) tableColumn
|
||||||
{
|
{
|
||||||
if (tableView == fPeerTable)
|
if (tableView == fPeerTable)
|
||||||
|
@ -964,8 +980,17 @@ typedef enum
|
||||||
NSDictionary * peer = [fPeers objectAtIndex: row];
|
NSDictionary * peer = [fPeers objectAtIndex: row];
|
||||||
NSMutableArray * components = [NSMutableArray arrayWithCapacity: 5];
|
NSMutableArray * components = [NSMutableArray arrayWithCapacity: 5];
|
||||||
|
|
||||||
[components addObject: [NSString localizedStringWithFormat: NSLocalizedString(@"Progress: %.1f%%",
|
CGFloat progress = [[peer objectForKey: @"Progress"] floatValue];
|
||||||
"Inspector -> Peers tab -> table row tooltip"), [[peer objectForKey: @"Progress"] floatValue] * 100.0]];
|
|
||||||
|
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])
|
if ([[peer objectForKey: @"Encryption"] boolValue])
|
||||||
[components addObject: NSLocalizedString(@"Encrypted Connection", "Inspector -> Peers tab -> table row tooltip")];
|
[components addObject: NSLocalizedString(@"Encrypted Connection", "Inspector -> Peers tab -> table row tooltip")];
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
@interface PeerProgressIndicatorCell : NSLevelIndicatorCell
|
@interface PeerProgressIndicatorCell : NSLevelIndicatorCell
|
||||||
{
|
{
|
||||||
NSDictionary * fAttributes;
|
NSDictionary * fAttributes;
|
||||||
|
BOOL fSeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setSeed: (BOOL) seed;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -40,6 +40,11 @@
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setSeed: (BOOL) seed
|
||||||
|
{
|
||||||
|
fSeed = seed;
|
||||||
|
}
|
||||||
|
|
||||||
- (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) controlView
|
- (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) controlView
|
||||||
{
|
{
|
||||||
if ([[NSUserDefaults standardUserDefaults] boolForKey: @"DisplayPeerProgressBarNumber"])
|
if ([[NSUserDefaults standardUserDefaults] boolForKey: @"DisplayPeerProgressBarNumber"])
|
||||||
|
@ -58,7 +63,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
[super drawWithFrame: cellFrame inView: controlView];
|
[super drawWithFrame: cellFrame inView: controlView];
|
||||||
if ([self floatValue] >= 1.0f)
|
if (fSeed)
|
||||||
{
|
{
|
||||||
NSImage * checkImage = [NSImage imageNamed: @"CompleteCheck.png"];
|
NSImage * checkImage = [NSImage imageNamed: @"CompleteCheck.png"];
|
||||||
[checkImage setFlipped: YES];
|
[checkImage setFlipped: YES];
|
||||||
|
|
|
@ -1038,12 +1038,13 @@ void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, vo
|
||||||
for (int i = 0; i < totalPeers; i++)
|
for (int i = 0; i < totalPeers; i++)
|
||||||
{
|
{
|
||||||
tr_peer_stat * peer = &peers[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: [NSNumber numberWithInt: peer->from] forKey: @"From"];
|
||||||
[dict setObject: [NSString stringWithUTF8String: peer->addr] forKey: @"IP"];
|
[dict setObject: [NSString stringWithUTF8String: peer->addr] forKey: @"IP"];
|
||||||
[dict setObject: [NSNumber numberWithInt: peer->port] forKey: @"Port"];
|
[dict setObject: [NSNumber numberWithInt: peer->port] forKey: @"Port"];
|
||||||
[dict setObject: [NSNumber numberWithFloat: peer->progress] forKey: @"Progress"];
|
[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: [NSNumber numberWithBool: peer->isEncrypted] forKey: @"Encryption"];
|
||||||
[dict setObject: [NSString stringWithUTF8String: peer->client] forKey: @"Client"];
|
[dict setObject: [NSString stringWithUTF8String: peer->client] forKey: @"Client"];
|
||||||
[dict setObject: [NSString stringWithUTF8String: peer->flagStr] forKey: @"Flags"];
|
[dict setObject: [NSString stringWithUTF8String: peer->flagStr] forKey: @"Flags"];
|
||||||
|
|
Loading…
Reference in a new issue