Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 21, 2006, 12:51:19 PM (19 years ago)
Author:
bensch
Message:

much more elaborate host and proxy widgets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/util/network_stats_widget.cc

    r9369 r9383  
    2222namespace OrxGui
    2323{
     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
    24133  /**
    25134   * @brief standard constructor
    26135   */
    27136  NetworkStatsWidget::NetworkStatsWidget ()
     137      : GLGuiBox(Vertical)
    28138  {
    29139    //   this->setClassID(CL_PROTO_ID, "NetworkStatsWidget");
     
    52162   */
    53163  NetworkStatsWidget::~NetworkStatsWidget ()
    54   {
    55   }
     164  {}
    56165
    57166
Note: See TracChangeset for help on using the changeset viewer.