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

Generated on Mon Aug 30 19:10:00 2010 for Vidalia by  doxygen 1.5.9