Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

more gui

File size: 2.6 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
15
16
17class HostWidget : public OrxGui::GLGuiBox
18{
19  public:
20    HostWidget(const std::string& name, const IP& ip);
21    ~HostWidget() {};
22
23    void setName(const std::string& name) { this->_name.setText(name); };
24    void setIP(const IP& ip) { this->_ip.setText(ip.ipString()); this->_storedIP = ip; };
25
26    void setNameWidth(float width) { this->_name.setLineWidth(width); };
27
28    bool operator==(const IP& ip) const { return (this->_storedIP == ip); };
29    bool operator==(const std::string& name) const { return (this->_name == name); };
30
31  protected:
32    virtual void showing();
33    virtual void hiding();
34
35  private:
36    OrxGui::GLGuiText _name;           //!< The Name of the Proxy server to be displayed.
37    OrxGui::GLGuiText _ip;             //!< The IP of the proxy server.
38    IP                _storedIP;       //!< The ip to compare.
39};
40
41
42class ProxyWidget : public OrxGui::GLGuiBox
43{
44  public:
45    ProxyWidget(const std::string& proxyName, const IP& ip);
46
47    void addClient(const std::string& name, const IP& ip);
48
49    bool removeClient(const IP& ip);
50    bool removeClient(const std::string& name);
51    bool removeClient(const std::string& name, const IP& ip);
52
53    void setClientNameWidths(float width);
54
55
56  protected:
57    virtual void hiding();
58    virtual void showing();
59
60
61  private:
62    HostWidget                _proxyWidget;
63
64    std::vector<HostWidget*>  _clients;
65    float                     _clientNameWidth;
66};
67
68
69
70
71//! A class to display network Statistics.
72class NetworkStatsWidget : public OrxGui::GLGuiBox
73{
74  public:
75    NetworkStatsWidget();
76    virtual ~NetworkStatsWidget();
77
78    void setUpstream(unsigned int upstream);
79    void setDownstream(unsigned int upstream);
80    void setIP(const IP& ip);
81
82
83
84    void addProxy(const std::string& name, const IP& proxy);
85
86
87    //void rebuildConnectedHosts(std::vector<hosts> hosts);
88
89    void setMaximum(float max);
90    void setValue(float value);
91
92  protected:
93    virtual void resize();
94    virtual void showing();
95    virtual void hiding();
96
97  private:
98    HostWidget             _thisHost;
99
100    OrxGui::GLGuiText      _upstreamText;
101    OrxGui::GLGuiText      _downstreamText;
102
103    std::vector<HostWidget*>_connectedProxies;
104
105    OrxGui::GLGuiText       _serverIP;
106
107
108    //OrxGui::GLGuiText       _valueText;
109    //OrxGui::GLGuiBar        _bar;
110};
111
112#endif /* _NETWORK_STATS_WIDGET_H */
Note: See TracBrowser for help on using the repository browser.