a couple more tweaks to displaying peers and webseeds
This commit is contained in:
parent
0dcfcc8053
commit
5595666310
|
@ -32,7 +32,7 @@
|
|||
|
||||
NSGradient * fHighPriorityGradient, * fLowPriorityGradient, * fMixedPriorityGradient;
|
||||
|
||||
int fMouseRow;
|
||||
NSInteger fMouseRow;
|
||||
}
|
||||
|
||||
- (void) setTorrent: (Torrent *) torrent;
|
||||
|
@ -40,6 +40,6 @@
|
|||
|
||||
- (NSRect) iconRectForRow: (int) row;
|
||||
|
||||
- (int) hoveredRow;
|
||||
- (NSInteger) hoveredRow;
|
||||
|
||||
@end
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
|
||||
- (NSMenu *) menuForEvent: (NSEvent *) event
|
||||
{
|
||||
int row = [self rowAtPoint: [self convertPoint: [event locationInWindow] fromView: nil]];
|
||||
const NSInteger row = [self rowAtPoint: [self convertPoint: [event locationInWindow] fromView: nil]];
|
||||
|
||||
if (row >= 0)
|
||||
{
|
||||
|
@ -123,7 +123,7 @@
|
|||
FileNameCell * cell = (FileNameCell *)[self preparedCellAtColumn: [self columnWithIdentifier: @"Name"] row: row];
|
||||
NSRect iconRect = [cell imageRectForBounds: [self rectOfRow: row]];
|
||||
|
||||
iconRect.origin.x += [self indentationPerLevel] * (float)([self levelForRow: row] + 1);
|
||||
iconRect.origin.x += [self indentationPerLevel] * (CGFloat)([self levelForRow: row] + 1);
|
||||
return iconRect;
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (int) hoveredRow
|
||||
- (NSInteger) hoveredRow
|
||||
{
|
||||
return fMouseRow;
|
||||
}
|
||||
|
@ -191,7 +191,7 @@
|
|||
NSGradient * gradient = nil;
|
||||
|
||||
NSSet * priorities = [fTorrent filePrioritiesForIndexes: indexes];
|
||||
int count = [priorities count];
|
||||
const NSUInteger count = [priorities count];
|
||||
if (count == 1)
|
||||
{
|
||||
switch ([[priorities anyObject] intValue])
|
||||
|
|
|
@ -1565,14 +1565,16 @@ typedef enum
|
|||
BOOL anyActive = false;
|
||||
for (Torrent * torrent in fTorrents)
|
||||
{
|
||||
[fPeers addObjectsFromArray: [torrent peers]];
|
||||
[fWebSeeds addObjectsFromArray: [torrent webSeeds]];
|
||||
if ([torrent webSeedCount] > 0)
|
||||
[fWebSeeds addObjectsFromArray: [torrent webSeeds]];
|
||||
|
||||
known += [torrent totalPeersKnown];
|
||||
|
||||
if ([torrent isActive])
|
||||
{
|
||||
anyActive = YES;
|
||||
[fPeers addObjectsFromArray: [torrent peers]];
|
||||
|
||||
const NSUInteger connectedThis = [torrent totalPeersConnected];
|
||||
if (connectedThis > 0)
|
||||
{
|
||||
|
@ -1649,7 +1651,7 @@ typedef enum
|
|||
else
|
||||
activeString = NSLocalizedString(@"Transfers Not Active", "Inspector -> Peers tab -> peers");
|
||||
|
||||
NSString * connectedText = [NSString stringWithFormat: @"%@\n%@", activeString, knownString];
|
||||
NSString * connectedText = [activeString stringByAppendingFormat: @"\n%@", knownString];
|
||||
[fConnectedPeersField setStringValue: connectedText];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -892,26 +892,23 @@ int trashDataFile(const char * filename)
|
|||
{
|
||||
NSMutableArray * webSeeds = [NSMutableArray arrayWithCapacity: fInfo->webseedCount];
|
||||
|
||||
if (fInfo->webseedCount > 0)
|
||||
float * dlSpeeds = tr_torrentWebSpeeds(fHandle);
|
||||
|
||||
for (NSInteger i = 0; i < fInfo->webseedCount; i++)
|
||||
{
|
||||
float * dlSpeeds = tr_torrentWebSpeeds(fHandle);
|
||||
NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithCapacity: 3];
|
||||
|
||||
for (NSInteger i = 0; i < fInfo->webseedCount; i++)
|
||||
{
|
||||
NSMutableDictionary * dict = [NSMutableDictionary dictionaryWithCapacity: 3];
|
||||
|
||||
[dict setObject: [self name] forKey: @"Name"];
|
||||
[dict setObject: [NSString stringWithUTF8String: fInfo->webseeds[i]] forKey: @"Address"];
|
||||
|
||||
if (dlSpeeds[i] != -1.0)
|
||||
[dict setObject: [NSNumber numberWithFloat: dlSpeeds[i]] forKey: @"DL From Rate"];
|
||||
|
||||
[webSeeds addObject: dict];
|
||||
}
|
||||
[dict setObject: [self name] forKey: @"Name"];
|
||||
[dict setObject: [NSString stringWithUTF8String: fInfo->webseeds[i]] forKey: @"Address"];
|
||||
|
||||
tr_free(dlSpeeds);
|
||||
if (dlSpeeds[i] != -1.0)
|
||||
[dict setObject: [NSNumber numberWithFloat: dlSpeeds[i]] forKey: @"DL From Rate"];
|
||||
|
||||
[webSeeds addObject: dict];
|
||||
}
|
||||
|
||||
tr_free(dlSpeeds);
|
||||
|
||||
return webSeeds;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue