Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

more gui functionality… but there will be more

File size: 3.1 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;
[9607]17class NetworkNode;
[9330]18
[9437]19
20class HostWidget : public OrxGui::GLGuiBox
[8972]21{
[9437]22  public:
23    HostWidget(const std::string& name, const IP& ip);
[3543]24
[9437]25    void setName(const std::string& name) { this->_name.setText(name); };
26    void setIP(const IP& ip) { this->_ip.setText(ip.ipString()); this->_storedIP = ip; };
[9383]27
[9437]28    void setNameWidth(float width) { this->_name.setLineWidth(width); };
[9383]29
[9437]30    bool operator==(const IP& ip) const { return (this->_storedIP == ip); };
31    bool operator==(const std::string& name) const { return (this->_name == name); };
[9383]32
[9437]33  protected:
34    virtual void showing();
35    virtual void hiding();
[9383]36
[9437]37  private:
38    OrxGui::GLGuiText _name;           //!< The Name of the Proxy server to be displayed.
39    OrxGui::GLGuiText _ip;             //!< The IP of the proxy server.
40    IP                _storedIP;       //!< The ip to compare.
41};
[9383]42
43
[9618]44class NodeWidget : public OrxGui::GLGuiBox
[9437]45{
46  public:
[9618]47    NodeWidget(const std::string& proxyName, const IP& ip);
48    NodeWidget(const NetworkNode* node);
[9383]49
[9607]50    void addClient(const NetworkNode* node);
[9437]51    void addClient(const std::string& name, const IP& ip);
[9383]52
[9437]53    bool removeClient(const IP& ip);
54    bool removeClient(const std::string& name);
55    bool removeClient(const std::string& name, const IP& ip);
[9383]56
[9437]57    void setClientNameWidths(float width);
[9383]58
59
[9437]60  protected:
61    virtual void hiding();
62    virtual void showing();
[9385]63
[9383]64
[9437]65  private:
66    HostWidget                _proxyWidget;
[9383]67
[9437]68    std::vector<HostWidget*>  _clients;
69    float                     _clientNameWidth;
70};
[9383]71
72
73
74
[9437]75//! A class to display network Statistics.
[9552]76class NetworkStatsWidget : public OrxGui::GLGuiFixedpositionBox
[9437]77{
78  public:
[9577]79    static void toggleGUI();
80
[9439]81    NetworkStatsWidget(const NetworkMonitor* monitor);
[9437]82    virtual ~NetworkStatsWidget();
[9435]83
[9437]84    void setUpstream(unsigned int upstream);
85    void setDownstream(unsigned int upstream);
86    void setIP(const IP& ip);
[3543]87
[2036]88
[9330]89
[9437]90    void addProxy(const std::string& name, const IP& proxy);
[9618]91    void addNode(const NetworkNode* node);
92
[9569]93    void clearProxies();
[8974]94
[9567]95    void rebuild();
[9386]96
[9437]97    //void rebuildConnectedHosts(std::vector<hosts> hosts);
[9386]98
[9437]99    void setMaximum(float max);
100    void setValue(float value);
[9330]101
[9439]102    virtual void tick(float dt);
103
[9437]104  protected:
105    virtual void resize();
106    virtual void showing();
107    virtual void hiding();
[9330]108
[9437]109  private:
[9439]110    const NetworkMonitor*  _monitor;
111
[9546]112    OrxGui::GLGuiText      _thisHostIs;
[9437]113    HostWidget             _thisHost;
[9331]114
[9437]115    OrxGui::GLGuiText      _upstreamText;
116    OrxGui::GLGuiText      _downstreamText;
[1853]117
[9569]118    OrxGui::GLGuiWidget    _serverBox;
[9567]119
[9618]120    std::vector<NodeWidget*> _proxies;
[1853]121
[9330]122
[9567]123    OrxGui::GLGuiPushButton _refreshButton;
[9330]124
[9577]125    static NetworkStatsWidget*    _statsWidget;
126
[9438]127    //OrxGui::GLGuiText       _valueText;
128    //OrxGui::GLGuiBar        _bar;
[9437]129};
[9330]130
131#endif /* _NETWORK_STATS_WIDGET_H */
Note: See TracBrowser for help on using the repository browser.