Loading src/gui/network/circuititem.cpp +25 −2 Changes for src/gui/network/circuititem.cpp: 25 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -31,8 +31,6 @@ /** Constructor */ CircuitItem::CircuitItem(Circuit circuit) { /* Save the circuit id */ _id = circuit.id(); /* Update the displayed text */ update(circuit); } Loading @@ -41,6 +39,9 @@ CircuitItem::CircuitItem(Circuit circuit) void CircuitItem::update(Circuit circuit) { /* Save the Circuit object */ _circuit = circuit; /* Get the path, or put in a semi-meaningful value if the path is empty */ QString path = circuit.path(); if (path.isEmpty()) { Loading @@ -59,3 +60,25 @@ CircuitItem::addStream(StreamItem *stream) addChild(stream); } /** Removes the stream item from this circuit and frees its memory */ void CircuitItem::removeStream(StreamItem *stream) { int index = indexOfChild(stream); if (index > -1) { delete takeChild(index); } } /** Returns a list of all stream items on this circuit. */ QList<StreamItem *> CircuitItem::streams() { QList<StreamItem *> streams; QList<QTreeWidgetItem *> items = this->takeChildren(); foreach (QTreeWidgetItem *item, items) { streams << (StreamItem *)item; } return streams; } src/gui/network/circuititem.h +8 −2 Changes for src/gui/network/circuititem.h: 8 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -45,13 +45,19 @@ public: /** Adds a stream to this circuit item */ void addStream(StreamItem *stream); /** Removes the stream item from the list and frees its memory. */ void removeStream(StreamItem *stream); /** Updates the status of this circuit item using the given circuit. */ void update(Circuit circuit); /** Returns the ID for this circuit. */ quint64 id() { return _id; } quint64 id() { return _circuit.id(); } /** Returns the Circuit object for this item. */ Circuit circuit() { return _circuit; } /** Returns a list of all stream items on this circuit. */ QList<StreamItem *> streams(); private: quint64 _id; /**< Circuit ID associated with this item. */ Circuit _circuit; /**< Circuit associated with this item. */ }; #endif Loading Loading
src/gui/network/circuititem.cpp +25 −2 Changes for src/gui/network/circuititem.cpp: 25 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -31,8 +31,6 @@ /** Constructor */ CircuitItem::CircuitItem(Circuit circuit) { /* Save the circuit id */ _id = circuit.id(); /* Update the displayed text */ update(circuit); } Loading @@ -41,6 +39,9 @@ CircuitItem::CircuitItem(Circuit circuit) void CircuitItem::update(Circuit circuit) { /* Save the Circuit object */ _circuit = circuit; /* Get the path, or put in a semi-meaningful value if the path is empty */ QString path = circuit.path(); if (path.isEmpty()) { Loading @@ -59,3 +60,25 @@ CircuitItem::addStream(StreamItem *stream) addChild(stream); } /** Removes the stream item from this circuit and frees its memory */ void CircuitItem::removeStream(StreamItem *stream) { int index = indexOfChild(stream); if (index > -1) { delete takeChild(index); } } /** Returns a list of all stream items on this circuit. */ QList<StreamItem *> CircuitItem::streams() { QList<StreamItem *> streams; QList<QTreeWidgetItem *> items = this->takeChildren(); foreach (QTreeWidgetItem *item, items) { streams << (StreamItem *)item; } return streams; }
src/gui/network/circuititem.h +8 −2 Changes for src/gui/network/circuititem.h: 8 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -45,13 +45,19 @@ public: /** Adds a stream to this circuit item */ void addStream(StreamItem *stream); /** Removes the stream item from the list and frees its memory. */ void removeStream(StreamItem *stream); /** Updates the status of this circuit item using the given circuit. */ void update(Circuit circuit); /** Returns the ID for this circuit. */ quint64 id() { return _id; } quint64 id() { return _circuit.id(); } /** Returns the Circuit object for this item. */ Circuit circuit() { return _circuit; } /** Returns a list of all stream items on this circuit. */ QList<StreamItem *> streams(); private: quint64 _id; /**< Circuit ID associated with this item. */ Circuit _circuit; /**< Circuit associated with this item. */ }; #endif Loading