00001 /* 00002 ** This file is part of Vidalia, and is subject to the license terms in the 00003 ** LICENSE file, found in the top level directory of this distribution. If you 00004 ** did not receive the LICENSE file with this file, you may obtain it from the 00005 ** Vidalia source package distributed by the Vidalia Project at 00006 ** http://www.vidalia-project.net/. No part of Vidalia, including this file, 00007 ** may be copied, modified, propagated, or distributed except according to the 00008 ** terms described in the LICENSE file. 00009 */ 00010 00011 /* 00012 ** \file circuititem.h 00013 ** \version $Id: circuititem.h 2511 2008-04-12 22:02:27Z edmanm $ 00014 ** \brief List item representing a Tor circuit and its status 00015 */ 00016 00017 #ifndef _CIRCUITITEM_H 00018 #define _CIRCUITITEM_H 00019 00020 #include <QApplication> 00021 #include <QTreeWidgetItem> 00022 #include <circuit.h> 00023 #include <stream.h> 00024 00025 #include "streamitem.h" 00026 00027 00028 class CircuitItem : public QTreeWidgetItem 00029 { 00030 Q_DECLARE_TR_FUNCTIONS(CircuitItem) 00031 00032 public: 00033 /** Default constructor */ 00034 CircuitItem(const Circuit &circuit); 00035 00036 /** Adds a stream to this circuit item */ 00037 void addStream(StreamItem *stream); 00038 /** Removes the stream item from the list and frees its memory. */ 00039 void removeStream(StreamItem *stream); 00040 /** Updates the status of this circuit item using the given circuit. */ 00041 void update(const Circuit &circuit); 00042 /** Returns the ID for this circuit. */ 00043 quint64 id() { return _circuit.id(); } 00044 /** Returns the Circuit object for this item. */ 00045 Circuit circuit() { return _circuit; } 00046 /** Returns a list of all stream items on this circuit. */ 00047 QList<StreamItem *> streams(); 00048 00049 private: 00050 Circuit _circuit; /**< Circuit associated with this item. */ 00051 }; 00052 00053 #endif 00054