Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/proxy/src/lib/network/monitor/network_stats_widget.h @ 9569

Last change on this file since 9569 was 9569, checked in by bensch, 18 years ago

more gui work

File size: 2.8 KB
RevLine 
[4838]1/*!
[9330]2 * @file network_stats_widget.h
[8972]3 * @brief Definition of an EnergyWidget, that displays a bar and a Text
[9546]4 */
[1853]5
[9330]6#ifndef _NETWORK_STATS_WIDGET_H
7#define _NETWORK_STATS_WIDGET_H
[1853]8
[9547]9#include "glgui_fixedposition_box.h"
[8972]10#include "glgui_bar.h"
11#include "glgui_text.h"
[9567]12#include "glgui_pushbutton.h"
[1853]13
[9330]14#include "network/ip.h"
15
[9439]16class NetworkMonitor;
[9330]17
[9437]18
19class HostWidget : public OrxGui::GLGuiBox
[8972]20{
[9437]21  public:
22    HostWidget(const std::string& name, const IP& ip);
[3543]23
[9437]24    void setName(const std::string& name) { this->_name.setText(name); };
25    void setIP(const IP& ip) { this->_ip.setText(ip.ipString()); this->_storedIP = ip; };
[9383]26
[9437]27    void setNameWidth(float width) { this->_name.setLineWidth(width); };
[9383]28
[9437]29    bool operator==(const IP& ip) const { return (this->_storedIP == ip); };
30    bool operator==(const std::string& name) const { return (this->_name == name); };
[9383]31
[9437]32  protected:
33    virtual void showing();
34    virtual void hiding();
[9383]35
[9437]36  private:
37    OrxGui::GLGuiText _name;           //!< The Name of the Proxy server to be displayed.
38    OrxGui::GLGuiText _ip;             //!< The IP of the proxy server.
39    IP                _storedIP;       //!< The ip to compare.
40};
[9383]41
42
[9437]43class ProxyWidget : public OrxGui::GLGuiBox
44{
45  public:
46    ProxyWidget(const std::string& proxyName, const IP& ip);
[9383]47
[9437]48    void addClient(const std::string& name, const IP& ip);
[9383]49
[9437]50    bool removeClient(const IP& ip);
51    bool removeClient(const std::string& name);
52    bool removeClient(const std::string& name, const IP& ip);
[9383]53
[9437]54    void setClientNameWidths(float width);
[9383]55
56
[9437]57  protected:
58    virtual void hiding();
59    virtual void showing();
[9385]60
[9383]61
[9437]62  private:
63    HostWidget                _proxyWidget;
[9383]64
[9437]65    std::vector<HostWidget*>  _clients;
66    float                     _clientNameWidth;
67};
[9383]68
69
70
71
[9437]72//! A class to display network Statistics.
[9552]73class NetworkStatsWidget : public OrxGui::GLGuiFixedpositionBox
[9437]74{
75  public:
[9439]76    NetworkStatsWidget(const NetworkMonitor* monitor);
[9437]77    virtual ~NetworkStatsWidget();
[9435]78
[9437]79    void setUpstream(unsigned int upstream);
80    void setDownstream(unsigned int upstream);
81    void setIP(const IP& ip);
[3543]82
[2036]83
[9330]84
[9437]85    void addProxy(const std::string& name, const IP& proxy);
[9569]86    void clearProxies();
[8974]87
[9567]88    void rebuild();
[9386]89
[9437]90    //void rebuildConnectedHosts(std::vector<hosts> hosts);
[9386]91
[9437]92    void setMaximum(float max);
93    void setValue(float value);
[9330]94
[9439]95    virtual void tick(float dt);
96
[9437]97  protected:
98    virtual void resize();
99    virtual void showing();
100    virtual void hiding();
[9330]101
[9437]102  private:
[9439]103    const NetworkMonitor*  _monitor;
104
[9546]105    OrxGui::GLGuiText      _thisHostIs;
[9437]106    HostWidget             _thisHost;
[9331]107
[9437]108    OrxGui::GLGuiText      _upstreamText;
109    OrxGui::GLGuiText      _downstreamText;
[1853]110
[9569]111    OrxGui::GLGuiWidget    _serverBox;
[9567]112
[9569]113    std::vector<HostWidget*> _proxies;
[1853]114
[9330]115
[9567]116    OrxGui::GLGuiPushButton _refreshButton;
[9330]117
[9438]118    //OrxGui::GLGuiText       _valueText;
119    //OrxGui::GLGuiBar        _bar;
[9437]120};
[9330]121
122#endif /* _NETWORK_STATS_WIDGET_H */
Note: See TracBrowser for help on using the repository browser.