Changeset 784


Ignore:
Timestamp:
Aug 15, 2006, 2:28:38 AM (15 years ago)
Author:
livings124
Message:

Status in peers tab.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Transmission.xcodeproj/project.pbxproj

    r782 r784  
    258258                4DCCBB3C09C3D71100D3CABF /* TorrentCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = TorrentCell.m; path = macosx/TorrentCell.m; sourceTree = "<group>"; };
    259259                4DCCBB3D09C3D71100D3CABF /* TorrentCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = TorrentCell.h; path = macosx/TorrentCell.h; sourceTree = "<group>"; };
    260                 4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; };
     260                4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; };
    261261                4DDBB71B09E16BF100284745 /* transmissioncli.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = transmissioncli.c; path = cli/transmissioncli.c; sourceTree = "<group>"; };
    262262                4DDFDD20099A5D8E00189D81 /* DownloadBadge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = DownloadBadge.png; path = macosx/Images/DownloadBadge.png; sourceTree = "<group>"; };
  • trunk/macosx/English.lproj/InfoWindow.nib/classes.nib

    r771 r784  
    3131                fNameField = NSTextField;
    3232                fPeerTable = NSTableView;
     33                fPeerTableStatusField = NSTextField;
    3334                fPieceSizeField = NSTextField;
    3435                fPiecesField = NSTextField;
  • trunk/macosx/InfoWindowController.h

    r782 r784  
    4747                        * fConnectedPeersField, * fDownloadingFromField, * fUploadingToField;
    4848
    49     IBOutlet NSTableView * fPeerTable, * fFileTable;
     49    IBOutlet NSTableView * fPeerTable;
     50    IBOutlet NSTextField * fPeerTableStatusField;
     51   
     52    IBOutlet NSTableView * fFileTable;
    5053   
    5154    IBOutlet NSMatrix * fRatioMatrix;
  • trunk/macosx/InfoWindowController.m

    r782 r784  
    4242#define TAB_INFO_HEIGHT 182.0
    4343#define TAB_ACTIVITY_HEIGHT 214.0
    44 #define TAB_PEERS_HEIGHT 250.0
    45 #define TAB_FILES_HEIGHT 250.0
     44#define TAB_PEERS_HEIGHT 255.0
     45#define TAB_FILES_HEIGHT 255.0
    4646#define TAB_OPTIONS_HEIGHT 116.0
    4747
     
    108108        if (numberSelected > 0)
    109109        {
    110             [fNameField setStringValue: [NSString stringWithFormat:
    111                             @"%d Torrents Selected", numberSelected]];
     110            [fNameField setStringValue: [NSString stringWithFormat: @"%d Torrents Selected", numberSelected]];
    112111       
    113112            uint64_t size = 0;
     
    167166        [fDownloadingFromField setStringValue: @""];
    168167        [fUploadingToField setStringValue: @""];
     168       
     169        [fPeers removeAllObjects];
     170        [fPeerTable reloadData];
     171        [fPeerTableStatusField setStringValue: @"info not available"];
    169172    }
    170173    else
     
    223226{
    224227    int numberSelected = [fTorrents count];
    225     if (numberSelected > 0)
    226     {
    227         float downloadedValid = 0;
    228         uint64_t downloadedTotal = 0, uploadedTotal = 0;
    229         Torrent * torrent;
    230         NSEnumerator * enumerator = [fTorrents objectEnumerator];
    231         while ((torrent = [enumerator nextObject]))
    232         {
    233             downloadedValid += [torrent downloadedValid];
    234             downloadedTotal += [torrent downloadedTotal];
    235             uploadedTotal += [torrent uploadedTotal];
    236         }
    237 
    238         [fDownloadedValidField setStringValue: [NSString stringForFileSize: downloadedValid]];
    239         [fDownloadedTotalField setStringValue: [NSString stringForFileSize: downloadedTotal]];
    240         [fUploadedTotalField setStringValue: [NSString stringForFileSize: uploadedTotal]];
    241    
    242         if (numberSelected == 1)
    243         {
    244             torrent = [fTorrents objectAtIndex: 0];
    245 
    246             [fStateField setStringValue: [torrent stateString]];
     228    if (numberSelected == 0)
     229        return;
     230   
     231    float downloadedValid = 0;
     232    uint64_t downloadedTotal = 0, uploadedTotal = 0;
     233    Torrent * torrent;
     234    NSEnumerator * enumerator = [fTorrents objectEnumerator];
     235    while ((torrent = [enumerator nextObject]))
     236    {
     237        downloadedValid += [torrent downloadedValid];
     238        downloadedTotal += [torrent downloadedTotal];
     239        uploadedTotal += [torrent uploadedTotal];
     240    }
     241
     242    [fDownloadedValidField setStringValue: [NSString stringForFileSize: downloadedValid]];
     243    [fDownloadedTotalField setStringValue: [NSString stringForFileSize: downloadedTotal]];
     244    [fUploadedTotalField setStringValue: [NSString stringForFileSize: uploadedTotal]];
     245
     246    if (numberSelected == 1)
     247    {
     248        torrent = [fTorrents objectAtIndex: 0];
     249
     250        [fStateField setStringValue: [torrent stateString]];
    247251/*
    248             [fPercentField setStringValue: [NSString stringWithFormat: @"%.2f%%", 100.0 * [torrent progress]]];
     252        [fPercentField setStringValue: [NSString stringWithFormat: @"%.2f%%", 100.0 * [torrent progress]]];
    249253*/
    250             int seeders = [torrent seeders], leechers = [torrent leechers];
    251             [fSeedersField setStringValue: seeders < 0 ?
    252                 @"" : [NSString stringWithInt: seeders]];
    253             [fLeechersField setStringValue: leechers < 0 ?
    254                 @"" : [NSString stringWithInt: leechers]];
    255            
    256             BOOL active = [torrent isActive];
    257            
    258             [fConnectedPeersField setStringValue: active ? [NSString
    259                     stringWithInt: [torrent totalPeers]] : @""];
    260             [fDownloadingFromField setStringValue: active ? [NSString
    261                     stringWithInt: [torrent peersUploading]] : @""];
    262             [fUploadingToField setStringValue: active ? [NSString
    263                     stringWithInt: [torrent peersDownloading]] : @""];
    264            
    265             [fRatioField setStringValue: [NSString stringForRatioWithDownload:
    266                                         downloadedTotal upload: uploadedTotal]];
    267         }
    268     }
    269    
    270     //set peers table
    271     if (numberSelected == 1)
    272     {
    273         [fPeers setArray: [[fTorrents objectAtIndex: 0] peers]];
     254        int seeders = [torrent seeders], leechers = [torrent leechers];
     255        [fSeedersField setStringValue: seeders < 0 ? @"" : [NSString stringWithInt: seeders]];
     256        [fLeechersField setStringValue: leechers < 0 ? @"" : [NSString stringWithInt: leechers]];
     257       
     258        BOOL active = [torrent isActive];
     259       
     260        [fConnectedPeersField setStringValue: active ? [NSString
     261                stringWithInt: [torrent totalPeers]] : @""];
     262        [fDownloadingFromField setStringValue: active ? [NSString
     263                stringWithInt: [torrent peersUploading]] : @""];
     264        [fUploadingToField setStringValue: active ? [NSString
     265                stringWithInt: [torrent peersDownloading]] : @""];
     266       
     267        [fRatioField setStringValue: [NSString stringForRatioWithDownload: downloadedTotal upload: uploadedTotal]];
     268       
     269        //set peers table
     270        [fPeers setArray: [torrent peers]];
    274271        [fPeers sortUsingDescriptors: [self peerSortDescriptors]];
    275     }
    276     else
    277         [fPeers removeAllObjects];
    278    
    279     [fPeerTable deselectAll: nil];
    280     [fPeerTable reloadData];
     272   
     273        [fPeerTable reloadData];
     274        [fPeerTableStatusField setStringValue: [NSString stringWithFormat: @"%d of %d connected",
     275                                                [torrent totalPeers], [fPeers count]]];
     276    }
    281277}
    282278
Note: See TracChangeset for help on using the changeset viewer.