#include <circuitlistwidget.h>
Public Types | |
enum | Columns { ConnectionColumn = 0, StatusColumn = 1 } |
Public Slots | |
void | clearCircuits () |
Signals | |
void | circuitSelected (Circuit circuit) |
void | circuitRemoved (quint64 circid) |
void | closeCircuit (quint64 circid) |
void | closeStream (quint64 streamid) |
void | zoomToCircuit (quint64 circid) |
Public Member Functions | |
CircuitListWidget (QWidget *parent=0) | |
void | addCircuit (Circuit circuit, QString displayedPath) |
void | addStream (Stream stream) |
QList< Circuit > | circuits () |
Protected Member Functions | |
virtual void | mouseReleaseEvent (QMouseEvent *e) |
Private Slots | |
void | removeCircuit () |
void | removeStream () |
void | onSelectionChanged (QTreeWidgetItem *cur, QTreeWidgetItem *prev) |
Private Member Functions | |
void | removeCircuit (CircuitItem *circuit) |
void | removeStream (StreamItem *stream) |
CircuitItem * | findCircuitItem (quint64 circid) |
StreamItem * | findStreamItem (quint64 streamid) |
void | scheduleCircuitRemoval (CircuitItem *circuit, int delay) |
void | scheduleStreamRemoval (StreamItem *stream, int delay) |
Private Attributes | |
QMenu * | _circuitContextMenu |
QAction * | _closeCircuitAct |
QAction * | _zoomCircuitAct |
QMenu * | _streamContextMenu |
QAction * | _closeStreamAct |
QList< CircuitItem * > | _circuitRemovalList |
QList< StreamItem * > | _streamRemovalList |
Definition at line 41 of file circuitlistwidget.h.
Circuit list columns.
ConnectionColumn | Column for either the circuit or stream |
StatusColumn | Status of the connection. |
Definition at line 47 of file circuitlistwidget.h.
CircuitListWidget::CircuitListWidget | ( | QWidget * | parent = 0 |
) |
Default constructor
Default constructor.
Definition at line 43 of file circuitlistwidget.cpp.
References _circuitContextMenu, _closeCircuitAct, _closeStreamAct, _streamContextMenu, _zoomCircuitAct, IMG_CLOSE, IMG_ZOOM, and onSelectionChanged().
void CircuitListWidget::addCircuit | ( | Circuit | circuit, | |
QString | displayedPath | |||
) |
Adds a circuit to the list. If the circuit already exists in the list, the status and path will be updated.
Adds a circuit to the list. If the circuit already exists in the list, the status and path will be updated. displayedPath contains a description of the circuit's path suitable for humans to read.
Definition at line 107 of file circuitlistwidget.cpp.
References Circuit::Closed, CLOSED_CIRCUIT_REMOVE_DELAY, Circuit::Failed, FAILED_CIRCUIT_REMOVE_DELAY, findCircuitItem(), Circuit::id(), scheduleCircuitRemoval(), Circuit::status(), and CircuitItem::update().
void CircuitListWidget::addStream | ( | Stream | stream | ) |
Adds a stream to the list. If the stream already exists in the list, the status and path will be updated.
Definition at line 133 of file circuitlistwidget.cpp.
References CircuitItem::addStream(), Stream::circuitId(), Stream::Closed, CLOSED_STREAM_REMOVE_DELAY, Stream::Failed, FAILED_STREAM_REMOVE_DELAY, findCircuitItem(), findStreamItem(), Stream::id(), scheduleStreamRemoval(), Stream::status(), and StreamItem::update().
QList< Circuit > CircuitListWidget::circuits | ( | ) |
Returns a list of circuits currently in the widget.
Definition at line 316 of file circuitlistwidget.cpp.
References CircuitItem::circuit(), and i().
void CircuitListWidget::circuitSelected | ( | Circuit | circuit | ) | [signal] |
Emitted when a circuit item is selected.
Referenced by onSelectionChanged().
void CircuitListWidget::circuitRemoved | ( | quint64 | circid | ) | [signal] |
Emitted when a circuit is removed from the list.
Referenced by removeCircuit().
void CircuitListWidget::closeCircuit | ( | quint64 | circid | ) | [signal] |
Emitted when the user selects a circuit to be closed.
Referenced by mouseReleaseEvent().
void CircuitListWidget::closeStream | ( | quint64 | streamid | ) | [signal] |
Emitted when the user selects a stream to be closed.
Referenced by mouseReleaseEvent().
void CircuitListWidget::zoomToCircuit | ( | quint64 | circid | ) | [signal] |
Emitted when the user selects a circuit to zoom to.
Referenced by mouseReleaseEvent().
void CircuitListWidget::clearCircuits | ( | ) | [slot] |
Clears all circuits and streams from the list.
Definition at line 244 of file circuitlistwidget.cpp.
References _circuitRemovalList, and _streamRemovalList.
void CircuitListWidget::mouseReleaseEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
Called when the user presses and releases a mouse button.
Called when the user presses and releases a mouse button. If the event indicates a right-click and a circuit or stream is selected, an appropriate context menu will be displayed.
Definition at line 70 of file circuitlistwidget.cpp.
References _circuitContextMenu, _closeCircuitAct, _closeStreamAct, _streamContextMenu, _zoomCircuitAct, Circuit::Built, closeCircuit(), closeStream(), Circuit::id(), Circuit::status(), and zoomToCircuit().
void CircuitListWidget::removeCircuit | ( | ) | [private, slot] |
Removes the first circuit scheduled to be removed.
Removes the first circuit scheduled to be removed.
Definition at line 181 of file circuitlistwidget.cpp.
References _circuitRemovalList, CircuitItem::circuit(), circuitRemoved(), and Circuit::id().
Referenced by scheduleCircuitRemoval().
void CircuitListWidget::removeStream | ( | ) | [private, slot] |
Removes the first stream scheduled to be removed.
Definition at line 217 of file circuitlistwidget.cpp.
References _streamRemovalList.
Referenced by scheduleStreamRemoval().
void CircuitListWidget::onSelectionChanged | ( | QTreeWidgetItem * | cur, | |
QTreeWidgetItem * | prev | |||
) | [private, slot] |
Called when the current item selectio has changed.
Called when the current item selection has changed.
Definition at line 290 of file circuitlistwidget.cpp.
References CircuitItem::circuit(), circuitSelected(), and Circuit::length().
Referenced by CircuitListWidget().
void CircuitListWidget::removeCircuit | ( | CircuitItem * | circuit | ) | [private] |
Removes the given circuit item and all streams on that circuit.
Definition at line 193 of file circuitlistwidget.cpp.
References _streamRemovalList, CircuitItem::removeStream(), and CircuitItem::streams().
void CircuitListWidget::removeStream | ( | StreamItem * | stream | ) | [private] |
Removes the given stream item.
Definition at line 227 of file circuitlistwidget.cpp.
References CircuitItem::removeStream().
CircuitItem * CircuitListWidget::findCircuitItem | ( | quint64 | circid | ) | [private] |
Finds the circuit with the given ID.
Finds the circuit with the given ID and returns a pointer to that circuit's item in the list.
Definition at line 254 of file circuitlistwidget.cpp.
References i(), and CircuitItem::id().
Referenced by addCircuit(), and addStream().
StreamItem * CircuitListWidget::findStreamItem | ( | quint64 | streamid | ) | [private] |
Finds the stream with the given ID.
Finds the stream with the given ID and returns a pointer to that stream's item in the list.
Definition at line 269 of file circuitlistwidget.cpp.
References i(), and StreamItem::id().
Referenced by addStream().
void CircuitListWidget::scheduleCircuitRemoval | ( | CircuitItem * | circuit, | |
int | delay | |||
) | [private] |
Schedules the given circuit item to be removed after the given timeout.
Schedules the given circuit to be removed after the specified timeout.
Definition at line 161 of file circuitlistwidget.cpp.
References _circuitRemovalList, and removeCircuit().
Referenced by addCircuit().
void CircuitListWidget::scheduleStreamRemoval | ( | StreamItem * | stream, | |
int | delay | |||
) | [private] |
Schedules a stream to be removed after the given timeout.
Schedules the given stream to be removed after the specified timeout.
Definition at line 171 of file circuitlistwidget.cpp.
References _streamRemovalList, and removeStream().
Referenced by addStream().
QMenu* CircuitListWidget::_circuitContextMenu [private] |
Context menu for circuit items.
Definition at line 107 of file circuitlistwidget.h.
Referenced by CircuitListWidget(), and mouseReleaseEvent().
QAction* CircuitListWidget::_closeCircuitAct [private] |
Closes a circuit.
Definition at line 108 of file circuitlistwidget.h.
Referenced by CircuitListWidget(), and mouseReleaseEvent().
QAction* CircuitListWidget::_zoomCircuitAct [private] |
Zoom to a circuit.
Definition at line 109 of file circuitlistwidget.h.
Referenced by CircuitListWidget(), and mouseReleaseEvent().
QMenu* CircuitListWidget::_streamContextMenu [private] |
Context menu for stream items.
Definition at line 110 of file circuitlistwidget.h.
Referenced by CircuitListWidget(), and mouseReleaseEvent().
QAction* CircuitListWidget::_closeStreamAct [private] |
Closes a stream.
Definition at line 111 of file circuitlistwidget.h.
Referenced by CircuitListWidget(), and mouseReleaseEvent().
QList<CircuitItem *> CircuitListWidget::_circuitRemovalList [private] |
List of circuit items to be removed.
Definition at line 114 of file circuitlistwidget.h.
Referenced by clearCircuits(), removeCircuit(), and scheduleCircuitRemoval().
QList<StreamItem *> CircuitListWidget::_streamRemovalList [private] |
List of stream items to be removed.
Definition at line 116 of file circuitlistwidget.h.
Referenced by clearCircuits(), removeCircuit(), removeStream(), and scheduleStreamRemoval().