mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
make Message Log sortable
This commit is contained in:
parent
f2ead80e96
commit
13e09a0185
4 changed files with 22 additions and 5 deletions
|
@ -9,7 +9,7 @@
|
|||
fDebugWarningField = NSTextField;
|
||||
fDebugWarningIcon = NSImageView;
|
||||
fLevelButton = NSPopUpButton;
|
||||
fMessageView = NSTableView;
|
||||
fMessageTable = NSTableView;
|
||||
fScrollView = NSScrollView;
|
||||
};
|
||||
SUPERCLASS = NSWindowController;
|
||||
|
|
BIN
macosx/English.lproj/MessageWindow.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/MessageWindow.nib/keyedobjects.nib
generated
Binary file not shown.
|
@ -26,7 +26,7 @@
|
|||
|
||||
@interface MessageWindowController : NSWindowController
|
||||
{
|
||||
IBOutlet NSTableView * fMessageView;
|
||||
IBOutlet NSTableView * fMessageTable;
|
||||
IBOutlet NSScrollView * fScrollView;
|
||||
|
||||
IBOutlet NSPopUpButton * fLevelButton;
|
||||
|
|
|
@ -68,6 +68,14 @@
|
|||
{
|
||||
[[self window] center];
|
||||
|
||||
//initially sort peer table by IP
|
||||
if ([[fMessageTable sortDescriptors] count] == 0)
|
||||
{
|
||||
[fMessageTable setSortDescriptors: [NSArray arrayWithObject: [[fMessageTable tableColumnWithIdentifier: @"Date"]
|
||||
sortDescriptorPrototype]]];
|
||||
[self updateLog: nil];
|
||||
}
|
||||
|
||||
fErrorImage = [NSImage imageNamed: @"RedDot.tiff"];
|
||||
fInfoImage = [NSImage imageNamed: @"YellowDot.tiff"];
|
||||
fDebugImage = [NSImage imageNamed: @"GreenDot.tiff"];
|
||||
|
@ -107,14 +115,16 @@
|
|||
[NSDate dateWithTimeIntervalSince1970: currentMessage->when], @"Date",
|
||||
[NSNumber numberWithInt: currentMessage->level], @"Level", nil]];
|
||||
|
||||
tr_freeMessageList(messages);
|
||||
|
||||
#warning still needed?
|
||||
int total = [fMessages count];
|
||||
if (total > MAX_MESSAGES)
|
||||
[fMessages removeObjectsInRange: NSMakeRange(0, total-MAX_MESSAGES)];
|
||||
|
||||
[fMessageView reloadData];
|
||||
[fMessages sortUsingDescriptors: [fMessageTable sortDescriptors]];
|
||||
|
||||
tr_freeMessageList(messages);
|
||||
[fMessageTable reloadData];
|
||||
}
|
||||
|
||||
- (int) numberOfRowsInTableView: (NSTableView *) tableView
|
||||
|
@ -151,6 +161,13 @@
|
|||
return [self stringForMessage: [fMessages objectAtIndex: row]];
|
||||
}
|
||||
|
||||
- (void) tableView: (NSTableView *) tableView sortDescriptorsDidChange: (NSArray *) oldDescriptors
|
||||
{
|
||||
[fMessages sortUsingDescriptors: [fMessageTable sortDescriptors]];
|
||||
|
||||
[fMessageTable reloadData];
|
||||
}
|
||||
|
||||
- (void) changeLevel: (id) sender
|
||||
{
|
||||
[self updateLog: nil];
|
||||
|
@ -172,7 +189,7 @@
|
|||
- (void) clearLog: (id) sender
|
||||
{
|
||||
[fMessages removeAllObjects];
|
||||
[fMessageView reloadData];
|
||||
[fMessageTable reloadData];
|
||||
}
|
||||
|
||||
- (void) writeToFile: (id) sender
|
||||
|
|
Loading…
Reference in a new issue