Switched to using QStateMachine.
[simple-xmbc-rem] / src / mainwindow.h
index 001368a..4db21b3 100644 (file)
@@ -12,6 +12,8 @@
 
 #include <QtGui/QMainWindow>
 #include <QtNetwork/QTcpSocket>
+#include <QStateMachine>
+#include <QState>
 
 namespace Ui {
     class MainWindow;
@@ -35,25 +37,28 @@ public:
 
 private slots:
     // manual connected slots
-    void serverConnected();
-    void serverDisconnected();
-    void serverDataAvailable();
-    void serverError();
-    void cleanError();
+    void connectToServer();
+    void disconnectFromServer();
 
     // auto-connected slots
     void on_actionSetup_triggered();
-    void on_actionConnect_triggered(bool checked);
-    void on_testButton_clicked();
 
 private:
     void pendingNetworkOperation(bool pending);
 
-    void connectToServer();
-    void disconnectFromServer();
+    void createStates();
+    void createTransitions();
+    void createConnections();
 
     QTcpSocket serverSocket;
     Ui::MainWindow *ui;
+
+    QStateMachine stateMachine;
+    QState* disconnectedState;
+    QState* connectedState;
+    QState* disconnectingState;
+    QState* normalState;
+    QState* connectingState;
 };
 
 #endif // MAINWINDOW_H