Vidalia  0.3.1
CircuitItem.h
Go to the documentation of this file.
1 /*
2 ** This file is part of Vidalia, and is subject to the license terms in the
3 ** LICENSE file, found in the top level directory of this distribution. If you
4 ** did not receive the LICENSE file with this file, you may obtain it from the
5 ** Vidalia source package distributed by the Vidalia Project at
6 ** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7 ** including this file, may be copied, modified, propagated, or distributed
8 ** except according to the terms described in the LICENSE file.
9 */
10 
11 /*
12 ** \file CircuitItem.h
13 ** \brief List item representing a Tor circuit and its status
14 */
15 
16 #ifndef _CIRCUITITEM_H
17 #define _CIRCUITITEM_H
18 
19 #include "StreamItem.h"
20 
21 #include "Circuit.h"
22 #include "Stream.h"
23 
24 #include <QApplication>
25 #include <QTreeWidgetItem>
26 
27 
28 class CircuitItem : public QTreeWidgetItem
29 {
30  Q_DECLARE_TR_FUNCTIONS(CircuitItem)
31 
32 public:
33  /** Default constructor */
34  CircuitItem(const Circuit &circuit);
35 
36  /** Adds a stream to this circuit item */
37  void addStream(StreamItem *stream);
38  /** Removes the stream item from the list and frees its memory. */
39  void removeStream(StreamItem *stream);
40  /** Updates the status of this circuit item using the given circuit. */
41  void update(const Circuit &circuit);
42  /** Returns the ID for this circuit. */
43  CircuitId id() const { return _circuit.id(); }
44  /** Returns the Circuit object for this item. */
45  Circuit circuit() const { return _circuit; }
46  /** Returns a list of all stream items on this circuit. */
47  QList<StreamItem *> streams() const;
48 
49 private:
50  Circuit _circuit; /**< Circuit associated with this item. */
51 };
52 
53 #endif
54 
CircuitItem(const Circuit &circuit)
Definition: CircuitItem.cpp:21
Circuit _circuit
Definition: CircuitItem.h:50
Circuit circuit() const
Definition: CircuitItem.h:45
void removeStream(StreamItem *stream)
Definition: CircuitItem.cpp:56
void update(const Circuit &circuit)
Definition: CircuitItem.cpp:29
void addStream(StreamItem *stream)
Definition: CircuitItem.cpp:49
CircuitId id() const
Definition: CircuitItem.h:43
CircuitId id() const
Definition: Circuit.h:51
QList< StreamItem * > streams() const
Definition: CircuitItem.cpp:66
QString CircuitId
Definition: Circuit.h:24