1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | ### File Specific: |
---|
12 | main-programmer: Patrick Boenzli |
---|
13 | */ |
---|
14 | |
---|
15 | #include "glgui.h" |
---|
16 | #include "shell_command.h" |
---|
17 | |
---|
18 | #include "network_stream.h" |
---|
19 | #include "debug.h" |
---|
20 | |
---|
21 | #include "network_monitor.h" |
---|
22 | |
---|
23 | SHELL_COMMAND(showGUI, NetworkMonitor, showGUI); |
---|
24 | SHELL_COMMAND(hideGUI, NetworkMonitor, hideGUI); |
---|
25 | // SHELL_COMMAND(output, MappedWater, saveParams); |
---|
26 | |
---|
27 | |
---|
28 | |
---|
29 | /** |
---|
30 | * starts a network monitor |
---|
31 | */ |
---|
32 | NetworkMonitor::NetworkMonitor(NetworkStream* networkStream) |
---|
33 | { |
---|
34 | |
---|
35 | } |
---|
36 | |
---|
37 | |
---|
38 | /** |
---|
39 | * deconstructor |
---|
40 | */ |
---|
41 | NetworkMonitor::~NetworkMonitor() |
---|
42 | {} |
---|
43 | |
---|
44 | |
---|
45 | /** |
---|
46 | * adds a client |
---|
47 | */ |
---|
48 | void NetworkMonitor::addClient(PeerInfo* node) |
---|
49 | { |
---|
50 | this->clientList.push_back(node); |
---|
51 | } |
---|
52 | |
---|
53 | /** |
---|
54 | * adds a proxy server |
---|
55 | */ |
---|
56 | void NetworkMonitor::addProxyServer(PeerInfo* node) |
---|
57 | { |
---|
58 | this->proxyServerList.push_back(node); |
---|
59 | } |
---|
60 | |
---|
61 | /** |
---|
62 | * adds a master server |
---|
63 | */ |
---|
64 | void NetworkMonitor::addMasterServer(PeerInfo* node) |
---|
65 | { |
---|
66 | this->masterServerList.push_back(node); |
---|
67 | } |
---|
68 | |
---|
69 | /** |
---|
70 | * removes a client |
---|
71 | */ |
---|
72 | void NetworkMonitor::removeClient(PeerInfo* node) |
---|
73 | { |
---|
74 | std::list<PeerInfo*>::iterator it = this->clientList.begin(); |
---|
75 | for(; it != this->clientList.end(); it++) |
---|
76 | { |
---|
77 | if( *it == node) |
---|
78 | { |
---|
79 | this->clientList.erase(it); |
---|
80 | return; |
---|
81 | } |
---|
82 | } |
---|
83 | |
---|
84 | PRINTF(2)("Could not remove client from the list, very strange..."); |
---|
85 | } |
---|
86 | |
---|
87 | /** |
---|
88 | * removes a proxy server |
---|
89 | */ |
---|
90 | void NetworkMonitor::removeProxyServer(PeerInfo* node) |
---|
91 | {} |
---|
92 | |
---|
93 | /** |
---|
94 | * removes a master server |
---|
95 | */ |
---|
96 | void NetworkMonitor::removeMasterServer(PeerInfo* node) |
---|
97 | {} |
---|
98 | |
---|
99 | |
---|
100 | |
---|
101 | /** |
---|
102 | * this displays the network monitor gui |
---|
103 | */ |
---|
104 | void NetworkMonitor::showGUI() |
---|
105 | { |
---|
106 | if (this->box == NULL) |
---|
107 | { |
---|
108 | this->box = new OrxGui::GLGuiBox(OrxGui::Vertical); |
---|
109 | { |
---|
110 | OrxGui::GLGuiBox* waterColorBox = new OrxGui::GLGuiBox(OrxGui::Horizontal); |
---|
111 | { |
---|
112 | OrxGui::GLGuiText* waterColorText = new OrxGui::GLGuiText(); |
---|
113 | waterColorText->setText("NetworkMonitor"); |
---|
114 | waterColorBox->pack(waterColorText); |
---|
115 | } |
---|
116 | this->box->pack(waterColorBox); |
---|
117 | } |
---|
118 | |
---|
119 | this->box->showAll(); |
---|
120 | this->box->setAbsCoor2D(300, 40); |
---|
121 | OrxGui::GLGuiHandler::getInstance()->activate(); |
---|
122 | // OrxGui::GLGuiHandler::getInstance()->activateCursor(); |
---|
123 | } |
---|
124 | } |
---|
125 | |
---|
126 | |
---|
127 | /** |
---|
128 | * hides the network monitor gui again |
---|
129 | */ |
---|
130 | void NetworkMonitor::hideGUI() |
---|
131 | { |
---|
132 | if( this->box == NULL) |
---|
133 | return; |
---|
134 | |
---|
135 | OrxGui::GLGuiHandler::getInstance()->deactivate(); |
---|
136 | // OrxGui::GLGuiHandler::getInstance()->deactivateCursor(); |
---|
137 | |
---|
138 | delete this->box; |
---|
139 | this->box = NULL; |
---|
140 | } |
---|
141 | |
---|
142 | |
---|
143 | /** |
---|
144 | * processes the network monitor data |
---|
145 | */ |
---|
146 | void NetworkMonitor::process() |
---|
147 | { |
---|
148 | |
---|
149 | } |
---|
150 | |
---|