Changeset 3037


Ignore:
Timestamp:
Sep 10, 2007, 9:46:33 PM (15 years ago)
Author:
livings124
Message:

make Message Log sortable

Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/English.lproj/MessageWindow.nib/classes.nib

    r3031 r3037  
    1010                fDebugWarningIcon = NSImageView;
    1111                fLevelButton = NSPopUpButton;
    12                 fMessageView = NSTableView;
     12                fMessageTable = NSTableView;
    1313                fScrollView = NSScrollView;
    1414            };
  • trunk/macosx/MessageWindowController.h

    r3036 r3037  
    2727@interface MessageWindowController : NSWindowController
    2828{
    29     IBOutlet NSTableView * fMessageView;
     29    IBOutlet NSTableView * fMessageTable;
    3030    IBOutlet NSScrollView * fScrollView;
    3131   
  • trunk/macosx/MessageWindowController.m

    r3036 r3037  
    6969    [[self window] center];
    7070   
     71    //initially sort peer table by IP
     72    if ([[fMessageTable sortDescriptors] count] == 0)
     73    {
     74        [fMessageTable setSortDescriptors: [NSArray arrayWithObject: [[fMessageTable tableColumnWithIdentifier: @"Date"]
     75                                            sortDescriptorPrototype]]];
     76        [self updateLog: nil];
     77    }
     78   
    7179    fErrorImage = [NSImage imageNamed: @"RedDot.tiff"];
    7280    fInfoImage = [NSImage imageNamed: @"YellowDot.tiff"];
     
    108116                                [NSNumber numberWithInt: currentMessage->level], @"Level", nil]];
    109117   
     118    tr_freeMessageList(messages);
     119   
    110120    #warning still needed?
    111121    int total = [fMessages count];
     
    113123        [fMessages removeObjectsInRange: NSMakeRange(0, total-MAX_MESSAGES)];
    114124   
    115     [fMessageView reloadData];
    116    
    117     tr_freeMessageList(messages);
     125    [fMessages sortUsingDescriptors: [fMessageTable sortDescriptors]];
     126   
     127    [fMessageTable reloadData];
    118128}
    119129
     
    152162}
    153163
     164- (void) tableView: (NSTableView *) tableView sortDescriptorsDidChange: (NSArray *) oldDescriptors
     165{
     166    [fMessages sortUsingDescriptors: [fMessageTable sortDescriptors]];
     167   
     168    [fMessageTable reloadData];
     169}
     170
    154171- (void) changeLevel: (id) sender
    155172{
     
    173190{
    174191    [fMessages removeAllObjects];
    175     [fMessageView reloadData];
     192    [fMessageTable reloadData];
    176193}
    177194
Note: See TracChangeset for help on using the changeset viewer.