add proper states and a sane API for players
[multypo.git] / qt / multypo.h
index de0898fd530fa335bbe2804359671cc247d21535..3117c9f1b0fa5b08de4e42e6e8988322a91ba6a3 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <QWidget>
 #include <QMap>
+#include <QFile>
 
 #include "player.h"
 
@@ -11,6 +12,12 @@ class MultypoWindow : public QWidget
        Q_OBJECT
        
 public:
+    enum State {
+        Naming,
+        Playing,
+        Scoring
+    };
+    
        explicit MultypoWindow(QWidget *parent = 0);
        ~MultypoWindow();
 
@@ -18,13 +25,18 @@ public:
 
 private:
        void handleKeyPress(int device, QString string);
-
-private:
+       void nextWord();
+    bool allPlayersWaiting();
+    int typingPlayers();
+
+    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;
-
-       QMap<int, Player*> players;
+       QFile words;
 };
 
 #endif // MULTIKBD_H