Vidalia
0.2.17
|
#include <RouterListWidget.h>
Public Types | |
enum | Columns { StatusColumn = 0, CountryColumn = 1, NameColumn = 2 } |
Public Slots | |
void | clearRouters () |
Signals | |
void | routerSelected (QList< RouterDescriptor > rd) |
void | zoomToRouter (QString id) |
Public Member Functions | |
RouterListWidget (QWidget *parent=0) | |
RouterListItem * | addRouter (const RouterDescriptor &rd) |
RouterListItem * | findRouterById (QString id) |
void | deselectAll () |
void | retranslateUi () |
Protected Member Functions | |
void | keyPressEvent (QKeyEvent *event) |
virtual void | contextMenuEvent (QContextMenuEvent *event) |
Private Slots | |
void | onSelectionChanged () |
void | copySelectedNicknames () |
void | copySelectedFingerprints () |
void | zoomToSelectedRelay () |
Private Attributes | |
QHash< QString, RouterListItem * > | _idmap |
Definition at line 33 of file RouterListWidget.h.
Columns in the list.
StatusColumn |
Status column, indicating bandwidth. |
CountryColumn |
Router's country flag. |
NameColumn |
Router's name. |
Definition at line 39 of file RouterListWidget.h.
RouterListWidget::RouterListWidget | ( | QWidget * | parent = 0 | ) |
Default constructor.
Definition at line 27 of file RouterListWidget.cpp.
References onSelectionChanged(), and StatusColumn.
RouterListItem * RouterListWidget::addRouter | ( | const RouterDescriptor & | rd | ) |
Adds a new descriptor the list.
Adds a router descriptor to the list.
Definition at line 204 of file RouterListWidget.cpp.
References _idmap, findRouterById(), RouterDescriptor::id(), and RouterListItem::update().
void RouterListWidget::clearRouters | ( | ) | [slot] |
Clears the list of router items.
Clear the list of router items.
Definition at line 148 of file RouterListWidget.cpp.
References _idmap.
void RouterListWidget::contextMenuEvent | ( | QContextMenuEvent * | event | ) | [protected, virtual] |
Displays a context menu for the user when they right-click on the widget.
Called when the user requests a context menu for a router in the list. A context menu will be displayed providing a list of actions, including zooming in on the server.
Definition at line 56 of file RouterListWidget.cpp.
References copySelectedFingerprints(), copySelectedNicknames(), IMG_COPY, IMG_ZOOM, and zoomToSelectedRelay().
void RouterListWidget::copySelectedFingerprints | ( | ) | [private, slot] |
Copies the fingerprints for all currently selected relays to the clipboard. Fingerprints are formatted as a comma-delimited list, suitable for doing dumb things with your torrc.
Definition at line 107 of file RouterListWidget.cpp.
References RouterListItem::id(), and vApp.
Referenced by contextMenuEvent().
void RouterListWidget::copySelectedNicknames | ( | ) | [private, slot] |
Copies the nicknames for all currently selected relays to the clipboard. Nicknames are formatted as a comma-delimited list, suitable for doing dumb things with your torrc.
Definition at line 88 of file RouterListWidget.cpp.
References RouterListItem::name(), and vApp.
Referenced by contextMenuEvent().
void RouterListWidget::deselectAll | ( | ) |
Deselects all currently selected routers.
Definition at line 138 of file RouterListWidget.cpp.
Referenced by keyPressEvent().
RouterListItem * RouterListWidget::findRouterById | ( | QString | id | ) |
Finds the list item whose key ID matches id. Returns 0 if not found.
Definition at line 194 of file RouterListWidget.cpp.
References _idmap.
Referenced by addRouter().
void RouterListWidget::keyPressEvent | ( | QKeyEvent * | event | ) | [protected] |
Called when the user presses a key while the list has focus.
Called when the user selects a router from the list. This will search the list for a router whose names starts with the key pressed.
Definition at line 158 of file RouterListWidget.cpp.
References deselectAll(), and NameColumn.
void RouterListWidget::onSelectionChanged | ( | ) | [private, slot] |
Called when the user clicks on an item in the list.
Called when the selected items have changed. This emits the routerSelected() signal with the descriptor for the selected router.
Definition at line 229 of file RouterListWidget.cpp.
References RouterListItem::descriptor(), and routerSelected().
Referenced by RouterListWidget().
void RouterListWidget::retranslateUi | ( | ) |
Called when the user changes the UI translation.
Definition at line 45 of file RouterListWidget.cpp.
void RouterListWidget::routerSelected | ( | QList< RouterDescriptor > | rd | ) | [signal] |
Emitted when the user selects a router from the list.
Referenced by onSelectionChanged().
void RouterListWidget::zoomToRouter | ( | QString | id | ) | [signal] |
Emitted when the user selects a router to zoom in on.
Referenced by zoomToSelectedRelay().
void RouterListWidget::zoomToSelectedRelay | ( | ) | [private, slot] |
Emits a zoomToRouter() signal containing the fingerprint of the currently selected relay.
Definition at line 125 of file RouterListWidget.cpp.
References RouterListItem::id(), and zoomToRouter().
Referenced by contextMenuEvent().
QHash<QString,RouterListItem*> RouterListWidget::_idmap [private] |
Maps a server ID to that server's list item.
Definition at line 92 of file RouterListWidget.h.
Referenced by addRouter(), clearRouters(), and findRouterById().