LogTreeWidget Class Reference

#include <logtreewidget.h>

List of all members.

Public Types

enum  LogColumns { TimeColumn = 0, TypeColumn = 1, MessageColumn = 2 }

Public Slots

void clearMessages ()

Public Member Functions

 LogTreeWidget (QWidget *parent=0)
QStringList selectedMessages ()
QStringList allMessages ()
void deselectAll ()
int messageCount ()
void setMaximumMessageCount (int max)
void filter (uint filter)
LogTreeItemlog (LogEvent::Severity type, QString message)
QList< LogTreeItem * > find (QString text, bool highlight=true)
void adjustMessageColumn ()

Protected Member Functions

void showEvent (QShowEvent *event)

Private Slots

void onVerticalScroll (int value)

Private Member Functions

void addMessageItem (LogTreeItem *item)
QList< LogTreeItem * > qlist_cast (QList< QTreeWidgetItem * > inlist)
QList< LogTreeItem * > qlist_sort (QList< LogTreeItem * > inlist)

Private Attributes

int _maxItemCount
bool _scrollOnNewItem


Detailed Description

Definition at line 42 of file logtreewidget.h.


Member Enumeration Documentation

enum LogTreeWidget::LogColumns

Log tree column indices.

Enumerator:
TimeColumn  Timestamp column.
TypeColumn  Message severity type column.
MessageColumn  Message text column.

Definition at line 48 of file logtreewidget.h.


Constructor & Destructor Documentation

LogTreeWidget::LogTreeWidget ( QWidget *  parent = 0  ) 

Default constructor.

Definition at line 35 of file logtreewidget.cpp.

References _scrollOnNewItem, and onVerticalScroll().


Member Function Documentation

QStringList LogTreeWidget::selectedMessages (  ) 

Returns a list of all currently selected messages.

Returns a list of all currently selected items.

Definition at line 130 of file logtreewidget.cpp.

References qlist_cast(), qlist_sort(), and LogTreeItem::toString().

QStringList LogTreeWidget::allMessages (  ) 

Returns a list of all messages in the tree.

Returns a list of all items in the tree.

Definition at line 147 of file logtreewidget.cpp.

References MessageColumn, qlist_cast(), qlist_sort(), and LogTreeItem::toString().

void LogTreeWidget::deselectAll (  ) 

Deselects all currently selected messages.

Deselects all currently selected items.

Definition at line 183 of file logtreewidget.cpp.

Referenced by find().

int LogTreeWidget::messageCount (  ) 

Returns the number of items currently in the tree.

Returns the number of items currently shown.

Definition at line 164 of file logtreewidget.cpp.

Referenced by clearMessages(), filter(), log(), and setMaximumMessageCount().

void LogTreeWidget::setMaximumMessageCount ( int  max  ) 

Sets the maximum number of items in the tree.

Definition at line 171 of file logtreewidget.cpp.

References _maxItemCount, and messageCount().

void LogTreeWidget::filter ( uint  filter  ) 

Filters the log according to the specified filter.

Filters the message log based on the given filter.

Definition at line 214 of file logtreewidget.cpp.

References _maxItemCount, messageCount(), and LogTreeItem::severity().

LogTreeItem * LogTreeWidget::log ( LogEvent::Severity  type,
QString  message 
)

Adds a log item to the tree.

Adds a log item to the tree and returns a pointer to the new item.

Definition at line 192 of file logtreewidget.cpp.

References _maxItemCount, _scrollOnNewItem, addMessageItem(), and messageCount().

QList< LogTreeItem * > LogTreeWidget::find ( QString  text,
bool  highlight = true 
)

Searches the log for entries that contain the given text.

Definition at line 235 of file logtreewidget.cpp.

References deselectAll(), MessageColumn, qlist_cast(), and qlist_sort().

void LogTreeWidget::adjustMessageColumn (  ) 

Adjusts the message column, for long messages.

Adjusts the message column width to accomodate long messages.

Definition at line 112 of file logtreewidget.cpp.

References MessageColumn.

Referenced by addMessageItem(), and showEvent().

void LogTreeWidget::clearMessages (  )  [slot]

Clears all contents on the message log and resets the counter.

Clears all items from the message log and resets the counter in the status bar.

Definition at line 101 of file logtreewidget.cpp.

References messageCount().

void LogTreeWidget::showEvent ( QShowEvent *  event  )  [protected]

Sets the default, initial column header widths.

The first time the log tree is shown, we need to set the default column widths.

Definition at line 85 of file logtreewidget.cpp.

References adjustMessageColumn().

void LogTreeWidget::onVerticalScroll ( int  value  )  [private, slot]

Called when the user moves the vertical scroll bar.

Called when the user moves the vertical scrollbar. If the user has the scrollbar at within one step of its maximum, then always scroll to new items when added. Otherwise, leave the scrollbar alone since they are probably looking at something in their history.

Definition at line 53 of file logtreewidget.cpp.

References _scrollOnNewItem.

Referenced by LogTreeWidget().

void LogTreeWidget::addMessageItem ( LogTreeItem item  )  [private]

Adds a message log item.

Definition at line 120 of file logtreewidget.cpp.

References adjustMessageColumn().

Referenced by log().

QList< LogTreeItem * > LogTreeWidget::qlist_cast ( QList< QTreeWidgetItem * >  inlist  )  [private]

Casts a QList of one pointer type to another.

Cast a QList of QTreeWidgetItem pointers to a list of LogTreeWidget pointers. There really must be a better way to do this.

Definition at line 62 of file logtreewidget.cpp.

Referenced by allMessages(), find(), and selectedMessages().

QList< LogTreeItem * > LogTreeWidget::qlist_sort ( QList< LogTreeItem * >  inlist  )  [private]

Sortrs a QList of pointers to tree items.

Sorts the list of pointers to log tree items by timestamp.

Definition at line 73 of file logtreewidget.cpp.

References LogTreeItem::id().

Referenced by allMessages(), find(), and selectedMessages().


Member Data Documentation

int LogTreeWidget::_maxItemCount [private]

Maximum number of items in the tree.

Definition at line 100 of file logtreewidget.h.

Referenced by filter(), log(), and setMaximumMessageCount().

bool LogTreeWidget::_scrollOnNewItem [private]

Set to true if we are to scroll to the new item after adding a message to the log.

Definition at line 101 of file logtreewidget.h.

Referenced by log(), LogTreeWidget(), and onVerticalScroll().


The documentation for this class was generated from the following files:
Generated on Wed Sep 5 15:49:29 2007 for Vidalia by  doxygen 1.5.3