- Timestamp:
- Jul 31, 2006, 12:53:01 PM (18 years ago)
- Location:
- branches/proxy/src/lib/network/monitor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/network/monitor/network_stats_widget.cc
r9646 r9649 91 91 : _proxyWidget(proxyName, ip) 92 92 { 93 this->_ clientNameWidth = 100.0f;93 this->_nodeNameWidth = 100.0f; 94 94 this->pack(&_proxyWidget); 95 95 } … … 98 98 : _proxyWidget(node->getPeerInfo())// "node", node->getPeerInfo()->ip) 99 99 { 100 this->_ clientNameWidth = 100.0f;100 this->_nodeNameWidth = 100.0f; 101 101 this->pack(&_proxyWidget); 102 } 103 104 105 void NodeWidget::addClient(const std::string& name, const IP& ip) 102 103 std::list<NetworkNode*> list = node->getMasterServers(); 104 std::list<NetworkNode*>::const_iterator it; 105 106 for(it = list.begin(); it != list.end(); it++) 107 this->addNode(*it); 108 109 list = node->getActiveProxyServers(); 110 for(it = list.begin(); it != list.end(); it++) 111 this->addNode(*it); 112 113 list = node->getPassiveProxyServers(); 114 for(it = list.begin(); it != list.end(); it++) 115 this->addNode(*it); 116 117 list = node->getClients(); 118 for(it = list.begin(); it != list.end(); it++) 119 this->addNode(*it); 120 } 121 122 123 void NodeWidget::addNode(const NetworkNode* node) 124 { 125 this->_nodes.push_back(new NodeWidget(node)); 126 this->pack(this->_nodes.back()); 127 this->_nodes.back()->show(); 128 } 129 130 131 void NodeWidget::addNode(const std::string& name, const IP& ip) 106 132 { 107 133 HostWidget* newClient = new HostWidget(name, ip); 108 newClient->setNameWidth(this->_ clientNameWidth);134 newClient->setNameWidth(this->_nodeNameWidth); 109 135 110 136 this->pack(newClient); … … 114 140 } 115 141 116 bool NodeWidget::remove Client(const IP& ip)117 { 118 std::vector<HostWidget*>::iterator rmIt;119 for(rmIt = this->_clients.begin(); rmIt != this->_clients.end(); ++rmIt)120 {121 if (*(*rmIt) == ip)122 {123 delete (*rmIt);124 this->_clients.erase(rmIt);125 return true;126 }127 }128 return false;129 } 130 131 bool NodeWidget::remove Client(const std::string& name)132 { 133 std::vector<HostWidget*>::iterator rmIt;134 for(rmIt = this->_clients.begin(); rmIt != this->_clients.end(); ++rmIt)135 {136 if (*(*rmIt) == name)137 {138 delete (*rmIt);139 this->_clients.erase(rmIt);140 return true;141 }142 }143 return false;144 145 } 146 147 bool NodeWidget::remove Client(const std::string& name, const IP& ip)148 { 149 std::vector<HostWidget*>::iterator rmIt;150 for(rmIt = this->_clients.begin(); rmIt != this->_clients.end(); ++rmIt)151 {152 if (*(*rmIt) == ip && *(*rmIt) == name)153 {154 delete (*rmIt);155 this->_clients.erase(rmIt);156 return true;157 }158 }159 return false;160 } 161 162 163 void NodeWidget::set ClientNameWidths(float width)164 { 165 this->_clientNameWidth = width;166 for (unsigned int i = 0; i < this->_ clients.size(); ++i)167 this->_ clients[i]->setNameWidth(width);142 bool NodeWidget::removeNode(const IP& ip) 143 { 144 // std::vector<HostWidget*>::iterator rmIt; 145 // for(rmIt = this->_nodes.begin(); rmIt != this->_nodes.end(); ++rmIt) 146 // { 147 // if (*(*rmIt) == ip) 148 // { 149 // delete (*rmIt); 150 // this->_nodes.erase(rmIt); 151 // return true; 152 // } 153 // } 154 // return false; 155 } 156 157 bool NodeWidget::removeNode(const std::string& name) 158 { 159 // std::vector<HostWidget*>::iterator rmIt; 160 // for(rmIt = this->_nodes.begin(); rmIt != this->_nodes.end(); ++rmIt) 161 // { 162 // if (*(*rmIt) == name) 163 // { 164 // delete (*rmIt); 165 // this->_nodes.erase(rmIt); 166 // return true; 167 // } 168 // } 169 // return false; 170 171 } 172 173 bool NodeWidget::removeNode(const std::string& name, const IP& ip) 174 { 175 // std::vector<HostWidget*>::iterator rmIt; 176 // for(rmIt = this->_nodes.begin(); rmIt != this->_nodes.end(); ++rmIt) 177 // { 178 // if (*(*rmIt) == ip && *(*rmIt) == name) 179 // { 180 // delete (*rmIt); 181 // this->_nodes.erase(rmIt); 182 // return true; 183 // } 184 // } 185 // return false; 186 } 187 188 189 void NodeWidget::setNodeNameWidths(float width) 190 { 191 /* this->_nodeNameWidth = width; 192 for (unsigned int i = 0; i < this->_nodes.size(); ++i) 193 this->_nodes[i]->setNameWidth(width);*/ 168 194 } 169 195 … … 171 197 { 172 198 this->_proxyWidget.hide(); 173 for (unsigned int i = 0; i < this->_ clients.size(); ++i)174 this->_ clients[i]->hide();199 for (unsigned int i = 0; i < this->_nodes.size(); ++i) 200 this->_nodes[i]->hide(); 175 201 } 176 202 … … 178 204 { 179 205 this->_proxyWidget.show(); 180 for (unsigned int i = 0; i < this->_ clients.size(); ++i)181 this->_ clients[i]->show();206 for (unsigned int i = 0; i < this->_nodes.size(); ++i) 207 this->_nodes[i]->show(); 182 208 } 183 209 … … 311 337 312 338 this->addNode(node); 313 314 std::list<NetworkNode*> list = node->getMasterServers();315 std::list<NetworkNode*>::const_iterator it;316 317 for(it = list.begin(); it != list.end(); it++)318 this->addNode(*it);319 320 list = node->getActiveProxyServers();321 for(it = list.begin(); it != list.end(); it++)322 this->addNode(*it);323 324 list = node->getPassiveProxyServers();325 for(it = list.begin(); it != list.end(); it++)326 this->addNode(*it);327 328 list = node->getClients();329 for(it = list.begin(); it != list.end(); it++)330 this->addNode(*it);331 332 339 } 333 340 -
branches/proxy/src/lib/network/monitor/network_stats_widget.h
r9645 r9649 53 53 NodeWidget(const NetworkNode* node); 54 54 55 void add Client(const NetworkNode* node);56 void add Client(const std::string& name, const IP& ip);55 void addNode(const NetworkNode* node); 56 void addNode(const std::string& name, const IP& ip); 57 57 58 bool remove Client(const IP& ip);59 bool remove Client(const std::string& name);60 bool remove Client(const std::string& name, const IP& ip);58 bool removeNode(const IP& ip); 59 bool removeNode(const std::string& name); 60 bool removeNode(const std::string& name, const IP& ip); 61 61 62 void set ClientNameWidths(float width);62 void setNodeNameWidths(float width); 63 63 64 64 … … 71 71 HostWidget _proxyWidget; 72 72 73 std::vector< HostWidget*> _clients;74 float _ clientNameWidth;73 std::vector<NodeWidget*> _nodes; 74 float _nodeNameWidth; 75 75 }; 76 76
Note: See TracChangeset
for help on using the changeset viewer.