Vidalia  0.2.17
CircuitItem.h
Go to the documentation of this file.
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.torproject.org/projects/vidalia.html. No part of Vidalia, 
00007 **  including this file, may be copied, modified, propagated, or distributed 
00008 **  except according to the terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file CircuitItem.h
00013 ** \brief List item representing a Tor circuit and its status
00014 */
00015 
00016 #ifndef _CIRCUITITEM_H
00017 #define _CIRCUITITEM_H
00018 
00019 #include "StreamItem.h"
00020 
00021 #include "Circuit.h"
00022 #include "Stream.h"
00023 
00024 #include <QApplication>
00025 #include <QTreeWidgetItem>
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   CircuitId id() const { return _circuit.id(); }
00044   /** Returns the Circuit object for this item. */
00045   Circuit circuit() const { return _circuit; }
00046   /** Returns a list of all stream items on this circuit. */
00047   QList<StreamItem *> streams() const;
00048   
00049 private:
00050   Circuit _circuit; /**< Circuit associated with this item. */
00051 };
00052 
00053 #endif
00054