Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-backports > by-pkgid > 9601c7beb4ff23e834bfa171795ed560 > files > 61

vidalia-0.2.9-1mdv2010.1.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Vidalia: CircuitListWidget.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_b47abd1aad201a152869566145babb61.html">src</a>&nbsp;&raquo;&nbsp;<a class="el" href="dir_695ba8f8357372e02d38c40b3c6dbe81.html">vidalia</a>&nbsp;&raquo;&nbsp;<a class="el" href="dir_3776330d706700e272fa8df738fecea6.html">network</a>
  </div>
</div>
<div class="contents">
<h1>CircuitListWidget.cpp</h1><a href="_circuit_list_widget_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">**  This file is part of Vidalia, and is subject to the license terms in the</span>
<a name="l00003"></a>00003 <span class="comment">**  LICENSE file, found in the top level directory of this distribution. If you</span>
<a name="l00004"></a>00004 <span class="comment">**  did not receive the LICENSE file with this file, you may obtain it from the</span>
<a name="l00005"></a>00005 <span class="comment">**  Vidalia source package distributed by the Vidalia Project at</span>
<a name="l00006"></a>00006 <span class="comment">**  http://www.vidalia-project.net/. No part of Vidalia, including this file,</span>
<a name="l00007"></a>00007 <span class="comment">**  may be copied, modified, propagated, or distributed except according to the</span>
<a name="l00008"></a>00008 <span class="comment">**  terms described in the LICENSE file.</span>
<a name="l00009"></a>00009 <span class="comment">*/</span>
<a name="l00010"></a>00010 
<a name="l00011"></a>00011 <span class="comment">/*</span>
<a name="l00012"></a>00012 <span class="comment">** \file CircuitListWidget.cpp</span>
<a name="l00013"></a>00013 <span class="comment">** \version $Id: CircuitListWidget.cpp 3735 2009-04-28 20:28:01Z edmanm $</span>
<a name="l00014"></a>00014 <span class="comment">** \brief Collection of Tor circuits as CircuitItems</span>
<a name="l00015"></a>00015 <span class="comment">*/</span>
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#include &quot;<a class="code" href="config_8h.html">config.h</a>&quot;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &quot;<a class="code" href="_circuit_list_widget_8h.html">CircuitListWidget.h</a>&quot;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &quot;<a class="code" href="_vidalia_8h.html">Vidalia.h</a>&quot;</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;QPoint&gt;</span>
<a name="l00022"></a>00022 <span class="preprocessor">#include &lt;QTimer&gt;</span>
<a name="l00023"></a>00023 
<a name="l00024"></a><a class="code" href="_circuit_list_widget_8cpp.html#a8041ef2a8e60ce63138060104f58c346">00024</a> <span class="preprocessor">#define IMG_CLOSE   &quot;:/images/22x22/edit-delete.png&quot;</span>
<a name="l00025"></a><a class="code" href="_circuit_list_widget_8cpp.html#acd9ba5751ca9757c4c35bf3fa38cab90">00025</a> <span class="preprocessor"></span><span class="preprocessor">#define IMG_ZOOM    &quot;:/images/22x22/page-zoom.png&quot;</span>
<a name="l00026"></a>00026 <span class="preprocessor"></span>
<a name="l00027"></a><a class="code" href="_circuit_list_widget_8cpp.html#ae3965cafa71c859470334c8a8bf76515">00027</a> <span class="preprocessor">#define CLOSED_CIRCUIT_REMOVE_DELAY     3000</span>
<a name="l00028"></a><a class="code" href="_circuit_list_widget_8cpp.html#a4502df947a72b66c747a14bada3b8710">00028</a> <span class="preprocessor"></span><span class="preprocessor">#define FAILED_CIRCUIT_REMOVE_DELAY     5000</span>
<a name="l00029"></a><a class="code" href="_circuit_list_widget_8cpp.html#acb70de295790a573ab6aea97fe0e019e">00029</a> <span class="preprocessor"></span><span class="preprocessor">#define CLOSED_STREAM_REMOVE_DELAY      3000</span>
<a name="l00030"></a><a class="code" href="_circuit_list_widget_8cpp.html#ab62757cb6aad449e383ac80b39002cc3">00030</a> <span class="preprocessor"></span><span class="preprocessor">#define FAILED_STREAM_REMOVE_DELAY      4000</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span>
<a name="l00032"></a>00032 <span class="comment"></span>
<a name="l00033"></a>00033 <span class="comment">/** Default constructor. */</span>
<a name="l00034"></a><a class="code" href="class_circuit_list_widget.html#a9d5ce03cac30dae5c3e01c2eaaa53d6c">00034</a> <a class="code" href="class_circuit_list_widget.html#a9d5ce03cac30dae5c3e01c2eaaa53d6c">CircuitListWidget::CircuitListWidget</a>(QWidget *parent)
<a name="l00035"></a>00035 : QTreeWidget(parent)
<a name="l00036"></a>00036 {
<a name="l00037"></a>00037   <span class="comment">/* Create and initialize columns */</span>
<a name="l00038"></a>00038   setHeaderLabels(QStringList() &lt;&lt; tr(<span class="stringliteral">&quot;Connection&quot;</span>) &lt;&lt; tr(<span class="stringliteral">&quot;Status&quot;</span>));
<a name="l00039"></a>00039 
<a name="l00040"></a>00040   <span class="comment">/* Find out when a circuit has been selected */</span>
<a name="l00041"></a>00041   connect(<span class="keyword">this</span>, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
<a name="l00042"></a>00042           <span class="keyword">this</span>, SLOT(<a class="code" href="class_circuit_list_widget.html#accf71aaf7d4723174d9992b7880d1df2">onSelectionChanged</a>(QTreeWidgetItem*,QTreeWidgetItem*)));
<a name="l00043"></a>00043   connect(<span class="keyword">this</span>, SIGNAL(<a class="code" href="class_circuit_list_widget.html#ac932ade6b941a2f0eaa527572c1e6207">customContextMenuRequested</a>(QPoint)),
<a name="l00044"></a>00044           <span class="keyword">this</span>, SLOT(<a class="code" href="class_circuit_list_widget.html#ac932ade6b941a2f0eaa527572c1e6207">customContextMenuRequested</a>(QPoint)));
<a name="l00045"></a>00045 
<a name="l00046"></a>00046   <span class="comment">/* Respond to the Delete key by closing whatever circuits or streams are</span>
<a name="l00047"></a>00047 <span class="comment">   * selected. */</span>
<a name="l00048"></a>00048   <a class="code" href="_vidalia_8h.html#aef0a1c1e9430e6b86892ae28b1577294">vApp</a>-&gt;createShortcut(QKeySequence::Delete, <span class="keyword">this</span>, <span class="keyword">this</span>,
<a name="l00049"></a>00049                        SLOT(<a class="code" href="class_circuit_list_widget.html#acbb9112730ea96f23a5cf075aa318a91">closeSelectedConnections</a>()));
<a name="l00050"></a>00050 }
<a name="l00051"></a>00051 <span class="comment"></span>
<a name="l00052"></a>00052 <span class="comment">/** Called when the user changes the UI translation. */</span>
<a name="l00053"></a>00053 <span class="keywordtype">void</span>
<a name="l00054"></a><a class="code" href="class_circuit_list_widget.html#ad0d21105bb2c7151859b5c5b4a5c78fb">00054</a> <a class="code" href="class_circuit_list_widget.html#ad0d21105bb2c7151859b5c5b4a5c78fb">CircuitListWidget::retranslateUi</a>()
<a name="l00055"></a>00055 {
<a name="l00056"></a>00056   setHeaderLabels(QStringList() &lt;&lt; tr(<span class="stringliteral">&quot;Connection&quot;</span>) &lt;&lt; tr(<span class="stringliteral">&quot;Status&quot;</span>));
<a name="l00057"></a>00057   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> <a class="code" href="html_8cpp.html#a4a5dba6492ea149585950c59c210ff47">i</a> = 0; <a class="code" href="html_8cpp.html#a4a5dba6492ea149585950c59c210ff47">i</a> &lt; topLevelItemCount(); <a class="code" href="html_8cpp.html#a4a5dba6492ea149585950c59c210ff47">i</a>++) {
<a name="l00058"></a>00058     <a class="code" href="class_circuit_item.html">CircuitItem</a> *circuitItem = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="class_circuit_item.html">CircuitItem</a> *<span class="keyword">&gt;</span>(topLevelItem(<a class="code" href="html_8cpp.html#a4a5dba6492ea149585950c59c210ff47">i</a>));
<a name="l00059"></a>00059     circuitItem-&gt;<a class="code" href="class_circuit_item.html#af463413258ba86785057a694af28e55c">update</a>(circuitItem-&gt;<a class="code" href="class_circuit_item.html#a2967068cdbc30a1f5a3ab57843d48738">circuit</a>());
<a name="l00060"></a>00060 
<a name="l00061"></a>00061     <span class="keywordflow">foreach</span> (<a class="code" href="class_stream_item.html">StreamItem</a> *streamItem, circuitItem-&gt;<a class="code" href="class_circuit_item.html#af18957010aa7b7b467a73070cefc25f6">streams</a>()) {
<a name="l00062"></a>00062       streamItem-&gt;<a class="code" href="class_stream_item.html#a8d89ab1b067fb3aff201a8348b1a88d4">update</a>(streamItem-&gt;<a class="code" href="class_stream_item.html#adcbe2a6d861df522d045b8c5bb3b2f48">stream</a>());
<a name="l00063"></a>00063     }
<a name="l00064"></a>00064   }
<a name="l00065"></a>00065 }
<a name="l00066"></a>00066 <span class="comment"></span>
<a name="l00067"></a>00067 <span class="comment">/** Called when the user requests a context menu on a circuit or stream in the</span>
<a name="l00068"></a>00068 <span class="comment"> * list and displays a context menu appropriate for whichever type of item is</span>
<a name="l00069"></a>00069 <span class="comment"> * currently selected. */</span>
<a name="l00070"></a>00070 <span class="keywordtype">void</span>
<a name="l00071"></a><a class="code" href="class_circuit_list_widget.html#ac932ade6b941a2f0eaa527572c1e6207">00071</a> <a class="code" href="class_circuit_list_widget.html#ac932ade6b941a2f0eaa527572c1e6207">CircuitListWidget::customContextMenuRequested</a>(<span class="keyword">const</span> QPoint &amp;pos)
<a name="l00072"></a>00072 {
<a name="l00073"></a>00073   QMenu menu(<span class="keyword">this</span>);
<a name="l00074"></a>00074 
<a name="l00075"></a>00075   <span class="comment">/* Find out which item was right-clicked */</span>
<a name="l00076"></a>00076   QTreeWidgetItem *item = itemAt(pos);
<a name="l00077"></a>00077   <span class="keywordflow">if</span> (!item)
<a name="l00078"></a>00078     <span class="keywordflow">return</span>;
<a name="l00079"></a>00079     
<a name="l00080"></a>00080   <span class="keywordflow">if</span> (!item-&gt;parent()) {
<a name="l00081"></a>00081     <span class="comment">/* A circuit was selected */</span>
<a name="l00082"></a>00082     <a class="code" href="class_circuit_item.html">CircuitItem</a> *circuitItem = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="class_circuit_item.html">CircuitItem</a> *<span class="keyword">&gt;</span>(item);
<a name="l00083"></a>00083     <span class="keywordflow">if</span> (!circuitItem)
<a name="l00084"></a>00084       <span class="keywordflow">return</span>;
<a name="l00085"></a>00085 
<a name="l00086"></a>00086     <span class="comment">/* Set up the circuit context menu */</span>
<a name="l00087"></a>00087     QAction *zoomAct  = <span class="keyword">new</span> QAction(QIcon(<a class="code" href="_circuit_list_widget_8cpp.html#acd9ba5751ca9757c4c35bf3fa38cab90">IMG_ZOOM</a>),
<a name="l00088"></a>00088                                     tr(<span class="stringliteral">&quot;Zoom to Circuit&quot;</span>), <span class="keyword">this</span>);
<a name="l00089"></a>00089     QAction *closeAct = <span class="keyword">new</span> QAction(QIcon(<a class="code" href="_circuit_list_widget_8cpp.html#a8041ef2a8e60ce63138060104f58c346">IMG_CLOSE</a>),
<a name="l00090"></a>00090                                     tr(<span class="stringliteral">&quot;Close Circuit (Del)&quot;</span>), <span class="keyword">this</span>);
<a name="l00091"></a>00091 <span class="preprocessor">#if defined(USE_MARBLE)</span>
<a name="l00092"></a>00092 <span class="preprocessor"></span>    zoomAct-&gt;setEnabled(circuitItem-&gt;<a class="code" href="class_circuit_item.html#a2967068cdbc30a1f5a3ab57843d48738">circuit</a>().<a class="code" href="class_circuit.html#a33c78724c92b50c7aa28b247a88a79f4">status</a>() == <a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0aad2f6d14053da3729ae9063cfa8125037">Circuit::Built</a>);
<a name="l00093"></a>00093     menu.addAction(zoomAct);
<a name="l00094"></a>00094     menu.addSeparator();
<a name="l00095"></a>00095 <span class="preprocessor">#endif</span>
<a name="l00096"></a>00096 <span class="preprocessor"></span>    menu.addAction(closeAct);
<a name="l00097"></a>00097       
<a name="l00098"></a>00098     <span class="comment">/* Display the context menu and find out which (if any) action was</span>
<a name="l00099"></a>00099 <span class="comment">     * selected */</span>
<a name="l00100"></a>00100     QAction* action = menu.exec(mapToGlobal(pos));
<a name="l00101"></a>00101     <span class="keywordflow">if</span> (action == closeAct)
<a name="l00102"></a>00102       emit <a class="code" href="class_circuit_list_widget.html#a399d0ea6232dccad5e5ce473ab382cf2">closeCircuit</a>(circuitItem-&gt;<a class="code" href="class_circuit_item.html#a00ab1f5cc2836fae97f6d8299306c069">id</a>());
<a name="l00103"></a>00103     <span class="keywordflow">else</span> <span class="keywordflow">if</span> (action == zoomAct)
<a name="l00104"></a>00104       emit <a class="code" href="class_circuit_list_widget.html#a41b384f6ed16c14e3b3298d9131b78fd">zoomToCircuit</a>(circuitItem-&gt;<a class="code" href="class_circuit_item.html#a00ab1f5cc2836fae97f6d8299306c069">id</a>());
<a name="l00105"></a>00105   } <span class="keywordflow">else</span> {
<a name="l00106"></a>00106     <span class="comment">/* A stream was selected */</span>
<a name="l00107"></a>00107     <a class="code" href="class_stream_item.html">StreamItem</a> *streamItem = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="class_stream_item.html">StreamItem</a> *<span class="keyword">&gt;</span>(item);
<a name="l00108"></a>00108     <span class="keywordflow">if</span> (!streamItem)
<a name="l00109"></a>00109       <span class="keywordflow">return</span>;
<a name="l00110"></a>00110  
<a name="l00111"></a>00111     <span class="comment">/* Set up the stream context menu */</span>
<a name="l00112"></a>00112     QAction *closeAct = <span class="keyword">new</span> QAction(QIcon(<a class="code" href="_circuit_list_widget_8cpp.html#a8041ef2a8e60ce63138060104f58c346">IMG_CLOSE</a>),
<a name="l00113"></a>00113                                     tr(<span class="stringliteral">&quot;Close Stream (Del)&quot;</span>), <span class="keyword">this</span>);
<a name="l00114"></a>00114     menu.addAction(closeAct);
<a name="l00115"></a>00115 
<a name="l00116"></a>00116     <span class="comment">/* Display the context menu and find out which (if any) action was</span>
<a name="l00117"></a>00117 <span class="comment">     * selected */</span>
<a name="l00118"></a>00118     QAction* action = menu.exec(mapToGlobal(pos));
<a name="l00119"></a>00119     <span class="keywordflow">if</span> (action == closeAct)
<a name="l00120"></a>00120       emit <a class="code" href="class_circuit_list_widget.html#a103dfb4393cf4d54b46519c9f1673287">closeStream</a>(streamItem-&gt;<a class="code" href="class_stream_item.html#add2791d9b64f180fccef1733a3643587">id</a>());
<a name="l00121"></a>00121   }
<a name="l00122"></a>00122 }
<a name="l00123"></a>00123 <span class="comment"></span>
<a name="l00124"></a>00124 <span class="comment">/** Closes all selected circuits or streams. */</span>
<a name="l00125"></a>00125 <span class="keywordtype">void</span>
<a name="l00126"></a><a class="code" href="class_circuit_list_widget.html#acbb9112730ea96f23a5cf075aa318a91">00126</a> <a class="code" href="class_circuit_list_widget.html#acbb9112730ea96f23a5cf075aa318a91">CircuitListWidget::closeSelectedConnections</a>()
<a name="l00127"></a>00127 {
<a name="l00128"></a>00128   QList&lt;QTreeWidgetItem *&gt; items = selectedItems();
<a name="l00129"></a>00129   <span class="keywordflow">foreach</span> (QTreeWidgetItem *item, items) {
<a name="l00130"></a>00130     <span class="keywordflow">if</span> (!item-&gt;parent()) {
<a name="l00131"></a>00131       <a class="code" href="class_circuit_item.html">CircuitItem</a> *circuitItem = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="class_circuit_item.html">CircuitItem</a> *<span class="keyword">&gt;</span>(item);
<a name="l00132"></a>00132       <span class="keywordflow">if</span> (circuitItem)
<a name="l00133"></a>00133         emit <a class="code" href="class_circuit_list_widget.html#a399d0ea6232dccad5e5ce473ab382cf2">closeCircuit</a>(circuitItem-&gt;<a class="code" href="class_circuit_item.html#a00ab1f5cc2836fae97f6d8299306c069">id</a>());
<a name="l00134"></a>00134     } <span class="keywordflow">else</span> {
<a name="l00135"></a>00135       <a class="code" href="class_stream_item.html">StreamItem</a> *streamItem = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="class_stream_item.html">StreamItem</a> *<span class="keyword">&gt;</span>(item);
<a name="l00136"></a>00136       <span class="keywordflow">if</span> (streamItem)
<a name="l00137"></a>00137         emit <a class="code" href="class_circuit_list_widget.html#a103dfb4393cf4d54b46519c9f1673287">closeStream</a>(streamItem-&gt;<a class="code" href="class_stream_item.html#add2791d9b64f180fccef1733a3643587">id</a>());
<a name="l00138"></a>00138     }
<a name="l00139"></a>00139   }
<a name="l00140"></a>00140 }
<a name="l00141"></a>00141 <span class="comment"></span>
<a name="l00142"></a>00142 <span class="comment">/** Adds a &lt;b&gt;circuit&lt;/b&gt; to the list. If the circuit already exists in the</span>
<a name="l00143"></a>00143 <span class="comment"> * list, the status and path will be updated. */</span>
<a name="l00144"></a>00144 <span class="keywordtype">void</span>
<a name="l00145"></a><a class="code" href="class_circuit_list_widget.html#ab8134701211559f0c000c95420946def">00145</a> <a class="code" href="class_circuit_list_widget.html#ab8134701211559f0c000c95420946def">CircuitListWidget::addCircuit</a>(<span class="keyword">const</span> <a class="code" href="class_circuit.html">Circuit</a> &amp;circuit)
<a name="l00146"></a>00146 {
<a name="l00147"></a>00147   <span class="comment">/* Check to see if the circuit already exists in the tree */</span>
<a name="l00148"></a>00148   <a class="code" href="class_circuit_item.html">CircuitItem</a> *item = <a class="code" href="class_circuit_list_widget.html#a139c575830e5338dd3096042deef157e">findCircuitItem</a>(circuit.<a class="code" href="class_circuit.html#a3083f9c330227c6f46b3ab32e071f7be">id</a>());
<a name="l00149"></a>00149   
<a name="l00150"></a>00150   <span class="keywordflow">if</span> (!item) {
<a name="l00151"></a>00151     <span class="comment">/* Add the new circuit */</span>
<a name="l00152"></a>00152     item = <span class="keyword">new</span> <a class="code" href="class_circuit_item.html">CircuitItem</a>(circuit);
<a name="l00153"></a>00153     addTopLevelItem(item);
<a name="l00154"></a>00154   } <span class="keywordflow">else</span> {
<a name="l00155"></a>00155     <span class="comment">/* Circuit already exists, so update its status and path */</span>
<a name="l00156"></a>00156     item-&gt;<a class="code" href="class_circuit_item.html#af463413258ba86785057a694af28e55c">update</a>(circuit);
<a name="l00157"></a>00157   }
<a name="l00158"></a>00158 
<a name="l00159"></a>00159   <span class="comment">/* If the circuit is closed or dead, schedule it for removal */</span>
<a name="l00160"></a>00160   <a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0a">Circuit::Status</a> status = circuit.<a class="code" href="class_circuit.html#a33c78724c92b50c7aa28b247a88a79f4">status</a>();
<a name="l00161"></a>00161   <span class="keywordflow">if</span> (status == <a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0aa870aea6e455b0bfec4f9ff3764c9623f">Circuit::Closed</a>) {
<a name="l00162"></a>00162     <a class="code" href="class_circuit_list_widget.html#a2724ddbba7060e08b742f1768f9115d2">scheduleCircuitRemoval</a>(item, <a class="code" href="_circuit_list_widget_8cpp.html#ae3965cafa71c859470334c8a8bf76515">CLOSED_CIRCUIT_REMOVE_DELAY</a>);
<a name="l00163"></a>00163   } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (status == <a class="code" href="class_circuit.html#ae831da69eb5ffd2af9f470d90c613d0aa28e1a44a072277cd8ff8610a66e1ef90">Circuit::Failed</a>) {
<a name="l00164"></a>00164     <a class="code" href="class_circuit_list_widget.html#a2724ddbba7060e08b742f1768f9115d2">scheduleCircuitRemoval</a>(item, <a class="code" href="_circuit_list_widget_8cpp.html#a4502df947a72b66c747a14bada3b8710">FAILED_CIRCUIT_REMOVE_DELAY</a>);
<a name="l00165"></a>00165   }
<a name="l00166"></a>00166 }
<a name="l00167"></a>00167 <span class="comment"></span>
<a name="l00168"></a>00168 <span class="comment">/** Adds a stream to the list. If the stream already exists in the list, the</span>
<a name="l00169"></a>00169 <span class="comment"> * status and path will be updated. */</span>
<a name="l00170"></a>00170 <span class="keywordtype">void</span>
<a name="l00171"></a><a class="code" href="class_circuit_list_widget.html#afcf86dcaa9f1a653ea7164c8253629dd">00171</a> <a class="code" href="class_circuit_list_widget.html#afcf86dcaa9f1a653ea7164c8253629dd">CircuitListWidget::addStream</a>(<span class="keyword">const</span> <a class="code" href="class_stream.html">Stream</a> &amp;stream)
<a name="l00172"></a>00172 {
<a name="l00173"></a>00173   <span class="comment">/* Check to see if the stream already exists in the tree */</span>
<a name="l00174"></a>00174   <a class="code" href="class_stream_item.html">StreamItem</a> *item = <a class="code" href="class_circuit_list_widget.html#a3c67287d994a254de8467a06e88884fa">findStreamItem</a>(stream.<a class="code" href="class_stream.html#ac289e56fcae8e2283e6055d75eb6382d">id</a>());
<a name="l00175"></a>00175 
<a name="l00176"></a>00176   <span class="keywordflow">if</span> (!item) {
<a name="l00177"></a>00177     <a class="code" href="class_circuit_item.html">CircuitItem</a> *circuit = <a class="code" href="class_circuit_list_widget.html#a139c575830e5338dd3096042deef157e">findCircuitItem</a>(stream.<a class="code" href="class_stream.html#ab1a8fcb8353bace64d4d56bd5b4d07a2">circuitId</a>());
<a name="l00178"></a>00178     <span class="comment">/* New stream, so try to find its circuit and add it */</span>
<a name="l00179"></a>00179     <span class="keywordflow">if</span> (circuit) {
<a name="l00180"></a>00180       circuit-&gt;<a class="code" href="class_circuit_item.html#a46b3b74322a64d61dae58deebbd6bc6e">addStream</a>(<span class="keyword">new</span> <a class="code" href="class_stream_item.html">StreamItem</a>(stream));
<a name="l00181"></a>00181       expandItem(circuit);
<a name="l00182"></a>00182     }
<a name="l00183"></a>00183   } <span class="keywordflow">else</span> {
<a name="l00184"></a>00184     <span class="comment">/* Stream already exists, so just update its status */</span>
<a name="l00185"></a>00185     item-&gt;<a class="code" href="class_stream_item.html#a8d89ab1b067fb3aff201a8348b1a88d4">update</a>(stream);
<a name="l00186"></a>00186 
<a name="l00187"></a>00187     <span class="comment">/* If the stream is closed or dead, schedule it for removal */</span>
<a name="l00188"></a>00188     <a class="code" href="class_stream.html#abe342e3ab850c3b79befd8073dd613c2">Stream::Status</a> status = stream.<a class="code" href="class_stream.html#ae704c6dddc0196b8813de2769426fed6">status</a>();
<a name="l00189"></a>00189     <span class="keywordflow">if</span> (status == <a class="code" href="class_stream.html#abe342e3ab850c3b79befd8073dd613c2aac96f9b4c5acde5c2c1070f57b8447d4">Stream::Closed</a>) {
<a name="l00190"></a>00190       <a class="code" href="class_circuit_list_widget.html#a9b9c3e73d9b07d7f6a5eb319889aad78">scheduleStreamRemoval</a>(item, <a class="code" href="_circuit_list_widget_8cpp.html#acb70de295790a573ab6aea97fe0e019e">CLOSED_STREAM_REMOVE_DELAY</a>);
<a name="l00191"></a>00191     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (status == <a class="code" href="class_stream.html#abe342e3ab850c3b79befd8073dd613c2a1435e25b3f7e41821a2a32821b4e1f17">Stream::Failed</a>) {
<a name="l00192"></a>00192       <a class="code" href="class_circuit_list_widget.html#a9b9c3e73d9b07d7f6a5eb319889aad78">scheduleStreamRemoval</a>(item, <a class="code" href="_circuit_list_widget_8cpp.html#ab62757cb6aad449e383ac80b39002cc3">FAILED_STREAM_REMOVE_DELAY</a>);
<a name="l00193"></a>00193     }
<a name="l00194"></a>00194   }
<a name="l00195"></a>00195 }
<a name="l00196"></a>00196 <span class="comment"></span>
<a name="l00197"></a>00197 <span class="comment">/** Schedules the given circuit to be removed after the specified timeout. */</span>
<a name="l00198"></a>00198 <span class="keywordtype">void</span>
<a name="l00199"></a><a class="code" href="class_circuit_list_widget.html#a2724ddbba7060e08b742f1768f9115d2">00199</a> <a class="code" href="class_circuit_list_widget.html#a2724ddbba7060e08b742f1768f9115d2">CircuitListWidget::scheduleCircuitRemoval</a>(<a class="code" href="class_circuit_item.html">CircuitItem</a> *circuit, <span class="keywordtype">int</span> delay)
<a name="l00200"></a>00200 {
<a name="l00201"></a>00201   <span class="keywordflow">if</span> (!<a class="code" href="class_circuit_list_widget.html#a03209d5e42f72ac6e1eb18c88bb9135b">_circuitRemovalList</a>.contains(circuit)) {
<a name="l00202"></a>00202     <a class="code" href="class_circuit_list_widget.html#a03209d5e42f72ac6e1eb18c88bb9135b">_circuitRemovalList</a> &lt;&lt; circuit;
<a name="l00203"></a>00203     QTimer::singleShot(delay, <span class="keyword">this</span>, SLOT(<a class="code" href="class_circuit_list_widget.html#adcd147f3c3d817e7c7cf0e620cc03c19">removeCircuit</a>()));
<a name="l00204"></a>00204   } 
<a name="l00205"></a>00205 }
<a name="l00206"></a>00206 <span class="comment"></span>
<a name="l00207"></a>00207 <span class="comment">/** Schedules the given stream to be removed after the specified timeout. */</span>
<a name="l00208"></a>00208 <span class="keywordtype">void</span>
<a name="l00209"></a><a class="code" href="class_circuit_list_widget.html#a9b9c3e73d9b07d7f6a5eb319889aad78">00209</a> <a class="code" href="class_circuit_list_widget.html#a9b9c3e73d9b07d7f6a5eb319889aad78">CircuitListWidget::scheduleStreamRemoval</a>(<a class="code" href="class_stream_item.html">StreamItem</a> *stream, <span class="keywordtype">int</span> delay)
<a name="l00210"></a>00210 {
<a name="l00211"></a>00211   <span class="keywordflow">if</span> (!<a class="code" href="class_circuit_list_widget.html#aad5db525f48e0eb84d288b9f27d52a98">_streamRemovalList</a>.contains(stream)) {
<a name="l00212"></a>00212     <a class="code" href="class_circuit_list_widget.html#aad5db525f48e0eb84d288b9f27d52a98">_streamRemovalList</a> &lt;&lt; stream;
<a name="l00213"></a>00213     QTimer::singleShot(delay, <span class="keyword">this</span>, SLOT(<a class="code" href="class_circuit_list_widget.html#a52eb949b9bd3fa14e03afff0084676fb">removeStream</a>()));
<a name="l00214"></a>00214   } 
<a name="l00215"></a>00215 }
<a name="l00216"></a>00216 <span class="comment"></span>
<a name="l00217"></a>00217 <span class="comment">/** Removes the first circuit scheduled to be removed. */</span>
<a name="l00218"></a>00218 <span class="keywordtype">void</span>
<a name="l00219"></a><a class="code" href="class_circuit_list_widget.html#adcd147f3c3d817e7c7cf0e620cc03c19">00219</a> <a class="code" href="class_circuit_list_widget.html#adcd147f3c3d817e7c7cf0e620cc03c19">CircuitListWidget::removeCircuit</a>()
<a name="l00220"></a>00220 {
<a name="l00221"></a>00221   <span class="keywordflow">if</span> (!<a class="code" href="class_circuit_list_widget.html#a03209d5e42f72ac6e1eb18c88bb9135b">_circuitRemovalList</a>.isEmpty()) {
<a name="l00222"></a>00222     <a class="code" href="class_circuit_item.html">CircuitItem</a> *circuitItem = <a class="code" href="class_circuit_list_widget.html#a03209d5e42f72ac6e1eb18c88bb9135b">_circuitRemovalList</a>.takeFirst();
<a name="l00223"></a>00223     <a class="code" href="class_circuit.html">Circuit</a> circuit = circuitItem-&gt;<a class="code" href="class_circuit_item.html#a2967068cdbc30a1f5a3ab57843d48738">circuit</a>();
<a name="l00224"></a>00224     <a class="code" href="class_circuit_list_widget.html#adcd147f3c3d817e7c7cf0e620cc03c19">removeCircuit</a>(circuitItem);
<a name="l00225"></a>00225     emit <a class="code" href="class_circuit_list_widget.html#ad0997fc899c7e63bfbc41dfcb764c1ee">circuitRemoved</a>(circuit.<a class="code" href="class_circuit.html#a3083f9c330227c6f46b3ab32e071f7be">id</a>());
<a name="l00226"></a>00226   }
<a name="l00227"></a>00227 }
<a name="l00228"></a>00228 <span class="comment"></span>
<a name="l00229"></a>00229 <span class="comment">/** Removes the given circuit item and all streams on that circuit. */</span>
<a name="l00230"></a>00230 <span class="keywordtype">void</span>
<a name="l00231"></a><a class="code" href="class_circuit_list_widget.html#a5aac8ab6608334fe63148ca212febed8">00231</a> <a class="code" href="class_circuit_list_widget.html#adcd147f3c3d817e7c7cf0e620cc03c19">CircuitListWidget::removeCircuit</a>(<a class="code" href="class_circuit_item.html">CircuitItem</a> *circuit)
<a name="l00232"></a>00232 {
<a name="l00233"></a>00233   <span class="keywordflow">if</span> (circuit) {
<a name="l00234"></a>00234     <span class="comment">/* Remove all streams (if any) on this circuit. */</span>
<a name="l00235"></a>00235     QList&lt;StreamItem *&gt; streams = circuit-&gt;<a class="code" href="class_circuit_item.html#af18957010aa7b7b467a73070cefc25f6">streams</a>();
<a name="l00236"></a>00236     <span class="keywordflow">foreach</span> (<a class="code" href="class_stream_item.html">StreamItem</a> *stream, streams) {
<a name="l00237"></a>00237       <span class="comment">/* Check if this stream was scheduled for removal already */</span>
<a name="l00238"></a>00238       <span class="keywordflow">if</span> (<a class="code" href="class_circuit_list_widget.html#aad5db525f48e0eb84d288b9f27d52a98">_streamRemovalList</a>.contains(stream)) {
<a name="l00239"></a>00239         <span class="comment">/* If this stream was already scheduled for removal, replace its pointer</span>
<a name="l00240"></a>00240 <span class="comment">         * with 0, so it doesn&#39;t get removed twice. */</span>
<a name="l00241"></a>00241         <span class="keywordtype">int</span> index = <a class="code" href="class_circuit_list_widget.html#aad5db525f48e0eb84d288b9f27d52a98">_streamRemovalList</a>.indexOf(stream);
<a name="l00242"></a>00242         <a class="code" href="class_circuit_list_widget.html#aad5db525f48e0eb84d288b9f27d52a98">_streamRemovalList</a>.replace(index, (<a class="code" href="class_stream_item.html">StreamItem</a> *)0);
<a name="l00243"></a>00243       }
<a name="l00244"></a>00244       
<a name="l00245"></a>00245       <span class="comment">/* Remove the stream item from the circuit */</span>
<a name="l00246"></a>00246       circuit-&gt;<a class="code" href="class_circuit_item.html#a64fe0d46e4d29d6fe762ef8c82e43fb1">removeStream</a>(stream);
<a name="l00247"></a>00247     }
<a name="l00248"></a>00248     <span class="comment">/* Remove the circuit item itself */</span>
<a name="l00249"></a>00249     <span class="keyword">delete</span> takeTopLevelItem(indexOfTopLevelItem(circuit));
<a name="l00250"></a>00250   }
<a name="l00251"></a>00251 }
<a name="l00252"></a>00252 <span class="comment"></span>
<a name="l00253"></a>00253 <span class="comment">/** Removes the first stream scheduled to be removed. */</span>
<a name="l00254"></a>00254 <span class="keywordtype">void</span>
<a name="l00255"></a><a class="code" href="class_circuit_list_widget.html#a52eb949b9bd3fa14e03afff0084676fb">00255</a> <a class="code" href="class_circuit_list_widget.html#a52eb949b9bd3fa14e03afff0084676fb">CircuitListWidget::removeStream</a>()
<a name="l00256"></a>00256 {
<a name="l00257"></a>00257   <span class="keywordflow">if</span> (!<a class="code" href="class_circuit_list_widget.html#aad5db525f48e0eb84d288b9f27d52a98">_streamRemovalList</a>.isEmpty()) {
<a name="l00258"></a>00258     <a class="code" href="class_stream_item.html">StreamItem</a> *stream = <a class="code" href="class_circuit_list_widget.html#aad5db525f48e0eb84d288b9f27d52a98">_streamRemovalList</a>.takeFirst();
<a name="l00259"></a>00259     <a class="code" href="class_circuit_list_widget.html#a52eb949b9bd3fa14e03afff0084676fb">removeStream</a>(stream);
<a name="l00260"></a>00260   }
<a name="l00261"></a>00261 }
<a name="l00262"></a>00262 <span class="comment"></span>
<a name="l00263"></a>00263 <span class="comment">/** Removes the given stream item. */</span>
<a name="l00264"></a>00264 <span class="keywordtype">void</span>
<a name="l00265"></a><a class="code" href="class_circuit_list_widget.html#afd9f69a0d3e99649e4be5d0420c8cee0">00265</a> <a class="code" href="class_circuit_list_widget.html#a52eb949b9bd3fa14e03afff0084676fb">CircuitListWidget::removeStream</a>(<a class="code" href="class_stream_item.html">StreamItem</a> *stream)
<a name="l00266"></a>00266 {
<a name="l00267"></a>00267   <span class="keywordflow">if</span> (stream) {
<a name="l00268"></a>00268     <span class="comment">/* Try to get the stream&#39;s parent (a circuit item) */</span> 
<a name="l00269"></a>00269     <a class="code" href="class_circuit_item.html">CircuitItem</a> *circuit = (<a class="code" href="class_circuit_item.html">CircuitItem</a> *)stream-&gt;parent();
<a name="l00270"></a>00270     <span class="keywordflow">if</span> (circuit) {
<a name="l00271"></a>00271       <span class="comment">/* Remove the stream from the circuit and delete the item */</span>
<a name="l00272"></a>00272       circuit-&gt;<a class="code" href="class_circuit_item.html#a64fe0d46e4d29d6fe762ef8c82e43fb1">removeStream</a>(stream);
<a name="l00273"></a>00273     } <span class="keywordflow">else</span> {
<a name="l00274"></a>00274       <span class="comment">/* It isn&#39;t on a circuit, so just delete the stream */</span>
<a name="l00275"></a>00275       <span class="keyword">delete</span> stream;
<a name="l00276"></a>00276     }
<a name="l00277"></a>00277   }
<a name="l00278"></a>00278 }
<a name="l00279"></a>00279 <span class="comment"></span>
<a name="l00280"></a>00280 <span class="comment">/** Clears all circuits and streams from the list. */</span>
<a name="l00281"></a>00281 <span class="keywordtype">void</span>
<a name="l00282"></a><a class="code" href="class_circuit_list_widget.html#a0ec8b1e956cccae41f807491b9ed0a79">00282</a> <a class="code" href="class_circuit_list_widget.html#a0ec8b1e956cccae41f807491b9ed0a79">CircuitListWidget::clearCircuits</a>()
<a name="l00283"></a>00283 {
<a name="l00284"></a>00284   QTreeWidget::clear();
<a name="l00285"></a>00285   <a class="code" href="class_circuit_list_widget.html#a03209d5e42f72ac6e1eb18c88bb9135b">_circuitRemovalList</a>.clear();
<a name="l00286"></a>00286   <a class="code" href="class_circuit_list_widget.html#aad5db525f48e0eb84d288b9f27d52a98">_streamRemovalList</a>.clear();
<a name="l00287"></a>00287 }
<a name="l00288"></a>00288 <span class="comment"></span>
<a name="l00289"></a>00289 <span class="comment">/** Finds the circuit with the given ID and returns a pointer to that</span>
<a name="l00290"></a>00290 <span class="comment"> * circuit&#39;s item in the list. */</span>
<a name="l00291"></a>00291 <a class="code" href="class_circuit_item.html">CircuitItem</a>*
<a name="l00292"></a><a class="code" href="class_circuit_list_widget.html#a139c575830e5338dd3096042deef157e">00292</a> <a class="code" href="class_circuit_list_widget.html#a139c575830e5338dd3096042deef157e">CircuitListWidget::findCircuitItem</a>(<span class="keyword">const</span> <a class="code" href="_circuit_8h.html#a8b7b0182a6d1ff0aab7ab31df9c3f83d">CircuitId</a> &amp;circid)
<a name="l00293"></a>00293 {
<a name="l00294"></a>00294   <span class="keywordtype">int</span> numCircs = topLevelItemCount();
<a name="l00295"></a>00295   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> <a class="code" href="html_8cpp.html#a4a5dba6492ea149585950c59c210ff47">i</a> = 0; <a class="code" href="html_8cpp.html#a4a5dba6492ea149585950c59c210ff47">i</a> &lt; numCircs; <a class="code" href="html_8cpp.html#a4a5dba6492ea149585950c59c210ff47">i</a>++) {
<a name="l00296"></a>00296     <a class="code" href="class_circuit_item.html">CircuitItem</a> *circuit = (<a class="code" href="class_circuit_item.html">CircuitItem</a> *)topLevelItem(<a class="code" href="html_8cpp.html#a4a5dba6492ea149585950c59c210ff47">i</a>);
<a name="l00297"></a>00297     <span class="keywordflow">if</span> (circid == circuit-&gt;<a class="code" href="class_circuit_item.html#a00ab1f5cc2836fae97f6d8299306c069">id</a>()) {
<a name="l00298"></a>00298       <span class="keywordflow">return</span> circuit;
<a name="l00299"></a>00299     }
<a name="l00300"></a>00300   }
<a name="l00301"></a>00301   <span class="keywordflow">return</span> 0;
<a name="l00302"></a>00302 }
<a name="l00303"></a>00303 <span class="comment"></span>
<a name="l00304"></a>00304 <span class="comment">/** Finds the stream with the given ID and returns a pointer to that stream&#39;s</span>
<a name="l00305"></a>00305 <span class="comment"> * item in the list. */</span>
<a name="l00306"></a>00306 <a class="code" href="class_stream_item.html">StreamItem</a>*
<a name="l00307"></a><a class="code" href="class_circuit_list_widget.html#a3c67287d994a254de8467a06e88884fa">00307</a> <a class="code" href="class_circuit_list_widget.html#a3c67287d994a254de8467a06e88884fa">CircuitListWidget::findStreamItem</a>(<span class="keyword">const</span> <a class="code" href="_stream_8h.html#a90d94d8a7b979b4c7e07f5869a431064">StreamId</a> &amp;streamid)
<a name="l00308"></a>00308 {
<a name="l00309"></a>00309   <span class="keywordtype">int</span> numCircs = topLevelItemCount();
<a name="l00310"></a>00310   <span class="keywordtype">int</span> numStreams;
<a name="l00311"></a>00311   
<a name="l00312"></a>00312   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> <a class="code" href="html_8cpp.html#a4a5dba6492ea149585950c59c210ff47">i</a> = 0; <a class="code" href="html_8cpp.html#a4a5dba6492ea149585950c59c210ff47">i</a> &lt; numCircs; <a class="code" href="html_8cpp.html#a4a5dba6492ea149585950c59c210ff47">i</a>++) {
<a name="l00313"></a>00313     <a class="code" href="class_circuit_item.html">CircuitItem</a> *circuit = (<a class="code" href="class_circuit_item.html">CircuitItem</a> *)topLevelItem(<a class="code" href="html_8cpp.html#a4a5dba6492ea149585950c59c210ff47">i</a>);
<a name="l00314"></a>00314     numStreams = circuit-&gt;childCount();
<a name="l00315"></a>00315   
<a name="l00316"></a>00316     <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = 0; j &lt; numStreams; j++) {
<a name="l00317"></a>00317       <a class="code" href="class_stream_item.html">StreamItem</a> *stream = (<a class="code" href="class_stream_item.html">StreamItem</a> *)circuit-&gt;child(j);
<a name="l00318"></a>00318       <span class="keywordflow">if</span> (streamid == stream-&gt;<a class="code" href="class_stream_item.html#add2791d9b64f180fccef1733a3643587">id</a>()) {
<a name="l00319"></a>00319         <span class="keywordflow">return</span> stream;
<a name="l00320"></a>00320       }
<a name="l00321"></a>00321     }
<a name="l00322"></a>00322   }
<a name="l00323"></a>00323   <span class="keywordflow">return</span> 0;
<a name="l00324"></a>00324 }
<a name="l00325"></a>00325 <span class="comment"></span>
<a name="l00326"></a>00326 <span class="comment">/** Called when the current item selection has changed. */</span>
<a name="l00327"></a>00327 <span class="keywordtype">void</span>
<a name="l00328"></a><a class="code" href="class_circuit_list_widget.html#accf71aaf7d4723174d9992b7880d1df2">00328</a> <a class="code" href="class_circuit_list_widget.html#accf71aaf7d4723174d9992b7880d1df2">CircuitListWidget::onSelectionChanged</a>(QTreeWidgetItem *cur, 
<a name="l00329"></a>00329                                       QTreeWidgetItem *prev)
<a name="l00330"></a>00330 {
<a name="l00331"></a>00331   Q_UNUSED(prev);
<a name="l00332"></a>00332 
<a name="l00333"></a>00333   <span class="keywordflow">if</span> (cur) {
<a name="l00334"></a>00334     <a class="code" href="class_circuit.html">Circuit</a> circuit;
<a name="l00335"></a>00335     
<a name="l00336"></a>00336     <span class="keywordflow">if</span> (!cur-&gt;parent()) {
<a name="l00337"></a>00337       <span class="comment">/* User selected a CircuitItem, so just grab the Circuit */</span>
<a name="l00338"></a>00338       circuit = ((<a class="code" href="class_circuit_item.html">CircuitItem</a> *)cur)-&gt;circuit();
<a name="l00339"></a>00339     } <span class="keywordflow">else</span> {
<a name="l00340"></a>00340       <span class="comment">/* User selected a StreamItem, so get its parent and then the Circuit */</span>
<a name="l00341"></a>00341       <a class="code" href="class_circuit_item.html">CircuitItem</a> *circItem = (<a class="code" href="class_circuit_item.html">CircuitItem</a> *)cur-&gt;parent();
<a name="l00342"></a>00342       circuit = circItem-&gt;<a class="code" href="class_circuit_item.html#a2967068cdbc30a1f5a3ab57843d48738">circuit</a>();
<a name="l00343"></a>00343     }
<a name="l00344"></a>00344 
<a name="l00345"></a>00345     <span class="comment">/* If this circuit has a path, then emit it so we can highlight it */</span>
<a name="l00346"></a>00346     emit <a class="code" href="class_circuit_list_widget.html#aa79bad8737c1c65582c6fb8bf8e5a94d">circuitSelected</a>(circuit);
<a name="l00347"></a>00347   }
<a name="l00348"></a>00348 }
<a name="l00349"></a>00349 <span class="comment"></span>
<a name="l00350"></a>00350 <span class="comment">/** Returns a list of circuits currently in the widget. */</span>
<a name="l00351"></a>00351 <a class="code" href="_circuit_8h.html#a5c7c01bcee10c15862fdf844c3d1538c">CircuitList</a>
<a name="l00352"></a><a class="code" href="class_circuit_list_widget.html#a14a8bc35a6eb82f2a6117757afe53032">00352</a> <a class="code" href="class_circuit_list_widget.html#a14a8bc35a6eb82f2a6117757afe53032">CircuitListWidget::circuits</a>()
<a name="l00353"></a>00353 {
<a name="l00354"></a>00354   <span class="keywordtype">int</span> numCircs = topLevelItemCount();
<a name="l00355"></a>00355   <a class="code" href="_circuit_8h.html#a5c7c01bcee10c15862fdf844c3d1538c">CircuitList</a> circs;
<a name="l00356"></a>00356   
<a name="l00357"></a>00357   <span class="keywordflow">for</span> (<span class="keywordtype">int</span> <a class="code" href="html_8cpp.html#a4a5dba6492ea149585950c59c210ff47">i</a> = 0; <a class="code" href="html_8cpp.html#a4a5dba6492ea149585950c59c210ff47">i</a> &lt; numCircs; <a class="code" href="html_8cpp.html#a4a5dba6492ea149585950c59c210ff47">i</a>++) {
<a name="l00358"></a>00358     <a class="code" href="class_circuit_item.html">CircuitItem</a> *circ = (<a class="code" href="class_circuit_item.html">CircuitItem</a> *)topLevelItem(<a class="code" href="html_8cpp.html#a4a5dba6492ea149585950c59c210ff47">i</a>);
<a name="l00359"></a>00359     circs &lt;&lt; circ-&gt;<a class="code" href="class_circuit_item.html#a2967068cdbc30a1f5a3ab57843d48738">circuit</a>();
<a name="l00360"></a>00360   }
<a name="l00361"></a>00361   <span class="keywordflow">return</span> circs;
<a name="l00362"></a>00362 }
<a name="l00363"></a>00363 
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Mon Aug 30 22:58:54 2010 for Vidalia by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>