Check for connected peers, as well as better peer table resizing behavior.

This commit is contained in:
Mitchell Livingston
2006-08-15 00:59:44 +00:00
parent 20bcc5101b
commit 199bb19e14
7 changed files with 12 additions and 4 deletions
+1 -1
View File
@@ -255,7 +255,7 @@
4DA6FDC4091141AD00450CB1 /* ResumeOn.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ResumeOn.png; path = macosx/Images/ResumeOn.png; sourceTree = "<group>"; };
4DCCBB3C09C3D71100D3CABF /* TorrentCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = TorrentCell.m; path = macosx/TorrentCell.m; sourceTree = "<group>"; };
4DCCBB3D09C3D71100D3CABF /* TorrentCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = TorrentCell.h; path = macosx/TorrentCell.h; sourceTree = "<group>"; };
4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; };
4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; };
4DDBB71B09E16BF100284745 /* transmissioncli.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = transmissioncli.c; path = cli/transmissioncli.c; sourceTree = "<group>"; };
4DDFDD20099A5D8E00189D81 /* DownloadBadge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = DownloadBadge.png; path = macosx/Images/DownloadBadge.png; sourceTree = "<group>"; };
4DDFDD21099A5D8E00189D81 /* UploadBadge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = UploadBadge.png; path = macosx/Images/UploadBadge.png; sourceTree = "<group>"; };
+3
View File
@@ -506,7 +506,10 @@ tr_peer_stat_t * tr_torrentPeers( tr_torrent_t * tor, int * peerCount )
inet_ntop( AF_INET, addr, peers[i].addr,
sizeof( peers[i].addr ) );
}
peers[i].client = tr_clientForId(tr_peerId(peer));
peers[i].isConnected = tr_peerIsConnected(peer);
peers[i].isDownloading = tr_peerIsDownloading(peer);
peers[i].isUploading = tr_peerIsUploading(peer);
}
+1
View File
@@ -328,6 +328,7 @@ struct tr_peer_stat_s
char addr[INET_ADDRSTRLEN];
char * client;
int isConnected;
int isDownloading;
int isUploading;
};
Binary file not shown.
+1 -1
View File
@@ -30,7 +30,7 @@
{
NSArray * fTorrents;
NSMutableArray * fPeers, * fFiles;
NSImage * fAppIcon;
NSImage * fAppIcon, * fCheckImage;
IBOutlet NSTabView * fTabView;
+5 -2
View File
@@ -56,6 +56,7 @@
- (void) awakeFromNib
{
fAppIcon = [[NSApp applicationIconImage] copy];
fCheckImage = [NSImage imageNamed: @"NSMenuCheckmark"];
fTorrents = [[NSArray alloc] init];
fPeers = [[NSMutableArray alloc] initWithCapacity: 6];
@@ -433,7 +434,7 @@
- (int) numberOfRowsInTableView: (NSTableView *) tableView
{
if (tableView == fPeerTable)
return [fTorrents count] == 1 ? [[fTorrents objectAtIndex: 0] totalPeers] : 0;
return [fPeers count];
else if (tableView == fFileTable)
return [fFiles count];
else
@@ -447,7 +448,9 @@
{
NSDictionary * peer = [fPeers objectAtIndex: row];
if ([ident isEqualToString: @"UL To"])
if ([ident isEqualToString: @"Connected"])
return [[peer objectForKey: @"Connected"] boolValue] ? fCheckImage : nil;
else if ([ident isEqualToString: @"UL To"])
return [[peer objectForKey: @"UL To"] boolValue] ? @"Y" : @"";
else if ([ident isEqualToString: @"DL From"])
return [[peer objectForKey: @"DL From"] boolValue] ? @"Y" : @"";
+1
View File
@@ -528,6 +528,7 @@
peer = peers[i];
[peerDics addObject: [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool: peer.isConnected], @"Connected",
[NSString stringWithCString: (char *) peer.addr encoding: NSUTF8StringEncoding], @"IP",
[NSString stringWithCString: (char *) peer.client encoding: NSUTF8StringEncoding], @"Client",
[NSNumber numberWithBool: peer.isDownloading], @"UL To",