#include <routerlistwidget.h>
Public Types | |
enum | Columns { StatusColumn = 0, CountryColumn = 1, NameColumn = 2 } |
Public Slots | |
void | clearRouters () |
Signals | |
void | routerSelected (RouterDescriptor rd) |
void | zoomToRouter (QString id) |
Public Member Functions | |
RouterListWidget (QWidget *parent=0) | |
void | addRouter (RouterDescriptor rd) |
RouterListItem * | findRouterById (QString id) |
void | deselectAll () |
Protected Member Functions | |
void | keyPressEvent (QKeyEvent *event) |
Private Slots | |
void | onSelectionChanged () |
void | customContextMenuRequested (const QPoint &pos) |
Private Attributes | |
QHash< QString, RouterListItem * > | _idmap |
Definition at line 32 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 38 of file routerlistwidget.h.
RouterListWidget::RouterListWidget | ( | QWidget * | parent = 0 |
) |
Default constructor.
Definition at line 25 of file routerlistwidget.cpp.
References customContextMenuRequested(), onSelectionChanged(), and StatusColumn.
void RouterListWidget::addRouter | ( | RouterDescriptor | rd | ) |
Adds a new descriptor the list.
Adds a router descriptor to the list.
Definition at line 135 of file routerlistwidget.cpp.
References _idmap, findRouterById(), RouterDescriptor::id(), and RouterListItem::update().
RouterListItem * RouterListWidget::findRouterById | ( | QString | id | ) |
Finds the list item whose key ID matches id. Returns 0 if not found.
Definition at line 125 of file routerlistwidget.cpp.
References _idmap.
Referenced by addRouter().
void RouterListWidget::deselectAll | ( | ) |
Deselects all currently selected routers.
Definition at line 69 of file routerlistwidget.cpp.
Referenced by keyPressEvent().
void RouterListWidget::routerSelected | ( | 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 customContextMenuRequested().
void RouterListWidget::clearRouters | ( | ) | [slot] |
Clears the list of router items.
Clear the list of router items.
Definition at line 79 of file routerlistwidget.cpp.
References _idmap.
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 158 of file routerlistwidget.cpp.
References routerSelected().
Referenced by RouterListWidget().
void RouterListWidget::customContextMenuRequested | ( | const QPoint & | pos | ) | [private, slot] |
Called when the user requests a context menu for some router in the list.
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 47 of file routerlistwidget.cpp.
References RouterListItem::id(), IMG_ZOOM, and zoomToRouter().
Referenced by RouterListWidget().
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 89 of file routerlistwidget.cpp.
References deselectAll(), and NameColumn.
QHash<QString,RouterListItem*> RouterListWidget::_idmap [private] |
Maps a server ID to that server's list item.
Definition at line 79 of file routerlistwidget.h.
Referenced by addRouter(), clearRouters(), and findRouterById().