LogTreeItem.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 LogTreeItem.h
00013 ** \version $Id: LogTreeItem.h 4054 2009-08-17 02:25:08Z edmanm $ 
00014 ** \brief Item representing a single message in the message log
00015 */
00016 
00017 #ifndef _LOGTREEITEM_H
00018 #define _LOGTREEITEM_H
00019 
00020 #include "TorControl.h"
00021 
00022 #include <QTreeWidgetItem>
00023 #include <QDateTime>
00024 #include <QString>
00025 
00026 
00027 class LogTreeItem : public QTreeWidgetItem
00028 {
00029   Q_DECLARE_TR_FUNCTIONS(LogTreeItem)
00030 
00031 public:
00032   /** Default constructor. */
00033   LogTreeItem(tc::Severity type, const QString &message, 
00034               const QDateTime &timestamp = QDateTime::currentDateTime());
00035 
00036   /** Sets the item's log time. */
00037   void setTimestamp(const QDateTime &timestamp);
00038   /** Sets the item's severity and appropriate background color. */
00039   void setSeverity(tc::Severity type);
00040   /** Sets the item's message text. */
00041   void setMessage(const QString &message);
00042 
00043   /** Returns this message's sequence number. */
00044   quint32 id() const { return _seqnum; }
00045   /** Returns the timestamp for this log message. */
00046   QDateTime timestamp() const;
00047   /** Returns the severity associated with this log item. */
00048   tc::Severity severity() const;
00049   /** Returns the message associated with this log item. */
00050   QString message() const;
00051   
00052   /** Returns a printable string representation of the item's contents.*/
00053   QString toString() const;
00054   /** Compares <b>other</b> to this log message item based on the current sort
00055    * column and order. */
00056   virtual bool operator<(const QTreeWidgetItem &other) const;
00057 
00058   /** Converts a tc::Severity enum value to a localized string description.*/
00059   static QString severityToString(tc::Severity severity);
00060 
00061 private:
00062   quint32 _seqnum;  /**< Sequence number used to disambiguate messages with
00063                          the same timestamp. */
00064 };
00065 
00066 #endif
00067 

Generated on Mon Aug 30 19:09:59 2010 for Vidalia by  doxygen 1.5.9