Vidalia
0.3.1
src
vidalia
network
RouterListItem.h
Go to the documentation of this file.
1
/*
2
** This file is part of Vidalia, and is subject to the license terms in the
3
** LICENSE file, found in the top level directory of this distribution. If you
4
** did not receive the LICENSE file with this file, you may obtain it from the
5
** Vidalia source package distributed by the Vidalia Project at
6
** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7
** including this file, may be copied, modified, propagated, or distributed
8
** except according to the terms described in the LICENSE file.
9
*/
10
11
/*
12
** \file RouterListItem.h
13
** \brief Item representing a single router and status in a RouterListWidget
14
*/
15
16
#ifndef _ROUTERLISTITEM_H
17
#define _ROUTERLISTITEM_H
18
19
#include "
RouterDescriptor.h
"
20
#include "
RouterListWidget.h
"
21
#include "
GeoIpRecord.h
"
22
23
#include <QCoreApplication>
24
#include <QTreeWidgetItem>
25
#include <QString>
26
27
class
RouterListWidget
;
28
29
30
class
RouterListItem
:
public
QTreeWidgetItem
31
{
32
Q_DECLARE_TR_FUNCTIONS(
RouterListItem
)
33
34
public
:
35
/** Default constructor. */
36
RouterListItem
(
RouterListWidget
*list,
RouterDescriptor
rd);
37
/** Destructor. */
38
~RouterListItem
();
39
40
/** Updates this router item using a new descriptor. */
41
void
update
(
const
RouterDescriptor
&rd);
42
/** Returns the router's ID. */
43
QString
id
()
const
{
return
_rd
->
id
(); }
44
/** Returns the router's name. */
45
QString
name
()
const
{
return
_rd
->
name
(); }
46
/** Returns the descriptor for this router. */
47
RouterDescriptor
descriptor
()
const
{
return
*
_rd
; }
48
/** Sets the location information for this router item. */
49
void
setLocation
(
const
GeoIpRecord
&geoip);
50
/** Returns the location information set for this router item. */
51
GeoIpRecord
location
()
const
{
return
_location
; }
52
53
/** Overload the comparison operator. */
54
virtual
bool
operator<
(
const
QTreeWidgetItem &other)
const
;
55
56
private
:
57
RouterDescriptor
*
_rd
;
/**< Descriptor for this router item. */
58
RouterListWidget
*
_list
;
/**< The list for this list item. */
59
qint64
_statusValue
;
/**< Value used to sort items by status. */
60
GeoIpRecord
_location
;
/**< Location information for this router. */
61
QString
_countryCode
;
62
};
63
64
#endif
65
RouterListItem
Definition:
RouterListItem.h:30
GeoIpRecord
Definition:
GeoIpRecord.h:24
RouterListItem::_countryCode
QString _countryCode
Definition:
RouterListItem.h:61
GeoIpRecord.h
RouterListItem::id
QString id() const
Definition:
RouterListItem.h:43
RouterListWidget
Definition:
RouterListWidget.h:33
RouterDescriptor::name
QString name() const
Definition:
RouterDescriptor.h:44
RouterListItem::RouterListItem
RouterListItem(RouterListWidget *list, RouterDescriptor rd)
Definition:
RouterListItem.cpp:35
RouterListItem::_list
RouterListWidget * _list
Definition:
RouterListItem.h:58
RouterListItem::_rd
RouterDescriptor * _rd
Definition:
RouterListItem.h:57
RouterListItem::setLocation
void setLocation(const GeoIpRecord &geoip)
Definition:
RouterListItem.cpp:95
RouterListItem::update
void update(const RouterDescriptor &rd)
Definition:
RouterListItem.cpp:54
RouterListWidget.h
RouterListItem::location
GeoIpRecord location() const
Definition:
RouterListItem.h:51
RouterListItem::_statusValue
qint64 _statusValue
Definition:
RouterListItem.h:59
RouterDescriptor::id
QString id() const
Definition:
RouterDescriptor.h:52
RouterDescriptor.h
RouterListItem::~RouterListItem
~RouterListItem()
Definition:
RouterListItem.cpp:46
RouterDescriptor
Definition:
RouterDescriptor.h:26
RouterListItem::_location
GeoIpRecord _location
Definition:
RouterListItem.h:60
RouterListItem::operator<
virtual bool operator<(const QTreeWidgetItem &other) const
Definition:
RouterListItem.cpp:110
RouterListItem::descriptor
RouterDescriptor descriptor() const
Definition:
RouterListItem.h:47
RouterListItem::name
QString name() const
Definition:
RouterListItem.h:45
Generated by
1.8.17