Vidalia
0.2.21
Main Page
Namespaces
Classes
Files
File List
File Members
src
vidalia
network
RouterListWidget.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 RouterListWidget.h
13
** \brief Displays a list of Tor servers and their status
14
*/
15
16
#ifndef _ROUTERLISTWIDGET_H
17
#define _ROUTERLISTWIDGET_H
18
19
#include "
RouterDescriptor.h
"
20
21
#include <QHash>
22
#include <QList>
23
#include <QMenu>
24
#include <QObject>
25
#include <QAction>
26
#include <QKeyEvent>
27
#include <QTreeWidget>
28
#include <QHostAddress>
29
#include <QMouseEvent>
30
31
class
RouterListItem
;
32
33
class
RouterListWidget
:
public
QTreeWidget
34
{
35
Q_OBJECT
36
37
public
:
38
/** Columns in the list. */
39
enum
Columns
{
40
StatusColumn
= 0,
/**< Status column, indicating bandwidth. */
41
CountryColumn
= 1,
/**< Router's country flag. */
42
NameColumn
= 2,
/**< Router's name. */
43
};
44
45
/** Default constructor. */
46
RouterListWidget
(QWidget *parent = 0);
47
48
/** Adds a new descriptor the list. */
49
RouterListItem
*
addRouter
(
const
RouterDescriptor
&rd);
50
/** Finds the list item whose key ID matches <b>id</b>. Returns 0 if not
51
* found. */
52
RouterListItem
*
findRouterById
(QString
id
);
53
/** Deselects all currently selected routers. */
54
void
deselectAll
();
55
/** Called when the user changes the UI translation. */
56
void
retranslateUi
();
57
58
signals:
59
/** Emitted when the user selects a router from the list. */
60
void
routerSelected
(QList<RouterDescriptor> rd);
61
/** Emitted when the user selects a router to zoom in on. */
62
void
zoomToRouter
(QString
id
);
63
64
public
slots:
65
/** Clears the list of router items. */
66
void
clearRouters
();
67
68
private
slots:
69
/** Called when the user clicks on an item in the list. */
70
void
onSelectionChanged
();
71
/** Copies the nicknames for all currently selected relays to the clipboard.
72
* Nicknames are formatted as a comma-delimited list, suitable for doing
73
* dumb things with your torrc. */
74
void
copySelectedNicknames
();
75
/** Copies the fingerprints for all currently selected relays to the
76
* clipboard. Fingerprints are formatted as a comma-delimited list, suitable
77
* for doing dumb things with your torrc. */
78
void
copySelectedFingerprints
();
79
/** Emits a zoomToRouter() signal containing the fingerprint of the
80
* currently selected relay. */
81
void
zoomToSelectedRelay
();
82
83
protected
:
84
/** Called when the user presses a key while the list has focus. */
85
void
keyPressEvent
(QKeyEvent *event);
86
/** Displays a context menu for the user when they right-click on the
87
* widget. */
88
virtual
void
contextMenuEvent
(QContextMenuEvent *event);
89
90
private
:
91
/** Maps a server ID to that server's list item. */
92
QHash<QString,RouterListItem*>
_idmap
;
93
};
94
95
#endif
96
Generated on Thu Dec 6 2012 04:33:17 for Vidalia by
1.8.2