Vidalia
0.3.1
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
/** Selects the following router whose name starts by routerNickname. */
58
void
searchNextRouter
(
const
QString routerNickname);
59
60
signals:
61
/** Emitted when the user selects a router from the list. */
62
void
routerSelected
(QList<RouterDescriptor> rd);
63
/** Emitted when the user selects a router to zoom in on. */
64
void
zoomToRouter
(QString
id
);
65
66
public
slots:
67
/** Clears the list of router items. */
68
void
clearRouters
();
69
/** Called when the search of a router is triggered by the signal
70
* textChanged from the search field. */
71
void
onRouterSearch
(
const
QString routerNickname);
72
73
private
slots:
74
/** Called when the user clicks on an item in the list. */
75
void
onSelectionChanged
();
76
/** Copies the nicknames for all currently selected relays to the clipboard.
77
* Nicknames are formatted as a comma-delimited list, suitable for doing
78
* dumb things with your torrc. */
79
void
copySelectedNicknames
();
80
/** Copies the fingerprints for all currently selected relays to the
81
* clipboard. Fingerprints are formatted as a comma-delimited list, suitable
82
* for doing dumb things with your torrc. */
83
void
copySelectedFingerprints
();
84
/** Emits a zoomToRouter() signal containing the fingerprint of the
85
* currently selected relay. */
86
void
zoomToSelectedRelay
();
87
88
protected
:
89
/** Called when the user presses a key while the list has focus. */
90
void
keyPressEvent
(QKeyEvent *event);
91
/** Displays a context menu for the user when they right-click on the
92
* widget. */
93
virtual
void
contextMenuEvent
(QContextMenuEvent *event);
94
95
private
:
96
/** Maps a server ID to that server's list item. */
97
QHash<QString,RouterListItem*>
_idmap
;
98
};
99
100
#endif
101
RouterListWidget::addRouter
RouterListItem * addRouter(const RouterDescriptor &rd)
Definition:
RouterListWidget.cpp:238
RouterListWidget::keyPressEvent
void keyPressEvent(QKeyEvent *event)
Definition:
RouterListWidget.cpp:192
RouterListWidget
Definition:
RouterListWidget.h:33
RouterListWidget::routerSelected
void routerSelected(QList< RouterDescriptor > rd)
RouterListWidget::searchNextRouter
void searchNextRouter(const QString routerNickname)
Definition:
RouterListWidget.cpp:171
RouterListItem
Definition:
RouterListItem.h:30
RouterDescriptor
Definition:
RouterDescriptor.h:26
RouterListWidget::_idmap
QHash< QString, RouterListItem * > _idmap
Definition:
RouterListWidget.h:97
RouterListWidget::copySelectedFingerprints
void copySelectedFingerprints()
Definition:
RouterListWidget.cpp:107
RouterListWidget::onSelectionChanged
void onSelectionChanged()
Definition:
RouterListWidget.cpp:263
RouterListWidget::Columns
Columns
Definition:
RouterListWidget.h:39
RouterDescriptor.h
RouterListWidget::retranslateUi
void retranslateUi()
Definition:
RouterListWidget.cpp:45
RouterListWidget::contextMenuEvent
virtual void contextMenuEvent(QContextMenuEvent *event)
Definition:
RouterListWidget.cpp:56
RouterListWidget::findRouterById
RouterListItem * findRouterById(QString id)
Definition:
RouterListWidget.cpp:228
RouterListWidget::clearRouters
void clearRouters()
Definition:
RouterListWidget.cpp:148
RouterListWidget::zoomToRouter
void zoomToRouter(QString id)
RouterListWidget::deselectAll
void deselectAll()
Definition:
RouterListWidget.cpp:138
RouterListWidget::NameColumn
Definition:
RouterListWidget.h:42
RouterListWidget::RouterListWidget
RouterListWidget(QWidget *parent=0)
Definition:
RouterListWidget.cpp:27
RouterListWidget::copySelectedNicknames
void copySelectedNicknames()
Definition:
RouterListWidget.cpp:88
RouterListWidget::zoomToSelectedRelay
void zoomToSelectedRelay()
Definition:
RouterListWidget.cpp:125
RouterListWidget::StatusColumn
Definition:
RouterListWidget.h:40
RouterListWidget::CountryColumn
Definition:
RouterListWidget.h:41
RouterListWidget::onRouterSearch
void onRouterSearch(const QString routerNickname)
Definition:
RouterListWidget.cpp:158
Generated on Mon Oct 27 2014 19:40:11 for Vidalia by
1.8.8