RouterListItem.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 RouterListItem.h
00013 ** \version $Id: RouterListItem.h 3735 2009-04-28 20:28:01Z edmanm $
00014 ** \brief Item representing a single router and status in a RouterListWidget
00015 */
00016 
00017 #ifndef _ROUTERLISTITEM_H
00018 #define _ROUTERLISTITEM_H
00019 
00020 #include "RouterDescriptor.h"
00021 #include "RouterListWidget.h"
00022 #include "GeoIp.h"
00023 
00024 #include <QCoreApplication>
00025 #include <QTreeWidgetItem>
00026 #include <QString>
00027 
00028 class RouterListWidget;
00029 
00030 
00031 class RouterListItem : public QTreeWidgetItem
00032 {
00033   Q_DECLARE_TR_FUNCTIONS(RouterListItem)
00034 
00035 public:
00036   /** Default constructor. */
00037   RouterListItem(RouterListWidget *list, RouterDescriptor rd);
00038   /** Destructor. */
00039   ~RouterListItem();
00040 
00041   /** Updates this router item using a new descriptor. */
00042   void update(const RouterDescriptor &rd);
00043   /** Returns the router's ID. */
00044   QString id() const { return _rd->id(); }
00045   /** Returns the router's name. */
00046   QString name() const { return _rd->name(); }
00047   /** Returns the descriptor for this router. */
00048   RouterDescriptor descriptor() const { return *_rd; }
00049   /** Sets the location information for this router item. */
00050   void setLocation(const GeoIp &geoip);
00051   /** Returns the location information set for this router item. */
00052   QString location() const { return _rd->location(); }
00053 
00054   /** Overload the comparison operator. */
00055   virtual bool operator<(const QTreeWidgetItem &other) const;
00056 
00057 private:
00058   RouterDescriptor* _rd;   /**< Descriptor for this router item. */
00059   RouterListWidget* _list; /**< The list for this list item. */
00060   qint64 _statusValue;     /**< Value used to sort items by status. */
00061   QString _country;        /**< Country in which this router is likely
00062                                 located. */
00063 };
00064 
00065 #endif
00066 
Generated on Mon Aug 30 23:09:50 2010 for Vidalia by  doxygen 1.6.3