waiting state for net Go button
authordisplacer
Sun, 18 Feb 2007 12:20:36 +0000
changeset 448 e968e19a464c
parent 447 570224bb8b30
child 449 9f4063306e54
waiting state for net Go button
QTfrontend/hwform.cpp
QTfrontend/hwform.h
QTfrontend/newnetclient.cpp
QTfrontend/newnetclient.h
--- a/QTfrontend/hwform.cpp	Sat Feb 17 21:51:33 2007 +0000
+++ b/QTfrontend/hwform.cpp	Sun Feb 18 12:20:36 2007 +0000
@@ -261,6 +261,7 @@
 void HWForm::_NetConnect(const QString & hostName, quint16 port, const QString & nick)
 {
 	hwnet = new HWNewNet(config, ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget);
+	connect(hwnet, SIGNAL(GameStateChanged(GameState)), this, SLOT(NetGameStateChanged(GameState)));
 	connect(hwnet, SIGNAL(AddGame(const QString &)), this, SLOT(AddGame(const QString &)));
 	connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()));
 	connect(hwnet, SIGNAL(AddNetTeam(const HWTeam&)), this, SLOT(AddNetTeam(const HWTeam&)));
@@ -358,7 +359,9 @@
 
 void HWForm::NetStartGame()
 {
-	hwnet->StartGame();
+  ui.pageNetGame->BtnGo->setText(QPushButton::tr("Waiting"));
+  ui.pageNetGame->BtnGo->setEnabled(false);
+  hwnet->StartGame();
 }
 
 void HWForm::AddNetTeam(const HWTeam& team)
@@ -373,6 +376,12 @@
 	game->StartLocal();
 }
 
+void HWForm::NetGameStateChanged(GameState __attribute__((unused)) gameState)
+{
+  ui.pageNetGame->BtnGo->setText(QPushButton::tr("Go!"));
+  ui.pageNetGame->BtnGo->setEnabled(true);
+}
+
 void HWForm::GameStateChanged(GameState gameState)
 {
 	switch(gameState) {
--- a/QTfrontend/hwform.h	Sat Feb 17 21:51:33 2007 +0000
+++ b/QTfrontend/hwform.h	Sun Feb 18 12:20:36 2007 +0000
@@ -70,6 +70,7 @@
 	void NetStartGame();
 	void AddNetTeam(const HWTeam& team);
 	void StartMPGame();
+	void NetGameStateChanged(GameState gameState);
 	void GameStateChanged(GameState gameState);
 	void GameStats(char type, const QString & info);
 	void ForcedDisconnect();
--- a/QTfrontend/newnetclient.cpp	Sat Feb 17 21:51:33 2007 +0000
+++ b/QTfrontend/newnetclient.cpp	Sun Feb 18 12:20:36 2007 +0000
@@ -284,6 +284,7 @@
 void HWNewNet::RunGame()
 {
   HWGame* game = new HWGame(config, m_pGameCFGWidget, m_pTeamSelWidget);
+  connect(game, SIGNAL(GameStateChanged(GameState)), this, SIGNAL(GameStateChanged(GameState)));
   connect(game, SIGNAL(SendNet(const QByteArray &)), this, SLOT(SendNet(const QByteArray &)));
   connect(this, SIGNAL(FromNet(const QByteArray &)), game, SLOT(FromNet(const QByteArray &)));
   connect(this, SIGNAL(LocalCFG(const QString &)), game, SLOT(LocalCFG(const QString &)));
--- a/QTfrontend/newnetclient.h	Sat Feb 17 21:51:33 2007 +0000
+++ b/QTfrontend/newnetclient.h	Sun Feb 18 12:20:36 2007 +0000
@@ -25,6 +25,7 @@
 #include <QMap>
 
 #include "team.h"
+#include "game.h" // for GameState
 
 class GameUIConfig;
 class GameCFGWidget;
@@ -89,6 +90,7 @@
   void EnteredGame();
   void FromNet(const QByteArray & buf);
   void AddNetTeam(const HWTeam&);
+  void GameStateChanged(GameState gameState);
 
   void seedChanged(const QString & seed);
   void mapChanged(const QString & map);