00001 /**************************************************************** 00002 * Vidalia is distributed under the following license: 00003 * 00004 * Copyright (C) 2006, Matt Edman, Justin Hipple 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, USA. 00020 ****************************************************************/ 00021 00022 /** 00023 * \file circuititem.h 00024 * \version $Id: circuititem.h 1627 2007-02-05 02:04:30Z edmanm $ 00025 * \brief List item representing a Tor circuit and its status 00026 */ 00027 00028 #ifndef _CIRCUITITEM_H 00029 #define _CIRCUITITEM_H 00030 00031 #include <QApplication> 00032 #include <QTreeWidgetItem> 00033 #include <control/circuit.h> 00034 #include <control/stream.h> 00035 00036 #include "streamitem.h" 00037 00038 00039 class CircuitItem : public QTreeWidgetItem 00040 { 00041 Q_DECLARE_TR_FUNCTIONS(CircuitItem) 00042 00043 public: 00044 /** Default constructor */ 00045 CircuitItem(Circuit circuit, QString displayedPath); 00046 00047 /** Adds a stream to this circuit item */ 00048 void addStream(StreamItem *stream); 00049 /** Removes the stream item from the list and frees its memory. */ 00050 void removeStream(StreamItem *stream); 00051 /** Updates the status of this circuit item using the given circuit. */ 00052 void update(Circuit circuit, QString displayedPath); 00053 /** Returns the ID for this circuit. */ 00054 quint64 id() { return _circuit.id(); } 00055 /** Returns the Circuit object for this item. */ 00056 Circuit circuit() { return _circuit; } 00057 /** Returns a list of all stream items on this circuit. */ 00058 QList<StreamItem *> streams(); 00059 00060 private: 00061 Circuit _circuit; /**< Circuit associated with this item. */ 00062 }; 00063 00064 #endif 00065