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 1563 2006-12-26 06:06:04Z 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 #include <util/geoip/geoip.h>
00036 
00037 #include "routerlistwidget.h"
00038 
00039 class RouterListWidget;
00040 
00041 
00042 class RouterListItem : public QTreeWidgetItem
00043 {
00044   Q_DECLARE_TR_FUNCTIONS(RouterListItem)
00045 
00046 public:
00047   /** Default constructor. */
00048   RouterListItem(RouterListWidget *list, RouterDescriptor rd);
00049   /** Destructor. */
00050   ~RouterListItem();
00051 
00052   /** Updates this router item using a new descriptor. */
00053   void update(RouterDescriptor rd);
00054   /** Returns the router's ID. */
00055   QString id() const { return _rd->id(); }
00056   /** Returns the router's name. */
00057   QString name() const { return _rd->name(); }
00058   /** Returns the descriptor for this router. */
00059   RouterDescriptor descriptor() const { return *_rd; }
00060   /** Sets the location information for this router item. */
00061   void setLocation(GeoIp geoip);
00062 
00063   /** Overload the comparison operator. */
00064   virtual bool operator<(const QTreeWidgetItem &other) const;
00065 
00066 private:
00067   RouterDescriptor* _rd;   /**< Descriptor for this router item. */
00068   RouterListWidget* _list; /**< The list for this list item. */
00069   qint64 _statusValue;     /**< Value used to sort items by status. */
00070   QString _country;        /**< Country in which this router is likely
00071                                 located. */
00072 };
00073 
00074 #endif
00075 

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