Changeset 1550


Ignore:
Timestamp:
Mar 8, 2007, 5:12:09 PM (15 years ago)
Author:
livings124
Message:

peers tab shows count of where peers came from

Location:
branches/pex/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/pex/macosx/English.lproj/InfoWindow.nib/info.nib

    r1295 r1550  
    44<dict>
    55        <key>IBDocumentLocation</key>
    6         <string>34 67 356 240 0 0 1152 842 </string>
     6        <string>29 56 356 240 0 0 1024 746 </string>
    77        <key>IBEditorPositions</key>
    88        <dict>
  • branches/pex/macosx/InfoWindowController.m

    r1546 r1550  
    4040#define TAB_INFO_HEIGHT 284.0
    4141#define TAB_ACTIVITY_HEIGHT 170.0
    42 #define TAB_PEERS_HEIGHT 268.0
    43 #define TAB_FILES_HEIGHT 268.0
     42#define TAB_PEERS_HEIGHT 279.0
     43#define TAB_FILES_HEIGHT 279.0
    4444#define TAB_OPTIONS_HEIGHT 117.0
    4545
     
    197197        [fLeechersField setStringValue: @""];
    198198        [fCompletedFromTrackerField setStringValue: @""];
    199         [fConnectedPeersField setStringValue: @""];
     199        [fConnectedPeersField setStringValue: NSLocalizedString(@"info not available", "Inspector -> Peers tab -> peers")];
    200200        [fDownloadingFromField setStringValue: @""];
    201201        [fUploadingToField setStringValue: @""];
     
    383383   
    384384    BOOL active = [torrent isActive];
    385     [fConnectedPeersField setStringValue: active ? [NSString stringWithFormat: NSLocalizedString(@"%d (%d incoming)",
    386                                                                                 "Inspector -> Peers tab -> connected"),
    387                                                     [torrent totalPeers], [torrent totalPeersIncoming]]: @""];
     385   
     386    if (active)
     387    {
     388        int left = [torrent totalPeers], count;
     389        NSMutableString * connected = [NSMutableString stringWithFormat:
     390                                        NSLocalizedString(@"%d Connected", "Inspector -> Peers tab -> peers"), left];
     391       
     392        if (left > 0)
     393        {
     394            [connected appendString: @": "];
     395            if ((count = [torrent totalPeersTracker]) > 0)
     396            {
     397                [connected appendFormat: NSLocalizedString(@"%d tracker", "Inspector -> Peers tab -> peers"), count];
     398                if ((left -= count) > 0)
     399                    [connected appendString: @", "];
     400            }
     401            if (left > 0 && (count = [torrent totalPeersIncoming]) > 0)
     402            {
     403                [connected appendFormat: NSLocalizedString(@"%d incoming", "Inspector -> Peers tab -> peers"), count];
     404                if ((left -= count) > 0)
     405                    [connected appendString: @", "];
     406            }
     407            if (left > 0 && (count = [torrent totalPeersPex]) > 0)
     408            {
     409                [connected appendFormat: NSLocalizedString(@"%d PEX", "Inspector -> Peers tab -> peers"), count];
     410                if ((left -= count) > 0)
     411                    [connected appendString: @", "];
     412            }
     413            if (left > 0 && (count = [torrent totalPeersCache]) > 0)
     414                [connected appendFormat: NSLocalizedString(@"%d cache", "Inspector -> Peers tab -> peers"), count];
     415        }
     416        [fConnectedPeersField setStringValue: connected];
     417    }
     418    else
     419        [fConnectedPeersField setStringValue: NSLocalizedString(@"info not available", "Inspector -> Peers tab -> peers")];
     420   
    388421    [fDownloadingFromField setStringValue: active ? [NSString stringWithInt: [torrent peersUploading]] : @""];
    389422    [fUploadingToField setStringValue: active ? [NSString stringWithInt: [torrent peersDownloading]] : @""];
Note: See TracChangeset for help on using the changeset viewer.