#include <logtreewidget.h>
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) |
LogTreeItem * | log (LogEvent::Severity type, QString message) |
QList< LogTreeItem * > | find (QString text, bool highlight=true) |
Protected Member Functions | |
void | showEvent (QShowEvent *event) |
Private Slots | |
void | verticalSliderReleased () |
Private Member Functions | |
QList< LogTreeItem * > | qlist_cast (QList< QTreeWidgetItem * > inlist) |
QList< LogTreeItem * > | qlist_sort (QList< LogTreeItem * > inlist) |
Private Attributes | |
int | _maxItemCount |
bool | _scrollOnNewItem |
Definition at line 31 of file logtreewidget.h.
Log tree column indices.
TimeColumn | Timestamp column. |
TypeColumn | Message severity type column. |
MessageColumn | Message text column. |
Definition at line 37 of file logtreewidget.h.
LogTreeWidget::LogTreeWidget | ( | QWidget * | parent = 0 |
) |
Default constructor.
Definition at line 24 of file logtreewidget.cpp.
References _scrollOnNewItem, and verticalSliderReleased().
QStringList LogTreeWidget::selectedMessages | ( | ) |
Returns a list of all currently selected messages.
Returns a list of all currently selected items.
Definition at line 98 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 115 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 151 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 132 of file logtreewidget.cpp.
Referenced by filter(), log(), and setMaximumMessageCount().
void LogTreeWidget::setMaximumMessageCount | ( | int | max | ) |
Sets the maximum number of items in the tree.
Definition at line 139 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 191 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 160 of file logtreewidget.cpp.
References _maxItemCount, _scrollOnNewItem, and messageCount().
QList< LogTreeItem * > LogTreeWidget::find | ( | QString | text, | |
bool | highlight = true | |||
) |
Searches the log for entries that contain the given text.
Definition at line 210 of file logtreewidget.cpp.
References deselectAll(), MessageColumn, qlist_cast(), and qlist_sort().
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 90 of file logtreewidget.cpp.
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 76 of file logtreewidget.cpp.
void LogTreeWidget::verticalSliderReleased | ( | ) | [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 41 of file logtreewidget.cpp.
References _scrollOnNewItem.
Referenced by LogTreeWidget().
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 53 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 64 of file logtreewidget.cpp.
References LogTreeItem::id().
Referenced by allMessages(), find(), and selectedMessages().
int LogTreeWidget::_maxItemCount [private] |
Maximum number of items in the tree.
Definition at line 84 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 85 of file logtreewidget.h.
Referenced by log(), LogTreeWidget(), and verticalSliderReleased().