diff --git a/macosx/InfoWindowController.h b/macosx/InfoWindowController.h index 5fc43d82c..3eef7ed4c 100644 --- a/macosx/InfoWindowController.h +++ b/macosx/InfoWindowController.h @@ -31,7 +31,7 @@ @interface InfoWindowController : NSWindowController { NSArray * fTorrents, * fPeers, * fFiles; - NSImage * fAppIcon, * fDotGreen, * fDotRed, * fLockImage; + NSImage * fAppIcon, * fLockImage; BOOL fCanResizeVertical; diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index 5bbcf32d4..fe9988876 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -67,8 +67,6 @@ { //get images fAppIcon = [NSImage imageNamed: @"NSApplicationIcon"]; - fDotGreen = [NSImage imageNamed: @"GreenDot.tiff"]; - fDotRed = [NSImage imageNamed: @"RedDot.tiff"]; //window location and size NSPanel * window = (NSPanel *)[self window]; @@ -798,9 +796,7 @@ NSString * ident = [column identifier]; NSDictionary * peer = [fPeers objectAtIndex: row]; - if ([ident isEqualToString: @"Connected"]) - return [[peer objectForKey: @"Connected"] boolValue] ? fDotGreen : fDotRed; - else if ([ident isEqualToString: @"Encryption"]) + if ([ident isEqualToString: @"Encryption"]) { if ([[peer objectForKey: @"Encryption"] boolValue]) { @@ -814,7 +810,7 @@ else if ([ident isEqualToString: @"Client"]) return [peer objectForKey: @"Client"]; else if ([ident isEqualToString: @"Progress"]) - return [peer objectForKey: @"Progress"]; //returning nil is fine + return [peer objectForKey: @"Progress"]; else if ([ident isEqualToString: @"UL To"]) { NSNumber * rate; @@ -831,15 +827,6 @@ return nil; } -- (void) tableView: (NSTableView *) tableView willDisplayCell: (id) cell forTableColumn: (NSTableColumn *) tableColumn row: (int) row -{ - if (tableView == fPeerTable) - { - if ([[tableColumn identifier] isEqualToString: @"Progress"]) - [cell setHidden: ![[[fPeers objectAtIndex: row] objectForKey: @"Connected"] boolValue]]; - } -} - - (void) tableView: (NSTableView *) tableView didClickTableColumn: (NSTableColumn *) tableColumn { if (tableView == fPeerTable) @@ -854,7 +841,7 @@ } } -- (BOOL) tableView: (NSTableView *) tableView shouldSelectRow:(int) row +- (BOOL) tableView: (NSTableView *) tableView shouldSelectRow: (int) row { return tableView != fPeerTable; } @@ -867,15 +854,12 @@ NSDictionary * peer = [fPeers objectAtIndex: row]; NSMutableArray * components = [NSMutableArray arrayWithCapacity: 4]; - if ([[peer objectForKey: @"Connected"] boolValue]) - { - [components addObject: [NSString stringWithFormat: - NSLocalizedString(@"Progress: %.1f%%", "Inspector -> Peers tab -> table row tooltip"), - [[peer objectForKey: @"Progress"] floatValue] * 100.0]]; - - if ([[peer objectForKey: @"Encryption"] boolValue]) - [components addObject: NSLocalizedString(@"Encrypted Connection", "Inspector -> Peers tab -> table row tooltip")]; - } + [components addObject: [NSString stringWithFormat: + NSLocalizedString(@"Progress: %.1f%%", "Inspector -> Peers tab -> table row tooltip"), + [[peer objectForKey: @"Progress"] floatValue] * 100.0]]; + + if ([[peer objectForKey: @"Encryption"] boolValue]) + [components addObject: NSLocalizedString(@"Encrypted Connection", "Inspector -> Peers tab -> table row tooltip")]; int port; if ((port = [[peer objectForKey: @"Port"] intValue]) > 0) @@ -901,7 +885,7 @@ - (NSArray *) peerSortDescriptors { - NSMutableArray * descriptors = [NSMutableArray array]; + NSMutableArray * descriptors = [NSMutableArray arrayWithCapacity: 2]; NSArray * oldDescriptors = [fPeerTable sortDescriptors]; BOOL useSecond = YES, asc = YES; diff --git a/macosx/NSStringAdditions.h b/macosx/NSStringAdditions.h index e6440ad0b..b3fa254aa 100644 --- a/macosx/NSStringAdditions.h +++ b/macosx/NSStringAdditions.h @@ -35,6 +35,5 @@ + (NSString *) stringForRatio: (float) ratio; - (NSComparisonResult) compareIP: (NSString *) string; -- (NSComparisonResult) clientCompare: (NSString *) string; @end diff --git a/macosx/NSStringAdditions.m b/macosx/NSStringAdditions.m index b0c2acbfe..0314a0b4d 100644 --- a/macosx/NSStringAdditions.m +++ b/macosx/NSStringAdditions.m @@ -122,19 +122,4 @@ return NSOrderedSame; } -- (NSComparisonResult) clientCompare: (NSString *) string -{ - BOOL selfBlank = [self isEqualToString: @""], - newBlank = [string isEqualToString: @""]; - - if (selfBlank && newBlank) - return NSOrderedSame; - else if (selfBlank) - return NSOrderedDescending; - else if (newBlank) - return NSOrderedAscending; - else - return [self caseInsensitiveCompare: string]; -} - @end diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 1e6c06a8b..b751fd658 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -803,26 +803,17 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void * peer = &peers[i]; dic = [NSMutableDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithBool: peer->isConnected], @"Connected", [NSNumber numberWithInt: peer->from], @"From", [NSString stringWithCString: (char *) peer->addr encoding: NSUTF8StringEncoding], @"IP", - [NSNumber numberWithInt: peer->port], @"Port", nil]; + [NSNumber numberWithInt: peer->port], @"Port", + [NSNumber numberWithFloat: peer->progress], @"Progress", + [NSNumber numberWithBool: peer->isEncrypted], @"Encryption", + [NSString stringWithCString: (char *)peer->client encoding: NSUTF8StringEncoding], @"Client", nil]; - if (peer->isConnected) - { - [dic setObject: [NSNumber numberWithFloat: peer->progress] forKey: @"Progress"]; - - if (peer->isDownloading) - [dic setObject: [NSNumber numberWithFloat: peer->uploadToRate] forKey: @"UL To Rate"]; - if (peer->isUploading) - [dic setObject: [NSNumber numberWithFloat: peer->downloadFromRate] forKey: @"DL From Rate"]; - - [dic setObject: [NSNumber numberWithBool: peer->isEncrypted] forKey: @"Encryption"]; - - [dic setObject: [NSString stringWithCString: (char *)peer->client encoding: NSUTF8StringEncoding] forKey: @"Client"]; - } - else - [dic setObject: @"" forKey: @"Client"]; //needed to be set here for client sort + if (peer->isDownloading) + [dic setObject: [NSNumber numberWithFloat: peer->uploadToRate] forKey: @"UL To Rate"]; + if (peer->isUploading) + [dic setObject: [NSNumber numberWithFloat: peer->downloadFromRate] forKey: @"DL From Rate"]; [peerDics addObject: dic]; } @@ -945,16 +936,16 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void * if (fStalled) string = [NSLocalizedString(@"Stalled, ", "Torrent -> status string") stringByAppendingString: string]; - - //append even if error - if ([self isActive] && ![self isChecking]) - { - if (fStat->status == TR_STATUS_DOWNLOAD) - string = [string stringByAppendingFormat: @" - DL: %@, UL: %@", - [NSString stringForSpeed: [self downloadRate]], [NSString stringForSpeed: [self uploadRate]]]; - else - string = [string stringByAppendingFormat: @" - UL: %@", [NSString stringForSpeed: [self uploadRate]]]; - } + } + + //append even if error + if ([self isActive] && ![self isChecking]) + { + if (fStat->status == TR_STATUS_DOWNLOAD) + string = [string stringByAppendingFormat: @" - DL: %@, UL: %@", + [NSString stringForSpeed: [self downloadRate]], [NSString stringForSpeed: [self uploadRate]]]; + else + string = [string stringByAppendingFormat: @" - UL: %@", [NSString stringForSpeed: [self uploadRate]]]; } return string; diff --git a/macosx/en.lproj/InfoWindow.nib/keyedobjects.nib b/macosx/en.lproj/InfoWindow.nib/keyedobjects.nib index 938498c9b..bd3b9ae22 100644 Binary files a/macosx/en.lproj/InfoWindow.nib/keyedobjects.nib and b/macosx/en.lproj/InfoWindow.nib/keyedobjects.nib differ