next steps startwindow-integration --> UNSTABLE

This commit is contained in:
doitux
2008-09-09 22:21:41 +00:00
parent 0a473245ee
commit f5ea154b09
5 changed files with 63 additions and 49 deletions
@@ -10,6 +10,7 @@
// //
// //
#include "gamelobbydialogimpl.h" #include "gamelobbydialogimpl.h"
#include "startwindowimpl.h"
#include "lobbychat.h" #include "lobbychat.h"
#include "changecompleteblindsdialogimpl.h" #include "changecompleteblindsdialogimpl.h"
#include "session.h" #include "session.h"
@@ -17,8 +18,8 @@
#include "gamedata.h" #include "gamedata.h"
#include <net/socket_msg.h> #include <net/socket_msg.h>
gameLobbyDialogImpl::gameLobbyDialogImpl(QWidget *parent, ConfigFile *c) gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
: QDialog(parent), myW(NULL), myConfig(c), mySession(NULL), currentGameName(""), myPlayerId(0), isAdmin(false), inGame(false), myChat(NULL), keyUpCounter(0) : QDialog(parent), myW(NULL), myStartWindow(parent), myConfig(c), mySession(NULL), currentGameName(""), myPlayerId(0), isAdmin(false), inGame(false), myChat(NULL), keyUpCounter(0)
{ {
#ifdef __APPLE__ #ifdef __APPLE__
@@ -209,7 +210,6 @@ void gameLobbyDialogImpl::refresh(int actionID) {
treeWidget_GameList->clear(); treeWidget_GameList->clear();
this->accept(); this->accept();
myW->show(); myW->show();
// TODO doitux: hier gametable holen
} }
} }
@@ -841,3 +841,9 @@ void gameLobbyDialogImpl::joinAnyGameButtonRefresh() {
else pushButton_joinAnyGame->setEnabled(FALSE); else pushButton_joinAnyGame->setEnabled(FALSE);
} }
void gameLobbyDialogImpl::reject()
{
myStartWindow->show();
QDialog::reject();
}
@@ -27,6 +27,7 @@
class Session; class Session;
class ConfigFile; class ConfigFile;
class LobbyChat; class LobbyChat;
class startWindowImpl;
/** /**
@author FThauer FHammer <webmaster@pokerth.net> @author FThauer FHammer <webmaster@pokerth.net>
@@ -34,7 +35,7 @@ class LobbyChat;
class gameLobbyDialogImpl: public QDialog, public Ui::gameLobbyDialog { class gameLobbyDialogImpl: public QDialog, public Ui::gameLobbyDialog {
Q_OBJECT Q_OBJECT
public: public:
gameLobbyDialogImpl(QWidget *parent = 0, ConfigFile* = 0); gameLobbyDialogImpl(startWindowImpl *parent = 0, ConfigFile* = 0);
~gameLobbyDialogImpl(); ~gameLobbyDialogImpl();
@@ -102,10 +103,12 @@ public slots:
void joinAnyGameButtonRefresh(); void joinAnyGameButtonRefresh();
void reject();
private: private:
gameTableImpl* myW; gameTableImpl* myW;
startWindowImpl* myStartWindow;
ConfigFile *myConfig; ConfigFile *myConfig;
Session *mySession; Session *mySession;
createInternetGameDialogImpl *myCreateInternetGameDialog; createInternetGameDialogImpl *myCreateInternetGameDialog;
+43 -43
View File
@@ -481,10 +481,10 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
myStartNetworkGameDialog = boost::shared_ptr<startNetworkGameDialogImpl>(new startNetworkGameDialogImpl(this, myConfig)); myStartNetworkGameDialog = boost::shared_ptr<startNetworkGameDialogImpl>(new startNetworkGameDialogImpl(this, myConfig));
myCreateNetworkGameDialog = boost::shared_ptr<createNetworkGameDialogImpl>(new createNetworkGameDialogImpl(this, myConfig)); myCreateNetworkGameDialog = boost::shared_ptr<createNetworkGameDialogImpl>(new createNetworkGameDialogImpl(this, myConfig));
myAboutPokerthDialog = boost::shared_ptr<aboutPokerthImpl>(new aboutPokerthImpl(this, myConfig)); myAboutPokerthDialog = boost::shared_ptr<aboutPokerthImpl>(new aboutPokerthImpl(this, myConfig));
myGameLobbyDialog = boost::shared_ptr<gameLobbyDialogImpl>(new gameLobbyDialogImpl(this, myConfig)); // myGameLobbyDialog = boost::shared_ptr<gameLobbyDialogImpl>(new gameLobbyDialogImpl(this, myConfig));
myStartNetworkGameDialog->setMyW(this); myStartNetworkGameDialog->setMyW(this);
myGameLobbyDialog->setMyW(this); // myGameLobbyDialog->setMyW(this);
myTimeoutDialog.reset(new timeoutMsgBoxImpl(this)); myTimeoutDialog.reset(new timeoutMsgBoxImpl(this));
@@ -582,7 +582,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
connect(this, SIGNAL(signalRefreshButton()), this, SLOT(refreshButton())); connect(this, SIGNAL(signalRefreshButton()), this, SLOT(refreshButton()));
connect(this, SIGNAL(signalRefreshGameLabels(int)), this, SLOT(refreshGameLabels(int))); connect(this, SIGNAL(signalRefreshGameLabels(int)), this, SLOT(refreshGameLabels(int)));
connect(this, SIGNAL(signalSetPlayerAvatar(int, QString)), this, SLOT(setPlayerAvatar(int, QString))); connect(this, SIGNAL(signalSetPlayerAvatar(int, QString)), this, SLOT(setPlayerAvatar(int, QString)));
connect(this, SIGNAL(signalSetPlayerAvatar(int, QString)), myGameLobbyDialog.get(), SLOT(refreshConnectedPlayerAvatars())); // connect(this, SIGNAL(signalSetPlayerAvatar(int, QString)), myGameLobbyDialog.get(), SLOT(refreshConnectedPlayerAvatars()));
connect(this, SIGNAL(signalGuiUpdateDone()), this, SLOT(guiUpdateDone())); connect(this, SIGNAL(signalGuiUpdateDone()), this, SLOT(guiUpdateDone()));
@@ -619,7 +619,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
connect(this, SIGNAL(signalNetClientConnect(int)), myConnectToServerDialog.get(), SLOT(refresh(int))); connect(this, SIGNAL(signalNetClientConnect(int)), myConnectToServerDialog.get(), SLOT(refresh(int)));
connect(this, SIGNAL(signalNetClientGameInfo(int)), myStartNetworkGameDialog.get(), SLOT(refresh(int))); connect(this, SIGNAL(signalNetClientGameInfo(int)), myStartNetworkGameDialog.get(), SLOT(refresh(int)));
connect(this, SIGNAL(signalNetClientGameInfo(int)), myGameLobbyDialog.get(), SLOT(refresh(int))); // connect(this, SIGNAL(signalNetClientGameInfo(int)), myGameLobbyDialog.get(), SLOT(refresh(int)));
connect(this, SIGNAL(signalNetClientSelfJoined(unsigned, QString, int)), myStartNetworkGameDialog.get(), SLOT(joinedNetworkGame(unsigned, QString, int))); connect(this, SIGNAL(signalNetClientSelfJoined(unsigned, QString, int)), myStartNetworkGameDialog.get(), SLOT(joinedNetworkGame(unsigned, QString, int)));
connect(this, SIGNAL(signalNetClientPlayerJoined(unsigned, QString, int)), myStartNetworkGameDialog.get(), SLOT(addConnectedPlayer(unsigned, QString, int))); connect(this, SIGNAL(signalNetClientPlayerJoined(unsigned, QString, int)), myStartNetworkGameDialog.get(), SLOT(addConnectedPlayer(unsigned, QString, int)));
@@ -628,20 +628,20 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
connect(this, SIGNAL(signalNetClientNewGameAdmin(unsigned, QString)), myStartNetworkGameDialog.get(), SLOT(newGameAdmin(unsigned, QString))); connect(this, SIGNAL(signalNetClientNewGameAdmin(unsigned, QString)), myStartNetworkGameDialog.get(), SLOT(newGameAdmin(unsigned, QString)));
connect(this, SIGNAL(signalNetClientGameListNew(unsigned)), myStartNetworkGameDialog.get(), SLOT(gameCreated(unsigned))); connect(this, SIGNAL(signalNetClientGameListNew(unsigned)), myStartNetworkGameDialog.get(), SLOT(gameCreated(unsigned)));
connect(this, SIGNAL(signalNetClientSelfJoined(unsigned, QString, int)), myGameLobbyDialog.get(), SLOT(joinedNetworkGame(unsigned, QString, int))); // connect(this, SIGNAL(signalNetClientSelfJoined(unsigned, QString, int)), myGameLobbyDialog.get(), SLOT(joinedNetworkGame(unsigned, QString, int)));
connect(this, SIGNAL(signalNetClientPlayerJoined(unsigned, QString, int)), myGameLobbyDialog.get(), SLOT(addConnectedPlayer(unsigned, QString, int))); // connect(this, SIGNAL(signalNetClientPlayerJoined(unsigned, QString, int)), myGameLobbyDialog.get(), SLOT(addConnectedPlayer(unsigned, QString, int)));
connect(this, SIGNAL(signalNetClientPlayerChanged(unsigned, QString)), myGameLobbyDialog.get(), SLOT(updatePlayer(unsigned, QString))); // connect(this, SIGNAL(signalNetClientPlayerChanged(unsigned, QString)), myGameLobbyDialog.get(), SLOT(updatePlayer(unsigned, QString)));
connect(this, SIGNAL(signalNetClientPlayerLeft(unsigned, QString)), myGameLobbyDialog.get(), SLOT(removePlayer(unsigned, QString))); // connect(this, SIGNAL(signalNetClientPlayerLeft(unsigned, QString)), myGameLobbyDialog.get(), SLOT(removePlayer(unsigned, QString)));
connect(this, SIGNAL(signalNetClientNewGameAdmin(unsigned, QString)), myGameLobbyDialog.get(), SLOT(newGameAdmin(unsigned, QString))); // connect(this, SIGNAL(signalNetClientNewGameAdmin(unsigned, QString)), myGameLobbyDialog.get(), SLOT(newGameAdmin(unsigned, QString)));
//
connect(this, SIGNAL(signalNetClientGameListNew(unsigned)), myGameLobbyDialog.get(), SLOT(addGame(unsigned))); // connect(this, SIGNAL(signalNetClientGameListNew(unsigned)), myGameLobbyDialog.get(), SLOT(addGame(unsigned)));
connect(this, SIGNAL(signalNetClientGameListRemove(unsigned)), myGameLobbyDialog.get(), SLOT(removeGame(unsigned))); // connect(this, SIGNAL(signalNetClientGameListRemove(unsigned)), myGameLobbyDialog.get(), SLOT(removeGame(unsigned)));
connect(this, SIGNAL(signalNetClientGameListUpdateMode(unsigned, int)), myGameLobbyDialog.get(), SLOT(updateGameMode(unsigned, int))); // connect(this, SIGNAL(signalNetClientGameListUpdateMode(unsigned, int)), myGameLobbyDialog.get(), SLOT(updateGameMode(unsigned, int)));
connect(this, SIGNAL(signalNetClientGameListUpdateAdmin(unsigned, unsigned)), myGameLobbyDialog.get(), SLOT(updateGameAdmin(unsigned, unsigned))); // connect(this, SIGNAL(signalNetClientGameListUpdateAdmin(unsigned, unsigned)), myGameLobbyDialog.get(), SLOT(updateGameAdmin(unsigned, unsigned)));
connect(this, SIGNAL(signalNetClientGameListPlayerJoined(unsigned, unsigned)), myGameLobbyDialog.get(), SLOT(gameAddPlayer(unsigned, unsigned))); // connect(this, SIGNAL(signalNetClientGameListPlayerJoined(unsigned, unsigned)), myGameLobbyDialog.get(), SLOT(gameAddPlayer(unsigned, unsigned)));
connect(this, SIGNAL(signalNetClientGameListPlayerLeft(unsigned, unsigned)), myGameLobbyDialog.get(), SLOT(gameRemovePlayer(unsigned, unsigned))); // connect(this, SIGNAL(signalNetClientGameListPlayerLeft(unsigned, unsigned)), myGameLobbyDialog.get(), SLOT(gameRemovePlayer(unsigned, unsigned)));
connect(this, SIGNAL(signalNetClientRemovedFromGame(int)), myGameLobbyDialog.get(), SLOT(removedFromGame(int))); // connect(this, SIGNAL(signalNetClientRemovedFromGame(int)), myGameLobbyDialog.get(), SLOT(removedFromGame(int)));
connect(this, SIGNAL(signalNetClientStatsUpdate(ServerStats)), myGameLobbyDialog.get(), SLOT(updateStats(ServerStats))); // connect(this, SIGNAL(signalNetClientStatsUpdate(ServerStats)), myGameLobbyDialog.get(), SLOT(updateStats(ServerStats)));
connect(this, SIGNAL(signalNetClientShowTimeoutDialog(int, unsigned)), this, SLOT(showTimeoutDialog(int, unsigned))); connect(this, SIGNAL(signalNetClientShowTimeoutDialog(int, unsigned)), this, SLOT(showTimeoutDialog(int, unsigned)));
// Errors are handled globally, not within one dialog. // Errors are handled globally, not within one dialog.
@@ -655,15 +655,15 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
connect(this, SIGNAL(signalNetClientChatMsg(QString, QString)), myChat, SLOT(receiveMessage(QString, QString))); connect(this, SIGNAL(signalNetClientChatMsg(QString, QString)), myChat, SLOT(receiveMessage(QString, QString)));
connect(this, SIGNAL(signalNetClientChatMsg(QString, QString)), myStartNetworkGameDialog.get(), SLOT(receiveChatMsg(QString, QString))); connect(this, SIGNAL(signalNetClientChatMsg(QString, QString)), myStartNetworkGameDialog.get(), SLOT(receiveChatMsg(QString, QString)));
connect(this, SIGNAL(signalIrcConnect(QString)), myGameLobbyDialog->getLobbyChat(), SLOT(connected(QString))); // connect(this, SIGNAL(signalIrcConnect(QString)), myGameLobbyDialog->getLobbyChat(), SLOT(connected(QString)));
connect(this, SIGNAL(signalIrcSelfJoined(QString, QString)), myGameLobbyDialog->getLobbyChat(), SLOT(selfJoined(QString, QString))); // connect(this, SIGNAL(signalIrcSelfJoined(QString, QString)), myGameLobbyDialog->getLobbyChat(), SLOT(selfJoined(QString, QString)));
connect(this, SIGNAL(signalIrcPlayerJoined(QString)), myGameLobbyDialog->getLobbyChat(), SLOT(playerJoined(QString))); // connect(this, SIGNAL(signalIrcPlayerJoined(QString)), myGameLobbyDialog->getLobbyChat(), SLOT(playerJoined(QString)));
connect(this, SIGNAL(signalIrcPlayerChanged(QString, QString)), myGameLobbyDialog->getLobbyChat(), SLOT(playerChanged(QString, QString))); // connect(this, SIGNAL(signalIrcPlayerChanged(QString, QString)), myGameLobbyDialog->getLobbyChat(), SLOT(playerChanged(QString, QString)));
connect(this, SIGNAL(signalIrcPlayerKicked(QString, QString, QString)), myGameLobbyDialog->getLobbyChat(), SLOT(playerKicked(QString, QString, QString))); // connect(this, SIGNAL(signalIrcPlayerKicked(QString, QString, QString)), myGameLobbyDialog->getLobbyChat(), SLOT(playerKicked(QString, QString, QString)));
connect(this, SIGNAL(signalIrcPlayerLeft(QString)), myGameLobbyDialog->getLobbyChat(), SLOT(playerLeft(QString))); // connect(this, SIGNAL(signalIrcPlayerLeft(QString)), myGameLobbyDialog->getLobbyChat(), SLOT(playerLeft(QString)));
connect(this, SIGNAL(signalIrcChatMessage(QString, QString)), myGameLobbyDialog->getLobbyChat(), SLOT(displayMessage(QString, QString))); // connect(this, SIGNAL(signalIrcChatMessage(QString, QString)), myGameLobbyDialog->getLobbyChat(), SLOT(displayMessage(QString, QString)));
connect(this, SIGNAL(signalIrcError(int)), myGameLobbyDialog->getLobbyChat(), SLOT(chatError(int))); // connect(this, SIGNAL(signalIrcError(int)), myGameLobbyDialog->getLobbyChat(), SLOT(chatError(int)));
connect(this, SIGNAL(signalIrcServerError(int)), myGameLobbyDialog->getLobbyChat(), SLOT(chatServerError(int))); // connect(this, SIGNAL(signalIrcServerError(int)), myGameLobbyDialog->getLobbyChat(), SLOT(chatServerError(int)));
} }
@@ -858,7 +858,7 @@ void gameTableImpl::callCreateNetworkGameDialog() {
gameData.guiSpeed = myCreateNetworkGameDialog->spinBox_gameSpeed->value(); gameData.guiSpeed = myCreateNetworkGameDialog->spinBox_gameSpeed->value();
gameData.playerActionTimeoutSec = myCreateNetworkGameDialog->spinBox_netTimeOutPlayerAction->value(); gameData.playerActionTimeoutSec = myCreateNetworkGameDialog->spinBox_netTimeOutPlayerAction->value();
myGameLobbyDialog->setSession(&getSession()); // myGameLobbyDialog->setSession(&getSession());
myStartNetworkGameDialog->setSession(&getSession()); myStartNetworkGameDialog->setSession(&getSession());
// Clear network game dialog. // Clear network game dialog.
@@ -889,7 +889,7 @@ void gameTableImpl::callJoinNetworkGameDialog() {
if (myServerGuiInterface.get()) if (myServerGuiInterface.get())
myServerGuiInterface->getSession().terminateNetworkServer(); myServerGuiInterface->getSession().terminateNetworkServer();
myGameLobbyDialog->setSession(&getSession()); // myGameLobbyDialog->setSession(&getSession());
myStartNetworkGameDialog->setSession(&getSession()); myStartNetworkGameDialog->setSession(&getSession());
// Clear network game dialog // Clear network game dialog
myStartNetworkGameDialog->clearDialog(); myStartNetworkGameDialog->clearDialog();
@@ -943,11 +943,11 @@ void gameTableImpl::joinGameLobby() {
mySession->terminateNetworkClient(); mySession->terminateNetworkClient();
if (myServerGuiInterface.get()) if (myServerGuiInterface.get())
myServerGuiInterface->getSession().terminateNetworkServer(); myServerGuiInterface->getSession().terminateNetworkServer();
myGameLobbyDialog->setSession(&getSession()); // myGameLobbyDialog->setSession(&getSession());
myStartNetworkGameDialog->setSession(&getSession()); myStartNetworkGameDialog->setSession(&getSession());
// Clear Lobby dialog. // Clear Lobby dialog.
myGameLobbyDialog->clearDialog(); // myGameLobbyDialog->clearDialog();
//set clean irc nick //set clean irc nick
QString myNick(QString::fromUtf8(myConfig->readConfigString("MyName").c_str())); QString myNick(QString::fromUtf8(myConfig->readConfigString("MyName").c_str()));
@@ -1131,8 +1131,8 @@ void gameTableImpl::showClientDialog()
} }
else if (mySession->getGameType() == Session::GAME_TYPE_INTERNET) else if (mySession->getGameType() == Session::GAME_TYPE_INTERNET)
{ {
if (!myGameLobbyDialog->isVisible()) // if (!myGameLobbyDialog->isVisible())
showLobbyDialog(); // showLobbyDialog();
} }
} }
@@ -1154,17 +1154,17 @@ void gameTableImpl::showNetworkStartDialog()
void gameTableImpl::showLobbyDialog() void gameTableImpl::showLobbyDialog()
{ {
myGameLobbyDialog->exec(); // myGameLobbyDialog->exec();
if (myGameLobbyDialog->result() == QDialog::Accepted) // if (myGameLobbyDialog->result() == QDialog::Accepted)
{ // {
//some gui modifications //some gui modifications
networkGameModification(); // networkGameModification();
} // }
else // else
{ // {
mySession->terminateNetworkClient(); // mySession->terminateNetworkClient();
} // }
} }
Session &gameTableImpl::getSession() { assert(mySession.get()); return *mySession; } Session &gameTableImpl::getSession() { assert(mySession.get()); return *mySession; }
@@ -3311,7 +3311,7 @@ void gameTableImpl::networkError(int errorID, int /*osErrorID*/) {
QMessageBox::Close); } QMessageBox::Close); }
} }
// close dialogs // close dialogs
myGameLobbyDialog->reject(); // myGameLobbyDialog->reject();
myConnectToServerDialog->reject(); myConnectToServerDialog->reject();
myStartNetworkGameDialog->reject(); myStartNetworkGameDialog->reject();
} }
+1 -1
View File
@@ -413,7 +413,7 @@ private:
boost::shared_ptr<connectToServerDialogImpl> myConnectToServerDialog; boost::shared_ptr<connectToServerDialogImpl> myConnectToServerDialog;
boost::shared_ptr<startNetworkGameDialogImpl> myStartNetworkGameDialog; boost::shared_ptr<startNetworkGameDialogImpl> myStartNetworkGameDialog;
boost::shared_ptr<createNetworkGameDialogImpl> myCreateNetworkGameDialog; boost::shared_ptr<createNetworkGameDialogImpl> myCreateNetworkGameDialog;
boost::shared_ptr<gameLobbyDialogImpl> myGameLobbyDialog; // boost::shared_ptr<gameLobbyDialogImpl> myGameLobbyDialog;
boost::shared_ptr<timeoutMsgBoxImpl> myTimeoutDialog; boost::shared_ptr<timeoutMsgBoxImpl> myTimeoutDialog;
boost::shared_ptr<startWindowImpl> myStartWindow; boost::shared_ptr<startWindowImpl> myStartWindow;
@@ -218,6 +218,7 @@ void startWindowImpl::joinGameLobby() {
} }
else else
{ {
this->hide();
showLobbyDialog(); showLobbyDialog();
} }
} }
@@ -351,11 +352,15 @@ void startWindowImpl::showClientDialog()
{ {
if (mySession->getGameType() == Session::GAME_TYPE_NETWORK) if (mySession->getGameType() == Session::GAME_TYPE_NETWORK)
{ {
if (myGuiInterface->getMyW()->isVisible())
myGuiInterface->getMyW()->hide();
if (!myStartNetworkGameDialog->isVisible()) if (!myStartNetworkGameDialog->isVisible())
showNetworkStartDialog(); showNetworkStartDialog();
} }
else if (mySession->getGameType() == Session::GAME_TYPE_INTERNET) else if (mySession->getGameType() == Session::GAME_TYPE_INTERNET)
{ {
if (myGuiInterface->getMyW()->isVisible())
myGuiInterface->getMyW()->hide();
if (!myGameLobbyDialog->isVisible()) if (!myGameLobbyDialog->isVisible())
showLobbyDialog(); showLobbyDialog();
} }