Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

linking stuff

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_fixedposition_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
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::GLGuiFixedpositionBox
73{
74  public:
75    NetworkStatsWidget(const NetworkMonitor* monitor);
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    virtual void tick(float dt);
93
94  protected:
95    virtual void resize();
96    virtual void showing();
97    virtual void hiding();
98
99  private:
100    const NetworkMonitor*  _monitor;
101
102    OrxGui::GLGuiText      _thisHostIs;
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.