logtreeitem.h

Go to the documentation of this file.
00001 /****************************************************************
00002  *  Vidalia is distributed under the following license:
00003  *
00004  *  Copyright (C) 2006,  Matt Edman, Justin Hipple
00005  *
00006  *  This program is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU General Public License
00008  *  as published by the Free Software Foundation; either version 2
00009  *  of the License, or (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, 
00019  *  Boston, MA  02110-1301, USA.
00020  ****************************************************************/
00021 
00022 /** 
00023  * \file logtreeitem.h
00024  * \version $Id: logtreeitem.h 1563 2006-12-26 06:06:04Z edmanm $ 
00025  * \brief Item representing a single message in the message log
00026  */
00027 
00028 #ifndef _LOGTREEITEM_H
00029 #define _LOGTREEITEM_H
00030 
00031 #include <QTreeWidgetItem>
00032 #include <QDateTime>
00033 #include <QString>
00034 #include <control/logevent.h>
00035 
00036 
00037 class LogTreeItem : public QTreeWidgetItem
00038 {
00039 public:
00040   /** Default constructor. */
00041   LogTreeItem(LogEvent::Severity type, QString message, 
00042               QDateTime timestamp = QDateTime::currentDateTime());
00043 
00044   /** Sets the item's log time. */
00045   void setTimestamp(QDateTime timestamp);
00046   /** Sets the item's severity and appropriate background color. */
00047   void setSeverity(LogEvent::Severity type);
00048   /** Sets the item's message text. */
00049   void setMessage(QString message);
00050 
00051   /** Returns this message's sequence number. */
00052   quint32 id() const { return _seqnum; }
00053   /** Returns the timestamp for this log message. */
00054   QDateTime timestamp() const;
00055   /** Returns the severity associated with this log item. */
00056   LogEvent::Severity severity() const;
00057   /** Returns the message associated with this log item. */
00058   QString message() const;
00059   
00060   /** Returns a printable string representation of the item's contents.*/
00061   QString toString() const;
00062   /** Compares <b>other</b> to this log message item based on the current sort
00063    * column and order. */
00064   virtual bool operator<(const QTreeWidgetItem &other) const;
00065 
00066 private:
00067   quint32 _seqnum;  /**< Sequence number used to disambiguate messages with
00068                          the same timestamp. */
00069 };
00070 
00071 #endif
00072 

Generated on Wed Sep 5 15:49:27 2007 for Vidalia by  doxygen 1.5.3