Changeset 9383 in orxonox.OLD for branches/proxy/src/util/network_stats_widget.cc
- Timestamp:
- Jul 21, 2006, 12:51:19 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/util/network_stats_widget.cc
r9369 r9383 22 22 namespace OrxGui 23 23 { 24 HostWidget::HostWidget(const std::string& name, const IP& ip) 25 : GLGuiBox(Horizontal) 26 { 27 this->setName(name); 28 this->setIP(ip); 29 30 this->pack(&this->_name); 31 this->pack(&this->_ip); 32 } 33 34 void HostWidget::showing() 35 { 36 this->_name.show(); 37 this->_ip.show(); 38 } 39 40 void HostWidget::hiding() 41 { 42 this->_name.hide(); 43 this->_ip.hide(); 44 } 45 46 47 48 //======================================================// 49 50 51 ProxyWidget::ProxyWidget(const std::string& proxyName, const IP& ip) 52 : _proxyWidget(proxyName, ip) 53 { 54 this->pack(&_proxyWidget); 55 } 56 57 void ProxyWidget::addClient(const std::string& name, const IP& ip) 58 { 59 HostWidget* newClient = new HostWidget(name, ip); 60 61 this->pack(newClient); 62 63 if (this->isVisible()) 64 newClient->show(); 65 } 66 67 bool ProxyWidget::removeClient(const IP& ip) 68 { 69 std::vector<HostWidget*>::iterator rmIt; 70 for(rmIt = this->_clients.begin(); rmIt != this->_clients.end(); ++rmIt) 71 { 72 if (*(*rmIt) == ip) 73 { 74 delete (*rmIt); 75 this->_clients.erase(rmIt); 76 return true; 77 } 78 } 79 return false; 80 } 81 82 bool ProxyWidget::removeClient(const std::string& name) 83 { 84 std::vector<HostWidget*>::iterator rmIt; 85 for(rmIt = this->_clients.begin(); rmIt != this->_clients.end(); ++rmIt) 86 { 87 if (*(*rmIt) == name) 88 { 89 delete (*rmIt); 90 this->_clients.erase(rmIt); 91 return true; 92 } 93 } 94 return false; 95 96 } 97 98 bool ProxyWidget::removeClient(const std::string& name, const IP& ip) 99 { 100 std::vector<HostWidget*>::iterator rmIt; 101 for(rmIt = this->_clients.begin(); rmIt != this->_clients.end(); ++rmIt) 102 { 103 if (*(*rmIt) == ip && *(*rmIt) == name) 104 { 105 delete (*rmIt); 106 this->_clients.erase(rmIt); 107 return true; 108 } 109 } 110 return false; 111 } 112 113 114 void ProxyWidget::hiding() 115 { 116 this->_proxyWidget.hide(); 117 for (unsigned int i = 0; i < this->_clients.size(); ++i) 118 this->_clients[i]->hide(); 119 } 120 121 void ProxyWidget::showing() 122 { 123 this->_proxyWidget.show(); 124 for (unsigned int i = 0; i < this->_clients.size(); ++i) 125 this->_clients[i]->show(); 126 } 127 128 129 //======================================================// 130 131 132 24 133 /** 25 134 * @brief standard constructor 26 135 */ 27 136 NetworkStatsWidget::NetworkStatsWidget () 137 : GLGuiBox(Vertical) 28 138 { 29 139 // this->setClassID(CL_PROTO_ID, "NetworkStatsWidget"); … … 52 162 */ 53 163 NetworkStatsWidget::~NetworkStatsWidget () 54 { 55 } 164 {} 56 165 57 166
Note: See TracChangeset
for help on using the changeset viewer.