1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-03 10:15:45 +00:00

Status in peers tab.

This commit is contained in:
Mitchell Livingston 2006-08-15 02:28:38 +00:00
parent c7dd11ea4f
commit e907f7a370
5 changed files with 56 additions and 56 deletions

View file

@ -257,7 +257,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; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = transmissioncli; sourceTree = BUILT_PRODUCTS_DIR; };
4DDBB71909E16BAE00284745 /* transmissioncli */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; 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>"; };

View file

@ -30,6 +30,7 @@
fLeechersField = NSTextField;
fNameField = NSTextField;
fPeerTable = NSTableView;
fPeerTableStatusField = NSTextField;
fPieceSizeField = NSTextField;
fPiecesField = NSTextField;
fRatioField = NSTextField;

View file

@ -46,7 +46,10 @@
* fRatioField, * fSeedersField, * fLeechersField,
* fConnectedPeersField, * fDownloadingFromField, * fUploadingToField;
IBOutlet NSTableView * fPeerTable, * fFileTable;
IBOutlet NSTableView * fPeerTable;
IBOutlet NSTextField * fPeerTableStatusField;
IBOutlet NSTableView * fFileTable;
IBOutlet NSMatrix * fRatioMatrix;
IBOutlet NSTextField * fRatioLimitField;

View file

@ -41,8 +41,8 @@
//15 spacing at the bottom of each tab
#define TAB_INFO_HEIGHT 182.0
#define TAB_ACTIVITY_HEIGHT 214.0
#define TAB_PEERS_HEIGHT 250.0
#define TAB_FILES_HEIGHT 250.0
#define TAB_PEERS_HEIGHT 255.0
#define TAB_FILES_HEIGHT 255.0
#define TAB_OPTIONS_HEIGHT 116.0
@interface InfoWindowController (Private)
@ -107,8 +107,7 @@
{
if (numberSelected > 0)
{
[fNameField setStringValue: [NSString stringWithFormat:
@"%d Torrents Selected", numberSelected]];
[fNameField setStringValue: [NSString stringWithFormat: @"%d Torrents Selected", numberSelected]];
uint64_t size = 0;
NSEnumerator * enumerator = [torrents objectEnumerator];
@ -166,6 +165,10 @@
[fConnectedPeersField setStringValue: @""];
[fDownloadingFromField setStringValue: @""];
[fUploadingToField setStringValue: @""];
[fPeers removeAllObjects];
[fPeerTable reloadData];
[fPeerTableStatusField setStringValue: @"info not available"];
}
else
{
@ -222,62 +225,55 @@
- (void) updateInfoStats
{
int numberSelected = [fTorrents count];
if (numberSelected > 0)
if (numberSelected == 0)
return;
float downloadedValid = 0;
uint64_t downloadedTotal = 0, uploadedTotal = 0;
Torrent * torrent;
NSEnumerator * enumerator = [fTorrents objectEnumerator];
while ((torrent = [enumerator nextObject]))
{
float downloadedValid = 0;
uint64_t downloadedTotal = 0, uploadedTotal = 0;
Torrent * torrent;
NSEnumerator * enumerator = [fTorrents objectEnumerator];
while ((torrent = [enumerator nextObject]))
{
downloadedValid += [torrent downloadedValid];
downloadedTotal += [torrent downloadedTotal];
uploadedTotal += [torrent uploadedTotal];
}
[fDownloadedValidField setStringValue: [NSString stringForFileSize: downloadedValid]];
[fDownloadedTotalField setStringValue: [NSString stringForFileSize: downloadedTotal]];
[fUploadedTotalField setStringValue: [NSString stringForFileSize: uploadedTotal]];
if (numberSelected == 1)
{
torrent = [fTorrents objectAtIndex: 0];
[fStateField setStringValue: [torrent stateString]];
/*
[fPercentField setStringValue: [NSString stringWithFormat: @"%.2f%%", 100.0 * [torrent progress]]];
*/
int seeders = [torrent seeders], leechers = [torrent leechers];
[fSeedersField setStringValue: seeders < 0 ?
@"" : [NSString stringWithInt: seeders]];
[fLeechersField setStringValue: leechers < 0 ?
@"" : [NSString stringWithInt: leechers]];
BOOL active = [torrent isActive];
[fConnectedPeersField setStringValue: active ? [NSString
stringWithInt: [torrent totalPeers]] : @""];
[fDownloadingFromField setStringValue: active ? [NSString
stringWithInt: [torrent peersUploading]] : @""];
[fUploadingToField setStringValue: active ? [NSString
stringWithInt: [torrent peersDownloading]] : @""];
[fRatioField setStringValue: [NSString stringForRatioWithDownload:
downloadedTotal upload: uploadedTotal]];
}
downloadedValid += [torrent downloadedValid];
downloadedTotal += [torrent downloadedTotal];
uploadedTotal += [torrent uploadedTotal];
}
//set peers table
[fDownloadedValidField setStringValue: [NSString stringForFileSize: downloadedValid]];
[fDownloadedTotalField setStringValue: [NSString stringForFileSize: downloadedTotal]];
[fUploadedTotalField setStringValue: [NSString stringForFileSize: uploadedTotal]];
if (numberSelected == 1)
{
[fPeers setArray: [[fTorrents objectAtIndex: 0] peers]];
torrent = [fTorrents objectAtIndex: 0];
[fStateField setStringValue: [torrent stateString]];
/*
[fPercentField setStringValue: [NSString stringWithFormat: @"%.2f%%", 100.0 * [torrent progress]]];
*/
int seeders = [torrent seeders], leechers = [torrent leechers];
[fSeedersField setStringValue: seeders < 0 ? @"" : [NSString stringWithInt: seeders]];
[fLeechersField setStringValue: leechers < 0 ? @"" : [NSString stringWithInt: leechers]];
BOOL active = [torrent isActive];
[fConnectedPeersField setStringValue: active ? [NSString
stringWithInt: [torrent totalPeers]] : @""];
[fDownloadingFromField setStringValue: active ? [NSString
stringWithInt: [torrent peersUploading]] : @""];
[fUploadingToField setStringValue: active ? [NSString
stringWithInt: [torrent peersDownloading]] : @""];
[fRatioField setStringValue: [NSString stringForRatioWithDownload: downloadedTotal upload: uploadedTotal]];
//set peers table
[fPeers setArray: [torrent peers]];
[fPeers sortUsingDescriptors: [self peerSortDescriptors]];
}
else
[fPeers removeAllObjects];
[fPeerTable deselectAll: nil];
[fPeerTable reloadData];
[fPeerTable reloadData];
[fPeerTableStatusField setStringValue: [NSString stringWithFormat: @"%d of %d connected",
[torrent totalPeers], [fPeers count]]];
}
}
- (void) updateInfoStatsAndSettings