Vidalia
0.3.1
Main Page
Namespaces
Classes
Files
File List
File Members
src
vidalia
log
LogTreeWidget.h
Go to the documentation of this file.
1
/*
2
** This file is part of Vidalia, and is subject to the license terms in the
3
** LICENSE file, found in the top level directory of this distribution. If you
4
** did not receive the LICENSE file with this file, you may obtain it from the
5
** Vidalia source package distributed by the Vidalia Project at
6
** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7
** including this file, may be copied, modified, propagated, or distributed
8
** except according to the terms described in the LICENSE file.
9
*/
10
11
/*
12
** \file LogTreeWidget.h
13
** \brief Contains a collection of log messages as LogTreeItems
14
*/
15
16
#ifndef _LOGTREEWIDGET_H
17
#define _LOGTREEWIDGET_H
18
19
#include "
LogTreeItem.h
"
20
21
#include "
TorControl.h
"
22
23
#include <QList>
24
#include <QString>
25
#include <QStringList>
26
#include <QTreeWidget>
27
#include <QHeaderView>
28
#include <QShowEvent>
29
30
31
class
LogTreeWidget
:
public
QTreeWidget
32
{
33
Q_OBJECT
34
35
public
:
36
/** Log tree column indices. */
37
enum
LogColumns
{
38
TimeColumn
= 0,
/**< Timestamp column. */
39
TypeColumn
= 1,
/**< Message severity type column. */
40
MessageColumn
= 2
/**< Message text column. */
41
};
42
43
/** Default constructor. */
44
LogTreeWidget
(QWidget *parent = 0);
45
46
/** Returns a list of all currently selected messages. */
47
QStringList
selectedMessages
();
48
/** Returns a list of all messages in the tree. */
49
QStringList
allMessages
();
50
/** Deselects all currently selected messages. */
51
void
deselectAll
();
52
53
/** Returns the number of items currently in the tree. */
54
int
messageCount
();
55
/** Sets the maximum number of items in the tree. */
56
void
setMaximumMessageCount
(
int
max);
57
/** Filters the log according to the specified filter. */
58
void
filter
(uint
filter
);
59
60
/** Adds a log item to the tree. */
61
LogTreeItem
*
log
(
tc::Severity
severity,
const
QString &message);
62
63
/** Searches the log for entries that contain the given text. */
64
QList<LogTreeItem *>
find
(QString text,
bool
highlight =
true
);
65
66
public
slots:
67
/** Clears all contents on the message log and resets the counter. */
68
void
clearMessages
();
69
70
protected
:
71
/** Sets the default, initial column header widths. */
72
void
showEvent
(QShowEvent *event);
73
74
private
slots:
75
/** Called when the user moves the vertical scroll bar. */
76
void
verticalSliderReleased
();
77
78
private
:
79
/** Adds <b>item</b> as a top-level item in the tree. */
80
void
addLogTreeItem
(
LogTreeItem
*item);
81
/** Casts a QList of one pointer type to another. */
82
QList<LogTreeItem *>
qlist_cast
(QList<QTreeWidgetItem *> inlist);
83
/** Sortrs a QList of pointers to tree items. */
84
QList<LogTreeItem *>
qlist_sort
(QList<LogTreeItem *> inlist);
85
86
/**< List of pointers to all log message items currently in the tree. */
87
QList<LogTreeItem *>
_itemHistory
;
88
int
_maxItemCount
;
/**< Maximum number of items in the tree. */
89
bool
_scrollOnNewItem
;
/**< Set to true if we are to scroll to the new item
90
after adding a message to the log. */
91
};
92
93
#endif
94
Generated on Mon Jan 14 2013 08:44:27 for Vidalia by
1.8.3