Vidalia  0.3.1
Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Private Slots | Private Attributes | List of all members
RouterListWidget Class Reference

#include <RouterListWidget.h>

Inheritance diagram for RouterListWidget:

Public Types

enum  Columns { StatusColumn = 0, CountryColumn = 1, NameColumn = 2 }
 

Public Slots

void clearRouters ()
 
void onRouterSearch (const QString routerNickname)
 

Signals

void routerSelected (QList< RouterDescriptor > rd)
 
void zoomToRouter (QString id)
 

Public Member Functions

 RouterListWidget (QWidget *parent=0)
 
RouterListItemaddRouter (const RouterDescriptor &rd)
 
RouterListItemfindRouterById (QString id)
 
void deselectAll ()
 
void retranslateUi ()
 
void searchNextRouter (const QString routerNickname)
 

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
 

Detailed Description

Definition at line 33 of file RouterListWidget.h.

Member Enumeration Documentation

§ Columns

Columns in the list.

Enumerator
StatusColumn 

Status column, indicating bandwidth.

CountryColumn 

Router's country flag.

NameColumn 

Router's name.

Definition at line 39 of file RouterListWidget.h.

Constructor & Destructor Documentation

§ RouterListWidget()

RouterListWidget::RouterListWidget ( QWidget *  parent = 0)

Default constructor.

Definition at line 27 of file RouterListWidget.cpp.

References connect(), onSelectionChanged(), and StatusColumn.

Member Function Documentation

§ addRouter()

RouterListItem * RouterListWidget::addRouter ( const RouterDescriptor rd)

Adds a new descriptor the list.

Adds a router descriptor to the list.

Definition at line 238 of file RouterListWidget.cpp.

References _idmap, findRouterById(), RouterDescriptor::id(), and RouterListItem::update().

§ clearRouters

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.

§ contextMenuEvent()

void RouterListWidget::contextMenuEvent ( QContextMenuEvent *  event)
protectedvirtual

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 connect(), copySelectedFingerprints(), copySelectedNicknames(), IMG_COPY, IMG_ZOOM, and zoomToSelectedRelay().

§ copySelectedFingerprints

void RouterListWidget::copySelectedFingerprints ( )
privateslot

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().

§ copySelectedNicknames

void RouterListWidget::copySelectedNicknames ( )
privateslot

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().

§ deselectAll()

void RouterListWidget::deselectAll ( )

Deselects all currently selected routers.

Definition at line 138 of file RouterListWidget.cpp.

Referenced by keyPressEvent().

§ findRouterById()

RouterListItem * RouterListWidget::findRouterById ( QString  id)

Finds the list item whose key ID matches id. Returns 0 if not found.

Definition at line 228 of file RouterListWidget.cpp.

References _idmap.

Referenced by addRouter().

§ keyPressEvent()

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 192 of file RouterListWidget.cpp.

References deselectAll(), and NameColumn.

§ onRouterSearch

void RouterListWidget::onRouterSearch ( const QString  routerNickname)
slot

Called when the search of a router is triggered by the signal textChanged from the search field.

Definition at line 158 of file RouterListWidget.cpp.

References searchNextRouter().

§ onSelectionChanged

void RouterListWidget::onSelectionChanged ( )
privateslot

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 263 of file RouterListWidget.cpp.

References RouterListItem::descriptor(), and routerSelected().

Referenced by RouterListWidget().

§ retranslateUi()

void RouterListWidget::retranslateUi ( )

Called when the user changes the UI translation.

Definition at line 45 of file RouterListWidget.cpp.

§ routerSelected

void RouterListWidget::routerSelected ( QList< RouterDescriptor rd)
signal

Emitted when the user selects a router from the list.

Referenced by onSelectionChanged().

§ searchNextRouter()

void RouterListWidget::searchNextRouter ( const QString  routerNickname)

Selects the following router whose name starts by routerNickname.

Definition at line 171 of file RouterListWidget.cpp.

References NameColumn, and QVariant.

Referenced by onRouterSearch().

§ zoomToRouter

void RouterListWidget::zoomToRouter ( QString  id)
signal

Emitted when the user selects a router to zoom in on.

Referenced by zoomToSelectedRelay().

§ zoomToSelectedRelay

void RouterListWidget::zoomToSelectedRelay ( )
privateslot

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().

Member Data Documentation

§ _idmap

QHash<QString,RouterListItem*> RouterListWidget::_idmap
private

Maps a server ID to that server's list item.

Definition at line 97 of file RouterListWidget.h.

Referenced by addRouter(), clearRouters(), and findRouterById().


The documentation for this class was generated from the following files: