serversstatuswidget.h
1 //------------------------------------------------------------------------------
2 // serversstatuswidget.h
3 //------------------------------------------------------------------------------
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301, USA.
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2009 "Blzut3" <admin@maniacsvault.net>
22 //------------------------------------------------------------------------------
23 
24 #ifndef __SERVERSSTATUSWIDGET_H__
25 #define __SERVERSSTATUSWIDGET_H__
26 
27 #include "serverapi/serverptr.h"
28 #include <QLabel>
29 
30 class MasterClient;
31 class Server;
32 
33 class ServersStatusWidget : public QLabel
34 {
35  Q_OBJECT
36 
37  public:
38  ServersStatusWidget(const QPixmap &icon, MasterClient *serverList);
39 
40  public slots:
48  void setMasterEnabledStatus(bool bEnabled);
49  void updateDisplay();
50 
51  signals:
52  void clicked(MasterClient* pClient);
53 
54  protected:
55  void mousePressEvent(QMouseEvent* event);
56  void paintEvent(QPaintEvent *event);
57 
58  bool bMasterIsEnabled;
59  QPixmap icon;
60  QPixmap iconDisabled;
61  unsigned int numBots;
62  unsigned int numPlayers;
63  MasterClient *serverList;
64 
65  protected slots:
66  void addServer(const ServerPtr &server);
67  void registerServers();
68  void removeServer(const ServerPtr &server);
69 };
70 
71 #endif /* __SERVERSSTATUSWIDGET_H__ */
A representation of a server for a given game.
Definition: server.h:93
void setMasterEnabledStatus(bool bEnabled)
Changes the appearance of the widget basing on the boolean value.
Abstract base for all MasterClients.
Definition: masterclient.h:49