add proper states and a sane API for players
[multypo.git] / qt / multypo.h
index 1a088bd30692295858291e2e3d748c8e134f4fb5..3117c9f1b0fa5b08de4e42e6e8988322a91ba6a3 100644 (file)
@@ -12,6 +12,12 @@ class MultypoWindow : public QWidget
        Q_OBJECT
        
 public:
+    enum State {
+        Naming,
+        Playing,
+        Scoring
+    };
+    
        explicit MultypoWindow(QWidget *parent = 0);
        ~MultypoWindow();
 
@@ -20,16 +26,17 @@ public:
 private:
        void handleKeyPress(int device, QString string);
        void nextWord();
-       void resetPlayerText();
+    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;
-       bool gameStarted;
        QLabel *mainLabel;
        QFile words;
-       QMap<int, Player*> players;
-       int typingPlayers; // how many are not ready yet
 };
 
 #endif // MULTIKBD_H