#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 (const Circuit &circuit) |
void | addStream (const Stream &stream) |
QList< Circuit > | circuits () |
Private Slots | |
void | removeCircuit () |
void | removeStream () |
void | onSelectionChanged (QTreeWidgetItem *cur, QTreeWidgetItem *prev) |
void | customContextMenuRequested (const QPoint &pos) |
void | closeSelectedConnections () |
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 | |
QList< CircuitItem * > | _circuitRemovalList |
QList< StreamItem * > | _streamRemovalList |
Definition at line 30 of file circuitlistwidget.h.
Circuit list columns.
ConnectionColumn | Column for either the circuit or stream |
StatusColumn | Status of the connection. |
Definition at line 36 of file circuitlistwidget.h.
CircuitListWidget::CircuitListWidget | ( | QWidget * | parent = 0 |
) |
Default constructor
Default constructor.
Definition at line 33 of file circuitlistwidget.cpp.
References closeSelectedConnections(), customContextMenuRequested(), onSelectionChanged(), and vApp.
void CircuitListWidget::addCircuit | ( | const Circuit & | circuit | ) |
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.
Definition at line 127 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 | ( | const 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 153 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().
CircuitList CircuitListWidget::circuits | ( | ) |
Returns a list of circuits currently in the widget.
Definition at line 334 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 closeSelectedConnections(), and customContextMenuRequested().
void CircuitListWidget::closeStream | ( | quint64 | streamid | ) | [signal] |
Emitted when the user selects a stream to be closed.
Referenced by closeSelectedConnections(), and customContextMenuRequested().
void CircuitListWidget::zoomToCircuit | ( | quint64 | circid | ) | [signal] |
Emitted when the user selects a circuit to zoom to.
Referenced by customContextMenuRequested().
void CircuitListWidget::clearCircuits | ( | ) | [slot] |
Clears all circuits and streams from the list.
Definition at line 264 of file circuitlistwidget.cpp.
References _circuitRemovalList, and _streamRemovalList.
void CircuitListWidget::removeCircuit | ( | ) | [private, slot] |
Removes the first circuit scheduled to be removed.
Removes the first circuit scheduled to be removed.
Definition at line 201 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 237 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 310 of file circuitlistwidget.cpp.
References CircuitItem::circuit(), and circuitSelected().
Referenced by CircuitListWidget().
void CircuitListWidget::customContextMenuRequested | ( | const QPoint & | pos | ) | [private, slot] |
Called when the user requests a context menu on a circuit or stream in the list and displays a context menu appropriate for whichever type of item is currently selected.
Called when the user requests a context menu on a circuit or stream in the list and displays a context menu appropriate for whichever type of item is currently selected.
Definition at line 55 of file circuitlistwidget.cpp.
References Circuit::Built, CircuitItem::circuit(), closeCircuit(), closeStream(), StreamItem::id(), CircuitItem::id(), IMG_CLOSE, IMG_ZOOM, Circuit::status(), and zoomToCircuit().
Referenced by CircuitListWidget().
void CircuitListWidget::closeSelectedConnections | ( | ) | [private, slot] |
Closes all selected circuits or streams.
Definition at line 108 of file circuitlistwidget.cpp.
References closeCircuit(), closeStream(), StreamItem::id(), and CircuitItem::id().
Referenced by CircuitListWidget().
void CircuitListWidget::removeCircuit | ( | CircuitItem * | circuit | ) | [private] |
Removes the given circuit item and all streams on that circuit.
Definition at line 213 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 247 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 274 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 289 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 181 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 191 of file circuitlistwidget.cpp.
References _streamRemovalList, and removeStream().
Referenced by addStream().
QList<CircuitItem *> CircuitListWidget::_circuitRemovalList [private] |
List of circuit items to be removed.
Definition at line 98 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 100 of file circuitlistwidget.h.
Referenced by clearCircuits(), removeCircuit(), removeStream(), and scheduleStreamRemoval().