Vidalia
0.3.1
|
#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 (tc::Severity severity, const QString &message) |
QList< LogTreeItem * > | find (QString text, bool highlight=true) |
Protected Member Functions | |
void | showEvent (QShowEvent *event) |
Private Slots | |
void | verticalSliderReleased () |
Private Member Functions | |
void | addLogTreeItem (LogTreeItem *item) |
QList< LogTreeItem * > | qlist_cast (QList< QTreeWidgetItem *> inlist) |
QList< LogTreeItem * > | qlist_sort (QList< LogTreeItem *> inlist) |
Private Attributes | |
QList< LogTreeItem * > | _itemHistory |
int | _maxItemCount |
bool | _scrollOnNewItem |
Definition at line 31 of file LogTreeWidget.h.
Log tree column indices.
Enumerator | |
---|---|
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, connect(), MessageColumn, TimeColumn, and verticalSliderReleased().
|
private |
Adds item as a top-level item in the tree.
Definition at line 224 of file LogTreeWidget.cpp.
References _itemHistory.
Referenced by log().
QStringList LogTreeWidget::allMessages | ( | ) |
Returns a list of all messages in the tree.
Returns a list of all items in the tree.
Definition at line 126 of file LogTreeWidget.cpp.
References _itemHistory, and LogTreeItem::toString().
|
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 100 of file LogTreeWidget.cpp.
References _itemHistory.
void LogTreeWidget::deselectAll | ( | ) |
Deselects all currently selected messages.
Deselects all currently selected items.
Definition at line 160 of file LogTreeWidget.cpp.
Referenced by find().
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 232 of file LogTreeWidget.cpp.
References _itemHistory, _maxItemCount, i(), and LogTreeItem::severity().
QList< LogTreeItem * > LogTreeWidget::find | ( | QString | text, |
bool | highlight = true |
||
) |
Searches the log for entries that contain the given text.
Definition at line 250 of file LogTreeWidget.cpp.
References deselectAll(), MessageColumn, qlist_cast(), and qlist_sort().
LogTreeItem * LogTreeWidget::log | ( | tc::Severity | type, |
const 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 169 of file LogTreeWidget.cpp.
References _itemHistory, _maxItemCount, _scrollOnNewItem, addLogTreeItem(), messageCount(), and TimeColumn.
int LogTreeWidget::messageCount | ( | ) |
Returns the number of items currently in the tree.
Returns the number of items currently shown.
Definition at line 139 of file LogTreeWidget.cpp.
Referenced by log(), and setMaximumMessageCount().
|
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 63 of file LogTreeWidget.cpp.
Referenced by find(), and selectedMessages().
|
private |
Sortrs a QList of pointers to tree items. List of pointers to all log message items currently in the tree.
Sorts the list of pointers to log tree items by timestamp.
Definition at line 74 of file LogTreeWidget.cpp.
References LogTreeItem::id().
Referenced by find(), and selectedMessages().
QStringList LogTreeWidget::selectedMessages | ( | ) |
Returns a list of all currently selected messages.
Returns a list of all currently selected items.
Definition at line 109 of file LogTreeWidget.cpp.
References qlist_cast(), qlist_sort(), and LogTreeItem::toString().
void LogTreeWidget::setMaximumMessageCount | ( | int | max | ) |
Sets the maximum number of items in the tree.
Definition at line 146 of file LogTreeWidget.cpp.
References _itemHistory, _maxItemCount, and messageCount().
|
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 86 of file LogTreeWidget.cpp.
|
privateslot |
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 51 of file LogTreeWidget.cpp.
References _scrollOnNewItem.
Referenced by LogTreeWidget().
|
private |
Definition at line 87 of file LogTreeWidget.h.
Referenced by addLogTreeItem(), allMessages(), clearMessages(), filter(), log(), and setMaximumMessageCount().
|
private |
Maximum number of items in the tree.
Definition at line 88 of file LogTreeWidget.h.
Referenced by filter(), log(), and setMaximumMessageCount().
|
private |
Set to true if we are to scroll to the new item after adding a message to the log.
Definition at line 89 of file LogTreeWidget.h.
Referenced by log(), LogTreeWidget(), and verticalSliderReleased().