routerlistitem.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 routerlistitem.h
00024  * \version $Id: routerlistitem.h 1238 2006-09-25 17:50:57Z edmanm $
00025  * \brief Item representing a single router and status in a RouterListWidget
00026  */
00027 
00028 #ifndef _ROUTERLISTITEM_H
00029 #define _ROUTERLISTITEM_H
00030 
00031 #include <QCoreApplication>
00032 #include <QTreeWidgetItem>
00033 #include <QString>
00034 #include <control/routerdescriptor.h>
00035 
00036 #include "routerlistwidget.h"
00037 
00038 class RouterListWidget;
00039 
00040 
00041 class RouterListItem : public QTreeWidgetItem
00042 {
00043   Q_DECLARE_TR_FUNCTIONS(RouterListItem)
00044 
00045 public:
00046   /** Default constructor. */
00047   RouterListItem(RouterListWidget *list, RouterDescriptor rd);
00048   /** Destructor. */
00049   ~RouterListItem();
00050 
00051   /** Updates this router item using a new descriptor. */
00052   void update(RouterDescriptor rd);
00053   /** Returns the router's ID. */
00054   QString id() const { return _rd->id(); }
00055   /** Returns the router's name. */
00056   QString name() const { return _rd->name(); }
00057   /** Returns the descriptor for this router. */
00058   RouterDescriptor descriptor() const { return *_rd; }
00059   /** Sets the location information for this router item. */
00060   void setLocation(QString location);
00061 
00062   /** Overload the comparison operator. */
00063   virtual bool operator<(const QTreeWidgetItem &other) const;
00064 
00065 private:
00066   RouterDescriptor* _rd;   /**< Descriptor for this router item. */
00067   RouterListWidget* _list; /**< The list for this list item. */
00068   qint64 _statusValue;     /**< Value used to sort items by status. */
00069 };
00070 
00071 #endif
00072 

Generated on Mon Oct 23 20:08:16 2006 for Vidalia by  doxygen 1.5.0