Vidalia  0.2.17
StatusEventItem.h
Go to the documentation of this file.
00001 /*
00002 **  This file is part of Vidalia, and is subject to the license terms in the
00003 **  LICENSE file, found in the top level directory of this distribution. If you
00004 **  did not receive the LICENSE file with this file, you may obtain it from the
00005 **  Vidalia source package distributed by the Vidalia Project at
00006 **  http://www.torproject.org/projects/vidalia.html. No part of Vidalia, 
00007 **  including this file, may be copied, modified, propagated, or distributed 
00008 **  except according to the terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file StatusEventItem.cpp
00013 ** \brief Represents a single status event item in a StatusEventWidget
00014 */
00015 
00016 #ifndef _STATUSEVENTITEM_H
00017 #define _STATUSEVENTITEM_H
00018 
00019 #include <QTreeWidgetItem>
00020 
00021 class QDateTime;
00022 class QPixmap;
00023 class QString;
00024 
00025 class StatusEventItem : public QTreeWidgetItem
00026 {
00027 public:
00028   /** QModelIndex data roles used to store information with this status
00029    * event item, allowing it to be retrieved by StatusEventItemDelegate for
00030    * painting.
00031    */
00032   enum DataRole {
00033     IconRole = Qt::UserRole,
00034     TimestampRole,
00035     TitleRole,
00036     DescriptionRole,
00037     HelpUrlRole,
00038   };
00039 
00040   /** Default constructor.
00041    */
00042   StatusEventItem(QTreeWidget *parent = 0);
00043 
00044   /** Sets the <b>timestamp</b> at which this status event occurred.
00045    * \sa timestamp()
00046    */
00047   void setTimestamp(const QDateTime &timestamp);
00048 
00049   /** Returns the timestamp at which this status event occurred.
00050    * \sa setTimestamp()
00051    */
00052   QDateTime timestamp() const;
00053 
00054   /** Sets the icon to be drawn along with this status event to <b>pixmap</b>.
00055    * \sa icon()
00056    */
00057   void setIcon(const QPixmap &pixmap);
00058 
00059   /** Returns the icon draw along with this status event.
00060    * \sa setIcon()
00061    */
00062   QPixmap icon() const;
00063 
00064   /** Sets the <b>title</b> text for this status event. The title is a short
00065    * (fewer than 10 words or so) summary of the event.
00066    * \sa title()
00067    */
00068   void setTitle(const QString &title);
00069 
00070   /** Returns the title text for this status event.
00071    * \sa setTitle()
00072    */
00073   QString title() const;
00074 
00075   /** Sets the detailed <b>description</b> text for this status event. The
00076    * text should explain what the event means to the user, and any corrective
00077    * action they might need to take.
00078    * \sa description()
00079    */
00080   void setDescription(const QString &description);
00081 
00082   /** Returns the detailed description text for this status event.
00083    * \sa setDescription()
00084    */
00085   QString description() const;
00086 
00087   /** Sets the help topic URL that contains more information about this
00088    * particular status event.
00089    * \sa helpUrl
00090    */
00091   void setHelpUrl(const QString &url);
00092 
00093   /** Returns the help topic URL associated with this event item.
00094    * \sa setHelpUrl
00095    */
00096   QString helpUrl() const;
00097 
00098   /** Sets <b>toolTip</b> as the text displayed when the user hovers the mouse
00099    * over a StatusEventItem. It is more useful for particularly long item
00100    * descriptions.
00101    */
00102   void setToolTip(const QString &toolTip);
00103 
00104   /** Returns a formatted QString containing this item's timestamp, title
00105    * and description text.
00106    * \sa timestamp()
00107    * \sa title()
00108    * \sa description()
00109    */
00110   QString toString() const;
00111 
00112   /** Overloaded comparison operator that allows sorting StatusEventItem
00113    * objects based on timestamp. Returns true if <i>this</i> StatusEventItem
00114    * occurred before <b>other</b>.
00115    */
00116   virtual bool operator<(const QTreeWidgetItem &other) const;
00117 };
00118 
00119 #endif
00120