1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 09:37:56 +00:00

make the web seed table a little more efficient

This commit is contained in:
Mitchell Livingston 2008-06-08 16:38:15 +00:00
parent c83daab843
commit 31a467a790
3 changed files with 26 additions and 10 deletions

View file

@ -171,9 +171,8 @@ typedef enum
[[fPeerTable tableColumnWithIdentifier: @"DL From"] setHeaderToolTip: NSLocalizedString(@"Downloading From Peer",
"inspector -> peer table -> header tool tip")];
#warning add tooltip for webseeds?
[[fWebSeedTable tableColumnWithIdentifier: @"DL From"] setHeaderToolTip: NSLocalizedString(@"Downloading From Web Seeder",
"inspector -> peer table -> header tool tip")];
"inspector -> web seed table -> header tool tip")];
}
else
{
@ -466,10 +465,15 @@ typedef enum
[fPiecesControl setEnabled: YES];
[fPiecesView setTorrent: torrent];
//get webseers for table
[fWebSeeds release];
fWebSeeds = [[torrent webSeeders] retain];
[self setWebSeederTableHidden: [fWebSeeds count] == 0 animate: YES];
//get webseeders for table - if no webseeds for this torrent, clear the table
BOOL hasWebSeeds = [torrent webSeedCount] > 0;
[self setWebSeederTableHidden: !hasWebSeeds animate: YES];
if (!hasWebSeeds)
{
[fWebSeeds release];
fWebSeeds = nil;
[fWebSeedTable reloadData];
}
//get trackers for table
[fTrackers release];
@ -692,10 +696,12 @@ typedef enum
case TAB_PEERS_TAG:
//if in the middle of animating, just stop and resize immediately
if (fWebSeedTableAnimation)
[self setWebSeederTableHidden: !fWebSeeds || [fWebSeeds count] == 0 animate: NO];
[self setWebSeederTableHidden: !fWebSeeds animate: NO];
[fPeers release];
fPeers = nil;
[fWebSeeds release];
fWebSeeds = nil;
oldResizeSaveKey = @"InspectorContentHeightPeers";
break;
@ -1466,9 +1472,12 @@ typedef enum
fPeers = [[[torrent peers] sortedArrayUsingDescriptors: [self peerSortDescriptors]] retain];
[fPeerTable reloadData];
[fWebSeeds release];
fWebSeeds = [[[torrent webSeeders] sortedArrayUsingDescriptors: [fWebSeedTable sortDescriptors]] retain];
[fWebSeedTable reloadData];
if ([torrent webSeedCount] > 0)
{
[fWebSeeds release];
fWebSeeds = [[[torrent webSeeders] sortedArrayUsingDescriptors: [fWebSeedTable sortDescriptors]] retain];
[fWebSeedTable reloadData];
}
}
- (void) updateInfoFiles

View file

@ -189,6 +189,8 @@ typedef enum
- (NSString *) errorMessage;
- (NSArray *) peers;
- (NSUInteger) webSeedCount;
- (NSArray *) webSeeders;
- (NSString *) progressString;

View file

@ -1016,6 +1016,11 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
return peerDicts;
}
- (NSUInteger) webSeedCount
{
return fInfo->webseedCount;
}
- (NSArray *) webSeeders
{
int webSeedCount = fInfo->webseedCount, i;