Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

more gui

File size: 2.7 KB
Line 
1/*!
2 * @file network_stats_widget.h
3 * @brief Definition of an EnergyWidget, that displays a bar and a Text
4*/
5
6#ifndef _NETWORK_STATS_WIDGET_H
7#define _NETWORK_STATS_WIDGET_H
8
9#include "glgui_box.h"
10#include "glgui_bar.h"
11#include "glgui_text.h"
12
13#include "network/ip.h"
14
15class NetworkMonitor;
16
17
18class HostWidget : public OrxGui::GLGuiBox
19{
20  public:
21    HostWidget(const std::string& name, const IP& ip);
22    ~HostWidget() {};
23
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; };
26
27    void setNameWidth(float width) { this->_name.setLineWidth(width); };
28
29    bool operator==(const IP& ip) const { return (this->_storedIP == ip); };
30    bool operator==(const std::string& name) const { return (this->_name == name); };
31
32  protected:
33    virtual void showing();
34    virtual void hiding();
35
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};
41
42
43class ProxyWidget : public OrxGui::GLGuiBox
44{
45  public:
46    ProxyWidget(const std::string& proxyName, const IP& ip);
47
48    void addClient(const std::string& name, const IP& ip);
49
50    bool removeClient(const IP& ip);
51    bool removeClient(const std::string& name);
52    bool removeClient(const std::string& name, const IP& ip);
53
54    void setClientNameWidths(float width);
55
56
57  protected:
58    virtual void hiding();
59    virtual void showing();
60
61
62  private:
63    HostWidget                _proxyWidget;
64
65    std::vector<HostWidget*>  _clients;
66    float                     _clientNameWidth;
67};
68
69
70
71
72//! A class to display network Statistics.
73class NetworkStatsWidget : public OrxGui::GLGuiBox
74{
75  public:
76    NetworkStatsWidget(const NetworkMonitor* monitor);
77    virtual ~NetworkStatsWidget();
78
79    void setUpstream(unsigned int upstream);
80    void setDownstream(unsigned int upstream);
81    void setIP(const IP& ip);
82
83
84
85    void addProxy(const std::string& name, const IP& proxy);
86
87
88    //void rebuildConnectedHosts(std::vector<hosts> hosts);
89
90    void setMaximum(float max);
91    void setValue(float value);
92
93    virtual void tick(float dt);
94
95  protected:
96    virtual void resize();
97    virtual void showing();
98    virtual void hiding();
99
100  private:
101    const NetworkMonitor*  _monitor;
102
103    HostWidget             _thisHost;
104
105    OrxGui::GLGuiText      _upstreamText;
106    OrxGui::GLGuiText      _downstreamText;
107
108    std::vector<HostWidget*>_connectedProxies;
109
110    OrxGui::GLGuiText       _serverIP;
111
112
113    //OrxGui::GLGuiText       _valueText;
114    //OrxGui::GLGuiBar        _bar;
115};
116
117#endif /* _NETWORK_STATS_WIDGET_H */
Note: See TracBrowser for help on using the repository browser.