diff --git a/Transmission.xcodeproj/project.pbxproj b/Transmission.xcodeproj/project.pbxproj index ea4a28f6d..7d82330b0 100644 --- a/Transmission.xcodeproj/project.pbxproj +++ b/Transmission.xcodeproj/project.pbxproj @@ -51,6 +51,7 @@ 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; A200B9200A22798F007BBB1E /* InfoWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A200B83A0A2263BA007BBB1E /* InfoWindowController.m */; }; A200B9B60A22893D007BBB1E /* InfoWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = A200B9620A227FD0007BBB1E /* InfoWindow.nib */; }; + A2041D530C9AC523000ACFFB /* Lock.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A2041D520C9AC523000ACFFB /* Lock.tiff */; }; A2085DDC0C53BC74000BC3B7 /* AboutWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A2085DDA0C53BC74000BC3B7 /* AboutWindowController.m */; }; A2085E020C53C16F000BC3B7 /* AboutWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = A2085E000C53C16F000BC3B7 /* AboutWindow.nib */; }; A2085E3F0C53C949000BC3B7 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = A2085E2F0C53C833000BC3B7 /* LICENSE */; }; @@ -342,6 +343,7 @@ A200B8390A2263BA007BBB1E /* InfoWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InfoWindowController.h; path = macosx/InfoWindowController.h; sourceTree = ""; }; A200B83A0A2263BA007BBB1E /* InfoWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InfoWindowController.m; path = macosx/InfoWindowController.m; sourceTree = ""; }; A200B9630A227FD0007BBB1E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = macosx/English.lproj/InfoWindow.nib; sourceTree = ""; }; + A2041D520C9AC523000ACFFB /* Lock.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = Lock.tiff; path = macosx/Images/Lock.tiff; sourceTree = ""; }; A204310F0C5EAF490081E5CC /* Russian */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Russian; path = macosx/Russian.lproj/AboutWindow.nib; sourceTree = ""; }; A20431100C5EAF490081E5CC /* Russian */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = Russian; path = macosx/Russian.lproj/InfoPlist.strings; sourceTree = ""; }; A20431110C5EAF490081E5CC /* Russian */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Russian; path = macosx/Russian.lproj/InfoWindow.nib; sourceTree = ""; }; @@ -758,6 +760,7 @@ A20B6FAD0C4D9B040034AB1D /* PriorityNormal.png */, A20B6F6A0C4D842B0034AB1D /* PriorityLow.png */, A20B6F820C4D8A610034AB1D /* PriorityHigh.png */, + A2041D520C9AC523000ACFFB /* Lock.tiff */, A2FB06950BFF484A0095564D /* Globe.png */, A261A8250C6A0D68003BAFDA /* Error.png */, A29C8B320ACC6E93000ED9F9 /* YellowDot.tiff */, @@ -1336,6 +1339,7 @@ A277DA0C0C693D9C00DA2CD4 /* ActionOff.png in Resources */, A261A8260C6A0D68003BAFDA /* Error.png in Resources */, A2EF7DEC0C96297400FA9811 /* PurpleDot.png in Resources */, + A2041D530C9AC523000ACFFB /* Lock.tiff in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/macosx/Controller.m b/macosx/Controller.m index fa70de3dc..dba7b32e6 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -92,10 +92,9 @@ #define FORUM_URL @"http://transmission.m0k.org/forum/" #define DONATE_URL @"http://transmission.m0k.org/donate.php" -static void sleepCallBack(void * controller, io_service_t y, natural_t messageType, void * messageArgument) +void sleepCallBack(void * controller, io_service_t y, natural_t messageType, void * messageArgument) { - Controller * c = controller; - [c sleepCallBack: messageType argument: messageArgument]; + [(Controller *)controller sleepCallBack: messageType argument: messageArgument]; } @implementation Controller @@ -302,11 +301,11 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy //register for sleep notifications IONotificationPortRef notify; io_object_t iterator; - if (fRootPort = IORegisterForSystemPower(self, & notify, sleepCallBack, & iterator)) + if ((fRootPort = IORegisterForSystemPower(self, & notify, sleepCallBack, & iterator)) != 0) CFRunLoopAddSource(CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(notify), kCFRunLoopCommonModes); else NSLog(@"Could not IORegisterForSystemPower"); - + //load previous transfers NSArray * history = [[NSArray alloc] initWithContentsOfFile: [[self applicationSupportFolder] stringByAppendingPathComponent: @"Transfers.plist"]]; @@ -3083,7 +3082,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy break; case kIOMessageCanSystemSleep: - allowSleep = YES; if ([fDefaults boolForKey: @"SleepPrevent"]) { diff --git a/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib b/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib index dee2d1cca..c63b4cfe8 100644 Binary files a/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib and b/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib differ diff --git a/macosx/Images/Lock.tiff b/macosx/Images/Lock.tiff new file mode 100644 index 000000000..d1c2af9b9 Binary files /dev/null and b/macosx/Images/Lock.tiff differ diff --git a/macosx/InfoWindowController.h b/macosx/InfoWindowController.h index a70d0f981..fb8fae468 100644 --- a/macosx/InfoWindowController.h +++ b/macosx/InfoWindowController.h @@ -31,7 +31,7 @@ @interface InfoWindowController : NSWindowController { NSArray * fTorrents, * fPeers, * fFiles; - NSImage * fAppIcon, * fDotGreen, * fDotRed; + NSImage * fAppIcon, * fDotGreen, * fDotRed, * fLockImage; BOOL fCanResizeVertical; diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index 553ac6925..059e0b44b 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -808,6 +808,17 @@ if ([ident isEqualToString: @"Connected"]) return [[peer objectForKey: @"Connected"] boolValue] ? fDotGreen : fDotRed; + else if ([ident isEqualToString: @"Encryption"]) + { + /*if ([[peer objectForKey: @"Encryption"] boolValue]) + { + if (!fLockImage) + fLockImage = [NSImage imageNamed: @"Lock.tiff"]; + return fLockImage; + } + else*/ + return nil; + } else if ([ident isEqualToString: @"Client"]) return [peer objectForKey: @"Client"]; else if ([ident isEqualToString: @"Progress"]) @@ -862,10 +873,11 @@ if (tableView == fPeerTable) { NSDictionary * peer = [fPeers objectAtIndex: row]; + BOOL connected = [[peer objectForKey: @"Connected"] boolValue]; - NSMutableArray * components = [NSMutableArray arrayWithCapacity: 3]; + NSMutableArray * components = [NSMutableArray arrayWithCapacity: connected ? 4 : 2]; - if ([[peer objectForKey: @"Connected"] boolValue]) + if (connected) [components addObject: [NSString stringWithFormat: NSLocalizedString(@"Progress: %.1f%%", "Inspector -> Peers tab -> table row tooltip"), [[peer objectForKey: @"Progress"] floatValue] * 100.0]]; @@ -887,11 +899,41 @@ else [components addObject: NSLocalizedString(@"From: tracker", "Inspector -> Peers tab -> table row tooltip")]; + /*if (connected && [[peer objectForKey: @"Encryption"] boolValue]) + [components addObject: @"Encrypted Connection"];*/ + return [components componentsJoinedByString: @"\n"]; } return nil; } +- (NSArray *) peerSortDescriptors +{ + NSMutableArray * descriptors = [NSMutableArray array]; + + NSArray * oldDescriptors = [fPeerTable sortDescriptors]; + BOOL useSecond = YES, asc = YES; + if ([oldDescriptors count] > 0) + { + NSSortDescriptor * descriptor = [oldDescriptors objectAtIndex: 0]; + [descriptors addObject: descriptor]; + + if ((useSecond = ![[descriptor key] isEqualToString: @"IP"])) + asc = [descriptor ascending]; + } + + //sort by IP after primary sort + if (useSecond) + { + NSSortDescriptor * secondDescriptor = [[NSSortDescriptor alloc] initWithKey: @"IP" ascending: asc + selector: @selector(compareIP:)]; + [descriptors addObject: secondDescriptor]; + [secondDescriptor release]; + } + + return descriptors; +} + - (int) outlineView: (NSOutlineView *) outlineView numberOfChildrenOfItem: (id) item { if (!item) @@ -1002,33 +1044,6 @@ ? event : nil]; } -- (NSArray *) peerSortDescriptors -{ - NSMutableArray * descriptors = [NSMutableArray array]; - - NSArray * oldDescriptors = [fPeerTable sortDescriptors]; - BOOL useSecond = YES, asc = YES; - if ([oldDescriptors count] > 0) - { - NSSortDescriptor * descriptor = [oldDescriptors objectAtIndex: 0]; - [descriptors addObject: descriptor]; - - if ((useSecond = ![[descriptor key] isEqualToString: @"IP"])) - asc = [descriptor ascending]; - } - - //sort by IP after primary sort - if (useSecond) - { - NSSortDescriptor * secondDescriptor = [[NSSortDescriptor alloc] initWithKey: @"IP" ascending: asc - selector: @selector(compareIP:)]; - [descriptors addObject: secondDescriptor]; - [secondDescriptor release]; - } - - return descriptors; -} - - (void) setPiecesView: (id) sender { [self setPiecesViewForAvailable: [sender selectedSegment] == PIECES_CONTROL_AVAILABLE]; diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 55847bb7f..feb8387b5 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -1039,6 +1039,8 @@ static int static_lastid = 0; 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