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 2362 2008-02-29 04:30:11Z 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 <QTreeWidgetItem> 00021 #include <QDateTime> 00022 #include <QString> 00023 #include <logevent.h> 00024 00025 00026 class LogTreeItem : public QTreeWidgetItem 00027 { 00028 public: 00029 /** Default constructor. */ 00030 LogTreeItem(LogEvent::Severity type, QString message, 00031 QDateTime timestamp = QDateTime::currentDateTime()); 00032 00033 /** Sets the item's log time. */ 00034 void setTimestamp(QDateTime timestamp); 00035 /** Sets the item's severity and appropriate background color. */ 00036 void setSeverity(LogEvent::Severity type); 00037 /** Sets the item's message text. */ 00038 void setMessage(QString message); 00039 00040 /** Returns this message's sequence number. */ 00041 quint32 id() const { return _seqnum; } 00042 /** Returns the timestamp for this log message. */ 00043 QDateTime timestamp() const; 00044 /** Returns the severity associated with this log item. */ 00045 LogEvent::Severity severity() const; 00046 /** Returns the message associated with this log item. */ 00047 QString message() const; 00048 00049 /** Returns a printable string representation of the item's contents.*/ 00050 QString toString() const; 00051 /** Compares <b>other</b> to this log message item based on the current sort 00052 * column and order. */ 00053 virtual bool operator<(const QTreeWidgetItem &other) const; 00054 00055 private: 00056 quint32 _seqnum; /**< Sequence number used to disambiguate messages with 00057 the same timestamp. */ 00058 }; 00059 00060 #endif 00061