Changeset 7246


Ignore:
Timestamp:
Dec 3, 2008, 12:18:18 AM (12 years ago)
Author:
livings124
Message:

show a checkmark in the peer inspector for partial seeds and reflect that status in the tooltip

Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoWindowController.m

    r7153 r7246  
    2929#import "FileOutlineController.h"
    3030#import "FileListNode.h"
     31#import "PeerProgressIndicatorCell.h"
    3132#import "TrackerTableView.h"
    3233#import "PiecesView.h"
     
    911912}
    912913
     914- (void) tableView: (NSTableView *) tableView willDisplayCell: (id) cell forTableColumn: (NSTableColumn *) tableColumn
     915    row: (NSInteger) row
     916{
     917    if (tableView == fPeerTable)
     918    {
     919        NSString * ident = [tableColumn identifier];
     920       
     921        if  ([ident isEqualToString: @"Progress"])
     922        {
     923            NSDictionary * peer = [fPeers objectAtIndex: row];
     924            [(PeerProgressIndicatorCell *)cell setSeed: [[peer objectForKey: @"Seed"] boolValue]];
     925        }
     926    }
     927}
     928
    913929- (void) tableView: (NSTableView *) tableView didClickTableColumn: (NSTableColumn *) tableColumn
    914930{
     
    965981        NSMutableArray * components = [NSMutableArray arrayWithCapacity: 5];
    966982       
    967         [components addObject: [NSString localizedStringWithFormat: NSLocalizedString(@"Progress: %.1f%%",
    968             "Inspector -> Peers tab -> table row tooltip"), [[peer objectForKey: @"Progress"] floatValue] * 100.0]];
     983        CGFloat progress = [[peer objectForKey: @"Progress"] floatValue];
     984       
     985        NSString * seedStatus;
     986        if (progress < 1.0 && [[peer objectForKey: @"Seed"] boolValue])
     987            seedStatus = [NSString stringWithFormat: @" (%@)", NSLocalizedString(@"Partial Seed",
     988                            "Inspector -> Peers tab -> table row tooltip")];
     989        else
     990            seedStatus = @"";
     991       
     992        [components addObject: [NSString localizedStringWithFormat: NSLocalizedString(@"Progress: %.1f%%%@",
     993            "Inspector -> Peers tab -> table row tooltip"), progress * 100.0, seedStatus]];
    969994       
    970995        if ([[peer objectForKey: @"Encryption"] boolValue])
  • trunk/macosx/PeerProgressIndicatorCell.h

    r5349 r7246  
    2828{
    2929    NSDictionary * fAttributes;
     30    BOOL fSeed;
    3031}
    3132
     33- (void) setSeed: (BOOL) seed;
     34
    3235@end
  • trunk/macosx/PeerProgressIndicatorCell.m

    r6980 r7246  
    4141}
    4242
     43- (void) setSeed: (BOOL) seed
     44{
     45    fSeed = seed;
     46}
     47
    4348- (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) controlView
    4449{
     
    5964       
    6065        [super drawWithFrame: cellFrame inView: controlView];
    61         if ([self floatValue] >= 1.0f)
     66        if (fSeed)
    6267        {
    6368            NSImage * checkImage = [NSImage imageNamed: @"CompleteCheck.png"];
  • trunk/macosx/Torrent.m

    r7199 r7246  
    10391039    {
    10401040        tr_peer_stat * peer = &peers[i];
    1041         NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithCapacity: 9];
     1041        NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithCapacity: 10];
    10421042       
    10431043        [dict setObject: [NSNumber numberWithInt: peer->from] forKey: @"From"];
     
    10451045        [dict setObject: [NSNumber numberWithInt: peer->port] forKey: @"Port"];
    10461046        [dict setObject: [NSNumber numberWithFloat: peer->progress] forKey: @"Progress"];
     1047        [dict setObject: [NSNumber numberWithBool: peer->isSeed] forKey: @"Seed"];
    10471048        [dict setObject: [NSNumber numberWithBool: peer->isEncrypted] forKey: @"Encryption"];
    10481049        [dict setObject: [NSString stringWithUTF8String: peer->client] forKey: @"Client"];
Note: See TracChangeset for help on using the changeset viewer.