display tooltip of the file in the message window

This commit is contained in:
Mitchell Livingston 2007-12-08 20:42:34 +00:00
parent 60d6dc9a9a
commit 55dae577ef
2 changed files with 27 additions and 10 deletions

View File

@ -338,7 +338,7 @@
35B037FA0AC5B53800A10FDF /* ResumeNoWaitOff.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ResumeNoWaitOff.png; path = macosx/Images/ResumeNoWaitOff.png; sourceTree = "<group>"; };
35F373000C2DA88F00DAA8F2 /* FilePriorityCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = FilePriorityCell.h; path = macosx/FilePriorityCell.h; sourceTree = "<group>"; };
35F373010C2DA88F00DAA8F2 /* FilePriorityCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = FilePriorityCell.m; path = macosx/FilePriorityCell.m; sourceTree = "<group>"; };
3C7A118D0D0B2EB800B5701F /* libnatpmp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = libnatpmp.a; path = build/Release/libnatpmp.a; sourceTree = "<group>"; };
3C7A118D0D0B2EB800B5701F /* libnatpmp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libnatpmp.a; sourceTree = BUILT_PRODUCTS_DIR; };
3C7A11910D0B2EE300B5701F /* getgateway.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = getgateway.c; path = "third-party/libnatpmp/getgateway.c"; sourceTree = "<group>"; };
3C7A11920D0B2EE300B5701F /* getgateway.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = getgateway.h; path = "third-party/libnatpmp/getgateway.h"; sourceTree = "<group>"; };
3C7A11930D0B2EE300B5701F /* natpmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = natpmp.c; path = "third-party/libnatpmp/natpmp.c"; sourceTree = "<group>"; };
@ -835,7 +835,6 @@
29B97314FDCFA39411CA2CEA /* Transmission */ = {
isa = PBXGroup;
children = (
3C7A11880D0B2E6700B5701F /* libnatpmp */,
BEFC1C0B0C07754700B0BB3C /* daemon */,
4D1838DC09DEC04A0047D688 /* libtransmission */,
4DDBB71F09E16BFE00284745 /* CLI */,
@ -843,6 +842,7 @@
4DDBB71509E16B3F00284745 /* Libraries */,
BE75C3570C72A0D600DBEFE0 /* libevent */,
BE1183410CE15DF00002D0F3 /* libminiupnp */,
3C7A11880D0B2E6700B5701F /* libnatpmp */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
name = Transmission;

View File

@ -36,6 +36,7 @@
- (void) resizeColumn;
- (NSString *) stringForMessage: (NSDictionary *) message;
- (NSString *) fileForMessage: (NSDictionary *) message;
@end
@ -199,6 +200,12 @@
[fMessageTable reloadData];
}
- (NSString *) tableView: (NSTableView *) tableView toolTipForCell: (NSCell *) cell rect: (NSRectPointer) rect
tableColumn: (NSTableColumn *) column row: (int) row mouseLocation: (NSPoint) mouseLocation
{
return [self fileForMessage: [fMessages objectAtIndex: row]];
}
- (void) copy: (id) sender
{
NSPasteboard * pb = [NSPasteboard generalPasteboard];
@ -318,24 +325,34 @@
switch ([[message objectForKey: @"Level"] intValue])
{
case TR_MSG_ERR:
level = @"Error";
level = @"[Error]";
break;
case TR_MSG_INF:
level = @"Info";
level = @"[Info]";
break;
case TR_MSG_DBG:
level = @"Debug";
level = @"[Debug]";
break;
default:
level = @"";
}
NSString * file = [message objectForKey: @"File"],
* fileString = file ? [NSString stringWithFormat: @" %@:%@", [message objectForKey: @"File"], [message objectForKey: @"Line"]]
: @"";
NSMutableArray * strings = [NSMutableArray arrayWithObjects: [message objectForKey: @"Date"], level,
[message objectForKey: @"Message"], nil];
NSString * file;
if ((file = [self fileForMessage: message]))
[strings insertObject: file atIndex: 1];
return [NSString stringWithFormat: @"%@%@ [%@] %@", [message objectForKey: @"Date"], fileString, level,
[message objectForKey: @"Message"]];
return [strings componentsJoinedByString: @" "];
}
- (NSString *) fileForMessage: (NSDictionary *) message
{
NSString * file;
if ((file = [message objectForKey: @"File"]))
return [NSString stringWithFormat: @"%@:%@", [message objectForKey: @"File"], [message objectForKey: @"Line"]];
else
return nil;
}
@end