Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 31, 2006, 12:53:01 PM (18 years ago)
Author:
bensch
Message:

gui should be hirachical now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/monitor/network_stats_widget.cc

    r9646 r9649  
    9191    : _proxyWidget(proxyName, ip)
    9292{
    93   this->_clientNameWidth = 100.0f;
     93  this->_nodeNameWidth = 100.0f;
    9494  this->pack(&_proxyWidget);
    9595}
     
    9898    : _proxyWidget(node->getPeerInfo())// "node", node->getPeerInfo()->ip)
    9999{
    100   this->_clientNameWidth = 100.0f;
     100  this->_nodeNameWidth = 100.0f;
    101101  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
     123void 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
     131void NodeWidget::addNode(const std::string& name, const IP& ip)
    106132{
    107133  HostWidget* newClient = new HostWidget(name, ip);
    108   newClient->setNameWidth(this->_clientNameWidth);
     134  newClient->setNameWidth(this->_nodeNameWidth);
    109135
    110136  this->pack(newClient);
     
    114140}
    115141
    116 bool NodeWidget::removeClient(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::removeClient(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::removeClient(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::setClientNameWidths(float width)
    164 {
    165   this->_clientNameWidth = width;
    166   for (unsigned int i = 0; i < this->_clients.size(); ++i)
    167     this->_clients[i]->setNameWidth(width);
     142bool 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
     157bool 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
     173bool 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
     189void 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);*/
    168194}
    169195
     
    171197{
    172198  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();
    175201}
    176202
     
    178204{
    179205  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();
    182208}
    183209
     
    311337
    312338  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 
    332339}
    333340
Note: See TracChangeset for help on using the changeset viewer.