Changeset 12081


Ignore:
Timestamp:
Mar 4, 2011, 2:58:08 AM (11 years ago)
Author:
livings124
Message:

#4072 Remove "known" field in Inspector->Peers

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/InfoPeersViewController.m

    r11970 r12081  
    139139        [fWebSeeds removeAllObjects];
    140140   
    141     NSUInteger known = 0, connected = 0, tracker = 0, incoming = 0, cache = 0, lpd = 0, pex = 0, dht = 0, ltep = 0,
     141    NSUInteger connected = 0, tracker = 0, incoming = 0, cache = 0, lpd = 0, pex = 0, dht = 0, ltep = 0,
    142142                toUs = 0, fromUs = 0;
    143143    BOOL anyActive = false;
     
    146146        if ([torrent webSeedCount] > 0)
    147147            [fWebSeeds addObjectsFromArray: [torrent webSeeds]];
    148        
    149         known += [torrent totalPeersKnown];
    150148       
    151149        if ([torrent isActive])
     
    178176    [fWebSeedTable reloadData];
    179177   
    180     NSString * knownString = [NSString stringWithFormat: NSLocalizedString(@"%d known", "Inspector -> Peers tab -> peers"), known];
    181178    if (anyActive)
    182179    {
     
    186183        if (connected > 0)
    187184        {
    188             NSMutableArray * fromComponents = [NSMutableArray arrayWithCapacity: 7];
    189             if (tracker > 0)
    190                 [fromComponents addObject: [NSString stringWithFormat:
    191                                         NSLocalizedString(@"%d tracker", "Inspector -> Peers tab -> peers"), tracker]];
    192             if (incoming > 0)
    193                 [fromComponents addObject: [NSString stringWithFormat:
    194                                         NSLocalizedString(@"%d incoming", "Inspector -> Peers tab -> peers"), incoming]];
    195             if (cache > 0)
    196                 [fromComponents addObject: [NSString stringWithFormat:
    197                                         NSLocalizedString(@"%d cache", "Inspector -> Peers tab -> peers"), cache]];
    198             if (lpd > 0)
    199                 [fromComponents addObject: [NSString stringWithFormat:
    200                                         NSLocalizedString(@"%d local discovery", "Inspector -> Peers tab -> peers"), lpd]];
    201             if (pex > 0)
    202                 [fromComponents addObject: [NSString stringWithFormat:
    203                                         NSLocalizedString(@"%d PEX", "Inspector -> Peers tab -> peers"), pex]];
    204             if (dht > 0)
    205                 [fromComponents addObject: [NSString stringWithFormat:
    206                                         NSLocalizedString(@"%d DHT", "Inspector -> Peers tab -> peers"), dht]];
    207             if (ltep > 0)
    208                 [fromComponents addObject: [NSString stringWithFormat:
    209                                         NSLocalizedString(@"%d LTEP", "Inspector -> Peers tab -> peers"), ltep]];
    210            
    211             NSMutableArray * upDownComponents = [NSMutableArray arrayWithCapacity: 3];
     185            NSMutableArray * upDownComponents = [NSMutableArray arrayWithCapacity: 2];
    212186            if (toUs > 0)
    213187                [upDownComponents addObject: [NSString stringWithFormat:
     
    216190                [upDownComponents addObject: [NSString stringWithFormat:
    217191                                        NSLocalizedString(@"UL to %d", "Inspector -> Peers tab -> peers"), fromUs]];
    218             [upDownComponents addObject: knownString];
     192            if ([upDownComponents count] > 0)
     193                connectedText = [connectedText stringByAppendingFormat: @": %@", [upDownComponents componentsJoinedByString: @", "]];
    219194           
    220             connectedText = [connectedText stringByAppendingFormat: @": %@\n%@", [fromComponents componentsJoinedByString: @", "],
    221                                 [upDownComponents componentsJoinedByString: @", "]];
    222         }
     195            NSMutableArray * fromComponents = [NSMutableArray arrayWithCapacity: 7];
     196            if (tracker > 0)
     197                [fromComponents addObject: [NSString stringWithFormat:
     198                                        NSLocalizedString(@"%d tracker", "Inspector -> Peers tab -> peers"), tracker]];
     199            if (incoming > 0)
     200                [fromComponents addObject: [NSString stringWithFormat:
     201                                        NSLocalizedString(@"%d incoming", "Inspector -> Peers tab -> peers"), incoming]];
     202            if (cache > 0)
     203                [fromComponents addObject: [NSString stringWithFormat:
     204                                        NSLocalizedString(@"%d cache", "Inspector -> Peers tab -> peers"), cache]];
     205            if (lpd > 0)
     206                [fromComponents addObject: [NSString stringWithFormat:
     207                                        NSLocalizedString(@"%d local discovery", "Inspector -> Peers tab -> peers"), lpd]];
     208            if (pex > 0)
     209                [fromComponents addObject: [NSString stringWithFormat:
     210                                        NSLocalizedString(@"%d PEX", "Inspector -> Peers tab -> peers"), pex]];
     211            if (dht > 0)
     212                [fromComponents addObject: [NSString stringWithFormat:
     213                                        NSLocalizedString(@"%d DHT", "Inspector -> Peers tab -> peers"), dht]];
     214            if (ltep > 0)
     215                [fromComponents addObject: [NSString stringWithFormat:
     216                                        NSLocalizedString(@"%d LTEP", "Inspector -> Peers tab -> peers"), ltep]];
     217           
     218            connectedText = [connectedText stringByAppendingFormat: @"\n%@", [fromComponents componentsJoinedByString: @", "]];
     219        }
     220       
     221        [fConnectedPeersField setStringValue: connectedText];
     222    }
     223    else
     224    {
     225        NSString * notActiveString;
     226        if ([fTorrents count] == 1)
     227            notActiveString = NSLocalizedString(@"Transfer Not Active", "Inspector -> Peers tab -> peers");
    223228        else
    224             connectedText = [connectedText stringByAppendingFormat: @"\n%@", knownString];
    225        
    226         [fConnectedPeersField setStringValue: connectedText];
    227     }
    228     else
    229     {
    230         NSString * activeString;
    231         if ([fTorrents count] == 1)
    232             activeString = NSLocalizedString(@"Transfer Not Active", "Inspector -> Peers tab -> peers");
    233         else
    234             activeString = NSLocalizedString(@"Transfers Not Active", "Inspector -> Peers tab -> peers");
    235        
    236         NSString * connectedText = [activeString stringByAppendingFormat: @"\n%@", knownString];
    237         [fConnectedPeersField setStringValue: connectedText];
     229            notActiveString = NSLocalizedString(@"Transfers Not Active", "Inspector -> Peers tab -> peers");
     230       
     231        [fConnectedPeersField setStringValue: notActiveString];
    238232    }
    239233}
  • trunk/macosx/InfoWindowController.m

    r11876 r12081  
    451451        else
    452452        {
     453            #warning change to NSImageNameApplicationIcon
    453454            [fImageView setImage: [NSImage imageNamed: @"NSApplicationIcon"]];
    454455            [fNoneSelectedField setHidden: NO];
Note: See TracChangeset for help on using the changeset viewer.