add proper states and a sane API for players
[multypo.git] / qt / multypo.h
index 400d4c995eb848d19bbfeebf13d75d4bbbad6481..3117c9f1b0fa5b08de4e42e6e8988322a91ba6a3 100644 (file)
@@ -2,26 +2,41 @@
 #define MULTIKBD_H
 
 #include <QWidget>
+#include <QMap>
+#include <QFile>
+
+#include "player.h"
 
 class MultypoWindow : public QWidget
 {
        Q_OBJECT
        
 public:
+    enum State {
+        Naming,
+        Playing,
+        Scoring
+    };
+    
        explicit MultypoWindow(QWidget *parent = 0);
        ~MultypoWindow();
 
        bool handleX11Event(XEvent *event);
 
-protected:
-       virtual void showEvent (QShowEvent *);
-
 private:
        void handleKeyPress(int device, QString string);
+       void nextWord();
+    bool allPlayersWaiting();
+    int typingPlayers();
 
-private:
+    State state; // naming iff (no players or any player is naming)
+    QString currentWord; // defined iff state == Playing
+    QMap<int, Player*> players;
+    
        bool xiInited;
        int xiOpcode;
+       QLabel *mainLabel;
+       QFile words;
 };
 
 #endif // MULTIKBD_H