show player name while typing
[multypo.git] / qt / multypo.h
1 #ifndef MULTIKBD_H
2 #define MULTIKBD_H
3
4 #include <QWidget>
5 #include <QMap>
6 #include <QFile>
7
8 #include "player.h"
9
10 class MultypoWindow : public QWidget
11 {
12         Q_OBJECT
13         
14 public:
15     enum State {
16         Naming,
17         Playing,
18         Scoring
19     };
20     
21         explicit MultypoWindow(QWidget *parent = 0);
22         ~MultypoWindow();
23
24         bool handleX11Event(XEvent *event);
25
26 private:
27         void handleKeyPress(int device, QString string);
28         void nextWord();
29     bool allPlayersWaiting();
30     int typingPlayers();
31     void setLabel(QString text, QString color);
32
33     State state; // naming iff (no players or any player is naming)
34     QString currentWord; // defined iff state == Playing
35     QMap<int, Player*> players;
36     
37         bool xiInited;
38         int xiOpcode;
39         QLabel *mainLabel;
40         QFile words;
41 };
42
43 #endif // MULTIKBD_H