Vidalia  0.3.1
StatusEventItem.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 StatusEventItem.cpp
13 ** \brief Represents a single status event item in a StatusEventWidget
14 */
15 
16 #ifndef _STATUSEVENTITEM_H
17 #define _STATUSEVENTITEM_H
18 
19 #include <QTreeWidgetItem>
20 
21 class QDateTime;
22 class QPixmap;
23 class QString;
24 
25 class StatusEventItem : public QTreeWidgetItem
26 {
27 public:
28  /** QModelIndex data roles used to store information with this status
29  * event item, allowing it to be retrieved by StatusEventItemDelegate for
30  * painting.
31  */
32  enum DataRole {
33  IconRole = Qt::UserRole,
38  };
39 
40  /** Default constructor.
41  */
42  StatusEventItem(QTreeWidget *parent = 0);
43 
44  /** Sets the <b>timestamp</b> at which this status event occurred.
45  * \sa timestamp()
46  */
47  void setTimestamp(const QDateTime &timestamp);
48 
49  /** Returns the timestamp at which this status event occurred.
50  * \sa setTimestamp()
51  */
52  QDateTime timestamp() const;
53 
54  /** Sets the icon to be drawn along with this status event to <b>pixmap</b>.
55  * \sa icon()
56  */
57  void setIcon(const QPixmap &pixmap);
58 
59  /** Returns the icon draw along with this status event.
60  * \sa setIcon()
61  */
62  QPixmap icon() const;
63 
64  /** Sets the <b>title</b> text for this status event. The title is a short
65  * (fewer than 10 words or so) summary of the event.
66  * \sa title()
67  */
68  void setTitle(const QString &title);
69 
70  /** Returns the title text for this status event.
71  * \sa setTitle()
72  */
73  QString title() const;
74 
75  /** Sets the detailed <b>description</b> text for this status event. The
76  * text should explain what the event means to the user, and any corrective
77  * action they might need to take.
78  * \sa description()
79  */
80  void setDescription(const QString &description);
81 
82  /** Returns the detailed description text for this status event.
83  * \sa setDescription()
84  */
85  QString description() const;
86 
87  /** Sets the help topic URL that contains more information about this
88  * particular status event.
89  * \sa helpUrl
90  */
91  void setHelpUrl(const QString &url);
92 
93  /** Returns the help topic URL associated with this event item.
94  * \sa setHelpUrl
95  */
96  QString helpUrl() const;
97 
98  /** Sets <b>toolTip</b> as the text displayed when the user hovers the mouse
99  * over a StatusEventItem. It is more useful for particularly long item
100  * descriptions.
101  */
102  void setToolTip(const QString &toolTip);
103 
104  /** Returns a formatted QString containing this item's timestamp, title
105  * and description text.
106  * \sa timestamp()
107  * \sa title()
108  * \sa description()
109  */
110  QString toString() const;
111 
112  /** Overloaded comparison operator that allows sorting StatusEventItem
113  * objects based on timestamp. Returns true if <i>this</i> StatusEventItem
114  * occurred before <b>other</b>.
115  */
116  virtual bool operator<(const QTreeWidgetItem &other) const;
117 };
118 
119 #endif
120