get inspector ready for encryption

This commit is contained in:
Mitchell Livingston 2007-09-14 13:49:37 +00:00
parent b546784546
commit 4fb7db8348
7 changed files with 55 additions and 36 deletions

View File

@ -51,6 +51,7 @@
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
A200B9200A22798F007BBB1E /* InfoWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A200B83A0A2263BA007BBB1E /* InfoWindowController.m */; }; A200B9200A22798F007BBB1E /* InfoWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A200B83A0A2263BA007BBB1E /* InfoWindowController.m */; };
A200B9B60A22893D007BBB1E /* InfoWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = A200B9620A227FD0007BBB1E /* InfoWindow.nib */; }; 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 */; }; A2085DDC0C53BC74000BC3B7 /* AboutWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A2085DDA0C53BC74000BC3B7 /* AboutWindowController.m */; };
A2085E020C53C16F000BC3B7 /* AboutWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = A2085E000C53C16F000BC3B7 /* AboutWindow.nib */; }; A2085E020C53C16F000BC3B7 /* AboutWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = A2085E000C53C16F000BC3B7 /* AboutWindow.nib */; };
A2085E3F0C53C949000BC3B7 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = A2085E2F0C53C833000BC3B7 /* LICENSE */; }; 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 = "<group>"; }; A200B8390A2263BA007BBB1E /* InfoWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InfoWindowController.h; path = macosx/InfoWindowController.h; sourceTree = "<group>"; };
A200B83A0A2263BA007BBB1E /* InfoWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InfoWindowController.m; path = macosx/InfoWindowController.m; sourceTree = "<group>"; }; A200B83A0A2263BA007BBB1E /* InfoWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InfoWindowController.m; path = macosx/InfoWindowController.m; sourceTree = "<group>"; };
A200B9630A227FD0007BBB1E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = macosx/English.lproj/InfoWindow.nib; sourceTree = "<group>"; }; A200B9630A227FD0007BBB1E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = macosx/English.lproj/InfoWindow.nib; sourceTree = "<group>"; };
A2041D520C9AC523000ACFFB /* Lock.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = Lock.tiff; path = macosx/Images/Lock.tiff; sourceTree = "<group>"; };
A204310F0C5EAF490081E5CC /* Russian */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Russian; path = macosx/Russian.lproj/AboutWindow.nib; sourceTree = "<group>"; }; A204310F0C5EAF490081E5CC /* Russian */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Russian; path = macosx/Russian.lproj/AboutWindow.nib; sourceTree = "<group>"; };
A20431100C5EAF490081E5CC /* Russian */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = Russian; path = macosx/Russian.lproj/InfoPlist.strings; sourceTree = "<group>"; }; A20431100C5EAF490081E5CC /* Russian */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = Russian; path = macosx/Russian.lproj/InfoPlist.strings; sourceTree = "<group>"; };
A20431110C5EAF490081E5CC /* Russian */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Russian; path = macosx/Russian.lproj/InfoWindow.nib; sourceTree = "<group>"; }; A20431110C5EAF490081E5CC /* Russian */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Russian; path = macosx/Russian.lproj/InfoWindow.nib; sourceTree = "<group>"; };
@ -758,6 +760,7 @@
A20B6FAD0C4D9B040034AB1D /* PriorityNormal.png */, A20B6FAD0C4D9B040034AB1D /* PriorityNormal.png */,
A20B6F6A0C4D842B0034AB1D /* PriorityLow.png */, A20B6F6A0C4D842B0034AB1D /* PriorityLow.png */,
A20B6F820C4D8A610034AB1D /* PriorityHigh.png */, A20B6F820C4D8A610034AB1D /* PriorityHigh.png */,
A2041D520C9AC523000ACFFB /* Lock.tiff */,
A2FB06950BFF484A0095564D /* Globe.png */, A2FB06950BFF484A0095564D /* Globe.png */,
A261A8250C6A0D68003BAFDA /* Error.png */, A261A8250C6A0D68003BAFDA /* Error.png */,
A29C8B320ACC6E93000ED9F9 /* YellowDot.tiff */, A29C8B320ACC6E93000ED9F9 /* YellowDot.tiff */,
@ -1336,6 +1339,7 @@
A277DA0C0C693D9C00DA2CD4 /* ActionOff.png in Resources */, A277DA0C0C693D9C00DA2CD4 /* ActionOff.png in Resources */,
A261A8260C6A0D68003BAFDA /* Error.png in Resources */, A261A8260C6A0D68003BAFDA /* Error.png in Resources */,
A2EF7DEC0C96297400FA9811 /* PurpleDot.png in Resources */, A2EF7DEC0C96297400FA9811 /* PurpleDot.png in Resources */,
A2041D530C9AC523000ACFFB /* Lock.tiff in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@ -92,10 +92,9 @@
#define FORUM_URL @"http://transmission.m0k.org/forum/" #define FORUM_URL @"http://transmission.m0k.org/forum/"
#define DONATE_URL @"http://transmission.m0k.org/donate.php" #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; [(Controller *)controller sleepCallBack: messageType argument: messageArgument];
[c sleepCallBack: messageType argument: messageArgument];
} }
@implementation Controller @implementation Controller
@ -302,7 +301,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
//register for sleep notifications //register for sleep notifications
IONotificationPortRef notify; IONotificationPortRef notify;
io_object_t iterator; io_object_t iterator;
if (fRootPort = IORegisterForSystemPower(self, & notify, sleepCallBack, & iterator)) if ((fRootPort = IORegisterForSystemPower(self, & notify, sleepCallBack, & iterator)) != 0)
CFRunLoopAddSource(CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(notify), kCFRunLoopCommonModes); CFRunLoopAddSource(CFRunLoopGetCurrent(), IONotificationPortGetRunLoopSource(notify), kCFRunLoopCommonModes);
else else
NSLog(@"Could not IORegisterForSystemPower"); NSLog(@"Could not IORegisterForSystemPower");
@ -3083,7 +3082,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
break; break;
case kIOMessageCanSystemSleep: case kIOMessageCanSystemSleep:
allowSleep = YES; allowSleep = YES;
if ([fDefaults boolForKey: @"SleepPrevent"]) if ([fDefaults boolForKey: @"SleepPrevent"])
{ {

BIN
macosx/Images/Lock.tiff Normal file

Binary file not shown.

View File

@ -31,7 +31,7 @@
@interface InfoWindowController : NSWindowController @interface InfoWindowController : NSWindowController
{ {
NSArray * fTorrents, * fPeers, * fFiles; NSArray * fTorrents, * fPeers, * fFiles;
NSImage * fAppIcon, * fDotGreen, * fDotRed; NSImage * fAppIcon, * fDotGreen, * fDotRed, * fLockImage;
BOOL fCanResizeVertical; BOOL fCanResizeVertical;

View File

@ -808,6 +808,17 @@
if ([ident isEqualToString: @"Connected"]) if ([ident isEqualToString: @"Connected"])
return [[peer objectForKey: @"Connected"] boolValue] ? fDotGreen : fDotRed; 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"]) else if ([ident isEqualToString: @"Client"])
return [peer objectForKey: @"Client"]; return [peer objectForKey: @"Client"];
else if ([ident isEqualToString: @"Progress"]) else if ([ident isEqualToString: @"Progress"])
@ -862,10 +873,11 @@
if (tableView == fPeerTable) if (tableView == fPeerTable)
{ {
NSDictionary * peer = [fPeers objectAtIndex: row]; 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: [components addObject: [NSString stringWithFormat:
NSLocalizedString(@"Progress: %.1f%%", "Inspector -> Peers tab -> table row tooltip"), NSLocalizedString(@"Progress: %.1f%%", "Inspector -> Peers tab -> table row tooltip"),
[[peer objectForKey: @"Progress"] floatValue] * 100.0]]; [[peer objectForKey: @"Progress"] floatValue] * 100.0]];
@ -887,11 +899,41 @@
else else
[components addObject: NSLocalizedString(@"From: tracker", "Inspector -> Peers tab -> table row tooltip")]; [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 [components componentsJoinedByString: @"\n"];
} }
return nil; 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 - (int) outlineView: (NSOutlineView *) outlineView numberOfChildrenOfItem: (id) item
{ {
if (!item) if (!item)
@ -1002,33 +1044,6 @@
? event : nil]; ? 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 - (void) setPiecesView: (id) sender
{ {
[self setPiecesViewForAvailable: [sender selectedSegment] == PIECES_CONTROL_AVAILABLE]; [self setPiecesViewForAvailable: [sender selectedSegment] == PIECES_CONTROL_AVAILABLE];

View File

@ -1039,6 +1039,8 @@ static int static_lastid = 0;
if (peer->isUploading) if (peer->isUploading)
[dic setObject: [NSNumber numberWithFloat: peer->downloadFromRate] forKey: @"DL From Rate"]; [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"]; [dic setObject: [NSString stringWithCString: (char *) peer->client encoding: NSUTF8StringEncoding] forKey: @"Client"];
} }
else else