next steps for startwindow

This commit is contained in:
doitux
2008-06-08 21:18:29 +00:00
parent 0cf73d2bc9
commit aea6b39327
11 changed files with 443 additions and 67 deletions
+2 -2
View File
@@ -7,8 +7,8 @@ isEmpty( PREFIX ) {
TEMPLATE = app
CODECFORSRC = UTF-8
CONFIG += qt thread embed_manifest_exe exceptions rtti stl warn_on release
#CONFIG += qt thread embed_manifest_exe exceptions rtti stl warn_on debug
#CONFIG += qt thread embed_manifest_exe exceptions rtti stl warn_on release
CONFIG += qt thread embed_manifest_exe exceptions rtti stl warn_on debug
#####Uncomment this for RELEASE
#QTPLUGIN += qjpeg qgif
+2 -2
View File
@@ -3,8 +3,8 @@
TEMPLATE = lib
CODECFORSRC = UTF-8
CONFIG += staticlib thread exceptions rtti stl warn_on release
#CONFIG += staticlib thread exceptions rtti stl warn_on debug
#CONFIG += staticlib thread exceptions rtti stl warn_on release
CONFIG += staticlib thread exceptions rtti stl warn_on debug
UI_DIR = uics
TARGET = lib/pokerth_lib
+2 -2
View File
@@ -7,8 +7,8 @@ isEmpty( PREFIX ) {
TEMPLATE = app
CODECFORSRC = UTF-8
CONFIG += thread console embed_manifest_exe exceptions rtti stl warn_on release
#CONFIG += thread console embed_manifest_exe exceptions rtti stl warn_on debug
#CONFIG += thread console embed_manifest_exe exceptions rtti stl warn_on release
CONFIG += thread console embed_manifest_exe exceptions rtti stl warn_on debug
UI_DIR = uics
TARGET = bin/pokerth_server
+46 -38
View File
@@ -33,6 +33,7 @@
#include "gamelobbydialogimpl.h"
#include "timeoutmsgboximpl.h"
#include "lobbychat.h"
#include "startwindowimpl.h"
#include "startsplash.h"
#include "mycardspixmaplabel.h"
@@ -468,17 +469,17 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
#endif
}
//Dialoge
myNewGameDialog = new newGameDialogImpl(this, myConfig);
mySelectAvatarDialog = new selectAvatarDialogImpl(this, myConfig);
mySettingsDialog = new settingsDialogImpl(this, myConfig, mySelectAvatarDialog);
myChangeHumanPlayerNameDialog = new changeHumanPlayerNameDialogImpl(this, myConfig);
myJoinNetworkGameDialog = new joinNetworkGameDialogImpl(this, myConfig);
myConnectToServerDialog = new connectToServerDialogImpl(this);
myStartNetworkGameDialog = new startNetworkGameDialogImpl(this, myConfig);
myCreateNetworkGameDialog = new createNetworkGameDialogImpl(this, myConfig);
myAboutPokerthDialog = new aboutPokerthImpl(this, myConfig);
myGameLobbyDialog = new gameLobbyDialogImpl(this, myConfig);
// Dialogs
myNewGameDialog = boost::shared_ptr<newGameDialogImpl>(new newGameDialogImpl(this, myConfig));
mySelectAvatarDialog = boost::shared_ptr<selectAvatarDialogImpl>(new selectAvatarDialogImpl(this, myConfig));
mySettingsDialog = boost::shared_ptr<settingsDialogImpl>(new settingsDialogImpl(this, myConfig, mySelectAvatarDialog.get()));
myChangeHumanPlayerNameDialog = boost::shared_ptr<changeHumanPlayerNameDialogImpl>(new changeHumanPlayerNameDialogImpl(this, myConfig));
myJoinNetworkGameDialog = boost::shared_ptr<joinNetworkGameDialogImpl>(new joinNetworkGameDialogImpl(this, myConfig));
myConnectToServerDialog = boost::shared_ptr<connectToServerDialogImpl>(new connectToServerDialogImpl(this));
myStartNetworkGameDialog = boost::shared_ptr<startNetworkGameDialogImpl>(new startNetworkGameDialogImpl(this, myConfig));
myCreateNetworkGameDialog = boost::shared_ptr<createNetworkGameDialogImpl>(new createNetworkGameDialogImpl(this, myConfig));
myAboutPokerthDialog = boost::shared_ptr<aboutPokerthImpl>(new aboutPokerthImpl(this, myConfig));
myGameLobbyDialog = boost::shared_ptr<gameLobbyDialogImpl>(new gameLobbyDialogImpl(this, myConfig));
myStartNetworkGameDialog->setMyW(this);
myGameLobbyDialog->setMyW(this);
@@ -579,7 +580,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
connect(this, SIGNAL(signalRefreshButton()), this, SLOT(refreshButton()));
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)), myGameLobbyDialog, SLOT(refreshConnectedPlayerAvatars()));
connect(this, SIGNAL(signalSetPlayerAvatar(int, QString)), myGameLobbyDialog.get(), SLOT(refreshConnectedPlayerAvatars()));
connect(this, SIGNAL(signalGuiUpdateDone()), this, SLOT(guiUpdateDone()));
@@ -614,31 +615,31 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
connect(this, SIGNAL(signalNextRoundCleanGui()), this, SLOT(nextRoundCleanGui()));
connect(this, SIGNAL(signalNetClientConnect(int)), myConnectToServerDialog, SLOT(refresh(int)));
connect(this, SIGNAL(signalNetClientGameInfo(int)), myStartNetworkGameDialog, SLOT(refresh(int)));
connect(this, SIGNAL(signalNetClientGameInfo(int)), myGameLobbyDialog, 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)), myGameLobbyDialog.get(), SLOT(refresh(int)));
connect(this, SIGNAL(signalNetClientSelfJoined(unsigned, QString, int)), myStartNetworkGameDialog, SLOT(joinedNetworkGame(unsigned, QString, int)));
connect(this, SIGNAL(signalNetClientPlayerJoined(unsigned, QString, int)), myStartNetworkGameDialog, SLOT(addConnectedPlayer(unsigned, QString, int)));
connect(this, SIGNAL(signalNetClientPlayerChanged(unsigned, QString)), myStartNetworkGameDialog, SLOT(updatePlayer(unsigned, QString)));
connect(this, SIGNAL(signalNetClientPlayerLeft(unsigned, QString)), myStartNetworkGameDialog, SLOT(removePlayer(unsigned, QString)));
connect(this, SIGNAL(signalNetClientNewGameAdmin(unsigned, QString)), myStartNetworkGameDialog, SLOT(newGameAdmin(unsigned, QString)));
connect(this, SIGNAL(signalNetClientGameListNew(unsigned)), myStartNetworkGameDialog, SLOT(gameCreated(unsigned)));
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(signalNetClientPlayerChanged(unsigned, QString)), myStartNetworkGameDialog.get(), SLOT(updatePlayer(unsigned, QString)));
connect(this, SIGNAL(signalNetClientPlayerLeft(unsigned, QString)), myStartNetworkGameDialog.get(), SLOT(removePlayer(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(signalNetClientSelfJoined(unsigned, QString, int)), myGameLobbyDialog, SLOT(joinedNetworkGame(unsigned, QString, int)));
connect(this, SIGNAL(signalNetClientPlayerJoined(unsigned, QString, int)), myGameLobbyDialog, SLOT(addConnectedPlayer(unsigned, QString, int)));
connect(this, SIGNAL(signalNetClientPlayerChanged(unsigned, QString)), myGameLobbyDialog, SLOT(updatePlayer(unsigned, QString)));
connect(this, SIGNAL(signalNetClientPlayerLeft(unsigned, QString)), myGameLobbyDialog, SLOT(removePlayer(unsigned, QString)));
connect(this, SIGNAL(signalNetClientNewGameAdmin(unsigned, QString)), myGameLobbyDialog, SLOT(newGameAdmin(unsigned, QString)));
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(signalNetClientPlayerChanged(unsigned, QString)), myGameLobbyDialog.get(), SLOT(updatePlayer(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(signalNetClientGameListNew(unsigned)), myGameLobbyDialog, SLOT(addGame(unsigned)));
connect(this, SIGNAL(signalNetClientGameListRemove(unsigned)), myGameLobbyDialog, SLOT(removeGame(unsigned)));
connect(this, SIGNAL(signalNetClientGameListUpdateMode(unsigned, int)), myGameLobbyDialog, SLOT(updateGameMode(unsigned, int)));
connect(this, SIGNAL(signalNetClientGameListUpdateAdmin(unsigned, unsigned)), myGameLobbyDialog, SLOT(updateGameAdmin(unsigned, unsigned)));
connect(this, SIGNAL(signalNetClientGameListPlayerJoined(unsigned, unsigned)), myGameLobbyDialog, SLOT(gameAddPlayer(unsigned, unsigned)));
connect(this, SIGNAL(signalNetClientGameListPlayerLeft(unsigned, unsigned)), myGameLobbyDialog, SLOT(gameRemovePlayer(unsigned, unsigned)));
connect(this, SIGNAL(signalNetClientRemovedFromGame(int)), myGameLobbyDialog, SLOT(removedFromGame(int)));
connect(this, SIGNAL(signalNetClientStatsUpdate(ServerStats)), myGameLobbyDialog, SLOT(updateStats(ServerStats)));
connect(this, SIGNAL(signalNetClientGameListNew(unsigned)), myGameLobbyDialog.get(), SLOT(addGame(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(signalNetClientGameListUpdateAdmin(unsigned, unsigned)), myGameLobbyDialog.get(), SLOT(updateGameAdmin(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(signalNetClientRemovedFromGame(int)), myGameLobbyDialog.get(), SLOT(removedFromGame(int)));
connect(this, SIGNAL(signalNetClientStatsUpdate(ServerStats)), myGameLobbyDialog.get(), SLOT(updateStats(ServerStats)));
connect(this, SIGNAL(signalNetClientShowTimeoutDialog(int, unsigned)), this, SLOT(showTimeoutDialog(int, unsigned)));
// Errors are handled globally, not within one dialog.
@@ -650,7 +651,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
//Chat Messages
connect(this, SIGNAL(signalNetClientChatMsg(QString, QString)), myChat, SLOT(receiveMessage(QString, QString)));
connect(this, SIGNAL(signalNetClientChatMsg(QString, QString)), myStartNetworkGameDialog, 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(signalIrcSelfJoined(QString, QString)), myGameLobbyDialog->getLobbyChat(), SLOT(selfJoined(QString, QString)));
@@ -677,7 +678,7 @@ void gameTableImpl::callNewGameDialog() {
if(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame")){
myNewGameDialog->exec();
if (myNewGameDialog->result() == QDialog::Accepted ) { startNewLocalGame(myNewGameDialog); }
if (myNewGameDialog->result() == QDialog::Accepted ) { startNewLocalGame(myNewGameDialog.get()); }
}
// sonst mit gespeicherten Werten starten
else { startNewLocalGame(); }
@@ -685,6 +686,9 @@ void gameTableImpl::callNewGameDialog() {
void gameTableImpl::startNewLocalGame(newGameDialogImpl *v) {
myStartWindow->hide();
this->show();
// Start new local game - terminate existing network game.
mySession->terminateNetworkClient();
if (myServerGuiInterface.get())
@@ -3745,13 +3749,17 @@ void gameTableImpl::quitPokerTH() {
mySession->terminateNetworkClient();
stopTimer();
if (myServerGuiInterface.get()) myServerGuiInterface->getSession().terminateNetworkServer();
qApp->quit();
// qApp->quit();
this->hide();
myStartWindow->show();
}
}
else {
mySession->terminateNetworkClient();
stopTimer();
qApp->quit();
// qApp->quit();
this->hide();
myStartWindow->show();
}
}
+14 -11
View File
@@ -52,6 +52,7 @@ class startNetworkGameDialogImpl;
class changeHumanPlayerNameDialogImpl;
class gameLobbyDialogImpl;
class timeoutMsgBoxImpl;
class startWindowImpl;
class QColor;
class SDLPlayer;
@@ -68,6 +69,7 @@ public:
Session &getSession();
void setSession(boost::shared_ptr<Session> session);
void setStartWindow(boost::shared_ptr<startWindowImpl> s) { myStartWindow = s; }
void setLog(Log* l) { myLog = l; }
@@ -401,18 +403,19 @@ private:
QPixmap *flipside;
//Dialoge
aboutPokerthImpl *myAboutPokerthDialog;
newGameDialogImpl *myNewGameDialog;
settingsDialogImpl *mySettingsDialog;
selectAvatarDialogImpl *mySelectAvatarDialog;
changeHumanPlayerNameDialogImpl *myChangeHumanPlayerNameDialog;
joinNetworkGameDialogImpl *myJoinNetworkGameDialog;
connectToServerDialogImpl *myConnectToServerDialog;
startNetworkGameDialogImpl *myStartNetworkGameDialog;
createNetworkGameDialogImpl *myCreateNetworkGameDialog;
gameLobbyDialogImpl *myGameLobbyDialog;
// Dialogs
boost::shared_ptr<aboutPokerthImpl> myAboutPokerthDialog;
boost::shared_ptr<newGameDialogImpl> myNewGameDialog;
boost::shared_ptr<settingsDialogImpl> mySettingsDialog;
boost::shared_ptr<selectAvatarDialogImpl> mySelectAvatarDialog;
boost::shared_ptr<changeHumanPlayerNameDialogImpl> myChangeHumanPlayerNameDialog;
boost::shared_ptr<joinNetworkGameDialogImpl> myJoinNetworkGameDialog;
boost::shared_ptr<connectToServerDialogImpl> myConnectToServerDialog;
boost::shared_ptr<startNetworkGameDialogImpl> myStartNetworkGameDialog;
boost::shared_ptr<createNetworkGameDialogImpl> myCreateNetworkGameDialog;
boost::shared_ptr<gameLobbyDialogImpl> myGameLobbyDialog;
boost::shared_ptr<timeoutMsgBoxImpl> myTimeoutDialog;
boost::shared_ptr<startWindowImpl> myStartWindow;
//Sound
SDLPlayer *mySDLPlayer;
+65 -6
View File
@@ -29,7 +29,7 @@
using namespace std;
GuiWrapper::GuiWrapper(ConfigFile *c) : myLog(NULL), myW(NULL), myConfig(c), myStartWindow(NULL)
GuiWrapper::GuiWrapper(ConfigFile *c) : myLog(NULL), myW(NULL), myConfig(c)
{
@@ -37,8 +37,10 @@ GuiWrapper::GuiWrapper(ConfigFile *c) : myLog(NULL), myW(NULL), myConfig(c), myS
myW->show();
myLog = new Log(myW, myConfig);
myStartWindow = new startWindowImpl(myW, myConfig);
// myStartWindow-> show();
myStartWindow = boost::shared_ptr<startWindowImpl>(new startWindowImpl(myW, myConfig));
// myStartWindow->show();
myW->setStartWindow(myStartWindow);
}
@@ -49,7 +51,10 @@ GuiWrapper::~GuiWrapper()
void GuiWrapper::initGui(int speed) { myW->signalInitGui(speed); }
Session &GuiWrapper::getSession() { return myW->getSession(); }
void GuiWrapper::setSession(boost::shared_ptr<Session> session) { myW->setSession(session); }
void GuiWrapper::setSession(boost::shared_ptr<Session> session) {
myW->setSession(session);
myStartWindow->setSession(session);
}
void GuiWrapper::refreshSet() const { myW->signalRefreshSet(); }
void GuiWrapper::refreshCash() const { myW->signalRefreshCash(); }
@@ -119,6 +124,60 @@ void GuiWrapper::flushLogAtGame(int gameID) { myLog->signalFlushLogAtGame(gameID
void GuiWrapper::flushLogAtHand() { myLog->signalFlushLogAtHand(); }
// void GuiWrapper::SignalNetClientConnect(int actionID) { myStartWindow->signalNetClientConnect(actionID); }
// void GuiWrapper::SignalNetClientGameInfo(int actionID) { myStartWindow->signalNetClientGameInfo(actionID); }
// void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myStartWindow->signalNetClientError(errorID, osErrorID); }
// void GuiWrapper::SignalNetClientNotification(int notificationId) { myStartWindow->signalNetClientNotification(notificationId); }
// void GuiWrapper::SignalNetClientStatsUpdate(const ServerStats &stats) { myStartWindow->signalNetClientStatsUpdate(stats); }
// void GuiWrapper::SignalNetClientShowTimeoutDialog(NetTimeoutReason reason, unsigned remainingSec) { myStartWindow->signalNetClientShowTimeoutDialog(reason, remainingSec); }
// void GuiWrapper::SignalNetClientRemovedFromGame(int notificationId) { myStartWindow->signalNetClientRemovedFromGame(notificationId); }
// void GuiWrapper::SignalNetClientSelfJoined(unsigned playerId, const string &playerName, PlayerRights rights) { myStartWindow->signalNetClientSelfJoined(playerId, QString::fromUtf8(playerName.c_str()), rights); }
// void GuiWrapper::SignalNetClientPlayerJoined(unsigned playerId, const string &playerName, PlayerRights rights) { myStartWindow->signalNetClientPlayerJoined(playerId, QString::fromUtf8(playerName.c_str()), rights); }
// void GuiWrapper::SignalNetClientPlayerChanged(unsigned playerId, const string &newPlayerName)
// {
// myStartWindow->signalNetClientPlayerChanged(playerId, QString::fromUtf8(newPlayerName.c_str()));
// }
// void GuiWrapper::SignalNetClientPlayerLeft(unsigned playerId, const string &playerName)
// {
// QString tmpName(QString::fromUtf8(playerName.c_str()));
// myStartWindow->signalNetClientPlayerLeft(playerId, tmpName);
// if (!playerName.empty() && playerName[0] != '#')
// myLog->signalLogPlayerLeftMsg(tmpName);
// }
// void GuiWrapper::SignalNetClientNewGameAdmin(unsigned playerId, const string &playerName) {
//
// myStartWindow->signalNetClientNewGameAdmin(playerId, QString::fromUtf8(playerName.c_str()));
// if (!playerName.empty() && playerName[0] != '#')
// myLog->signalLogNewGameAdminMsg(QString::fromUtf8(playerName.c_str()));
//
// }
//
// void GuiWrapper::SignalNetClientGameListNew(unsigned gameId) { myStartWindow->signalNetClientGameListNew(gameId); }
// void GuiWrapper::SignalNetClientGameListRemove(unsigned gameId) { myStartWindow->signalNetClientGameListRemove(gameId); }
// void GuiWrapper::SignalNetClientGameListUpdateMode(unsigned gameId, GameMode mode) { myStartWindow->signalNetClientGameListUpdateMode(gameId, mode); }
// void GuiWrapper::SignalNetClientGameListUpdateAdmin(unsigned gameId, unsigned adminPlayerId) {myStartWindow->signalNetClientGameListUpdateAdmin(gameId, adminPlayerId); }
// void GuiWrapper::SignalNetClientGameListPlayerJoined(unsigned gameId, unsigned playerId) { myStartWindow->signalNetClientGameListPlayerJoined(gameId, playerId); }
// void GuiWrapper::SignalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId) { myStartWindow->signalNetClientGameListPlayerLeft(gameId, playerId); }
//
// void GuiWrapper::SignalNetClientGameStart(boost::shared_ptr<Game> game) { myStartWindow->signalNetClientGameStart(game); }
// void GuiWrapper::SignalNetClientWaitDialog() { myStartWindow->signalShowClientDialog(); }
// void GuiWrapper::SignalNetClientChatMsg(const string &playerName, const string &msg) { myW->signalNetClientChatMsg(QString::fromUtf8(playerName.c_str()), QString::fromUtf8(msg.c_str())); }
// void GuiWrapper::SignalNetServerSuccess(int /*actionID*/) { }
// void GuiWrapper::SignalNetServerError(int errorID, int osErrorID) { myW->signalNetServerError(errorID, osErrorID); }
//
// void GuiWrapper::SignalIrcConnect(const string &server) { myStartWindow->signalIrcConnect(QString::fromUtf8(server.c_str())); }
// void GuiWrapper::SignalIrcSelfJoined(const string &nickName, const string &channel) { myStartWindow->signalIrcSelfJoined(QString::fromUtf8(nickName.c_str()), QString::fromUtf8(channel.c_str())); }
// void GuiWrapper::SignalIrcPlayerJoined(const string &nickName) { myStartWindow->signalIrcPlayerJoined(QString::fromUtf8(nickName.c_str())); }
// void GuiWrapper::SignalIrcPlayerChanged(const string &oldNick, const string &newNick) { myStartWindow->signalIrcPlayerChanged(QString::fromUtf8(oldNick.c_str()), QString::fromUtf8(newNick.c_str())); }
// void GuiWrapper::SignalIrcPlayerKicked(const std::string &nickName, const std::string &byWhom, const std::string &reason) { myStartWindow->signalIrcPlayerKicked(QString::fromUtf8(nickName.c_str()), QString::fromUtf8(byWhom.c_str()), QString::fromUtf8(reason.c_str())); }
// void GuiWrapper::SignalIrcPlayerLeft(const std::string &nickName) { myStartWindow->signalIrcPlayerLeft(QString::fromUtf8(nickName.c_str())); }
// void GuiWrapper::SignalIrcChatMsg(const std::string &nickName, const std::string &msg) { myStartWindow->signalIrcChatMessage(QString::fromUtf8(nickName.c_str()), QString::fromUtf8(msg.c_str())); }
// void GuiWrapper::SignalIrcError(int errorCode) { myStartWindow->signalIrcError(errorCode); }
// void GuiWrapper::SignalIrcServerError(int errorCode) {myStartWindow->signalIrcServerError(errorCode); }
//TEMPORARELY UNTIL STARTWINDOW REFACTORING IS OVER TODO
void GuiWrapper::SignalNetClientConnect(int actionID) { myW->signalNetClientConnect(actionID); }
void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->signalNetClientGameInfo(actionID); }
void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myW->signalNetClientError(errorID, osErrorID); }
@@ -155,9 +214,8 @@ void GuiWrapper::SignalNetClientGameListPlayerJoined(unsigned gameId, unsigned p
void GuiWrapper::SignalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId) { myW->signalNetClientGameListPlayerLeft(gameId, playerId); }
void GuiWrapper::SignalNetClientGameStart(boost::shared_ptr<Game> game) { myW->signalNetClientGameStart(game); }
void GuiWrapper::SignalNetClientChatMsg(const string &playerName, const string &msg) { myW->signalNetClientChatMsg(QString::fromUtf8(playerName.c_str()), QString::fromUtf8(msg.c_str())); }
void GuiWrapper::SignalNetClientWaitDialog() { myW->signalShowClientDialog(); }
void GuiWrapper::SignalNetClientChatMsg(const string &playerName, const string &msg) { myW->signalNetClientChatMsg(QString::fromUtf8(playerName.c_str()), QString::fromUtf8(msg.c_str())); }
void GuiWrapper::SignalNetServerSuccess(int /*actionID*/) { }
void GuiWrapper::SignalNetServerError(int errorID, int osErrorID) { myW->signalNetServerError(errorID, osErrorID); }
@@ -171,3 +229,4 @@ void GuiWrapper::SignalIrcChatMsg(const std::string &nickName, const std::string
void GuiWrapper::SignalIrcError(int errorCode) { myW->signalIrcError(errorCode); }
void GuiWrapper::SignalIrcServerError(int errorCode) {myW->signalIrcServerError(errorCode); }
//TEMPORARELY UNTIL STARTWINDOW REFACTORING IS OVER TODO
+1 -1
View File
@@ -147,7 +147,7 @@ private:
Chat *myChat;
gameTableImpl *myW;
ConfigFile *myConfig;
startWindowImpl *myStartWindow;
boost::shared_ptr<startWindowImpl> myStartWindow;
};
@@ -94,7 +94,7 @@ private:
std::list<int> myNetManualBlindsList;
ConfigFile* myConfig;
selectAvatarDialogImpl* mySelectAvatarDialogImpl;
boost::shared_ptr<selectAvatarDialogImpl> mySelectAvatarDialogImpl;
manualBlindsOrderDialogImpl *myManualBlindsOrderDialog;
QString myAppDataPath;
+5 -2
View File
@@ -43,7 +43,7 @@
<item row="1" column="1" colspan="2" >
<layout class="QGridLayout" >
<item row="0" column="1" >
<widget class="QPushButton" name="pushButton_2" >
<widget class="QPushButton" name="pushButtonInternet_Game" >
<property name="text" >
<string>&amp;2 Internet Game</string>
</property>
@@ -64,7 +64,7 @@
</widget>
</item>
<item row="0" column="0" >
<widget class="QPushButton" name="pushButton" >
<widget class="QPushButton" name="pushButtonStart_Local_Game" >
<property name="text" >
<string>&amp;1 Start Local Game</string>
</property>
@@ -154,6 +154,9 @@
<property name="text" >
<string>Internet Game ...</string>
</property>
<property name="shortcut" >
<string>Ctrl+I</string>
</property>
</action>
<action name="actionAbout_PokerTH" >
<property name="text" >
+219
View File
@@ -18,8 +18,32 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "startwindowimpl.h"
#include <gamedata.h>
#include <generic/serverguiwrapper.h>
#include <net/socket_msg.h>
#include "session.h"
#include "game.h"
#include "configfile.h"
#include "gametableimpl.h"
#include "newgamedialogimpl.h"
#include "aboutpokerthimpl.h"
#include "mymessagedialogimpl.h"
#include "settingsdialogimpl.h"
#include "selectavatardialogimpl.h"
#include "joinnetworkgamedialogimpl.h"
#include "connecttoserverdialogimpl.h"
#include "createnetworkgamedialogimpl.h"
#include "startnetworkgamedialogimpl.h"
#include "changehumanplayernamedialogimpl.h"
#include "changecompleteblindsdialogimpl.h"
#include "gamelobbydialogimpl.h"
#include "timeoutmsgboximpl.h"
#include "lobbychat.h"
startWindowImpl::startWindowImpl(gameTableImpl *w, ConfigFile *c)
: myW(w), myConfig(c)
@@ -29,6 +53,201 @@ startWindowImpl::startWindowImpl(gameTableImpl *w, ConfigFile *c)
// setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog);
// #endif
setupUi(this);
this->setWindowTitle(QString(tr("PokerTH %1 - The Open-Source Texas Holdem Engine").arg(POKERTH_BETA_RELEASE_STRING)));
// Dialogs
myNewGameDialog = boost::shared_ptr<newGameDialogImpl>(new newGameDialogImpl(this, myConfig));
mySelectAvatarDialog = boost::shared_ptr<selectAvatarDialogImpl>(new selectAvatarDialogImpl(this, myConfig));
mySettingsDialog = boost::shared_ptr<settingsDialogImpl>(new settingsDialogImpl(this, myConfig, mySelectAvatarDialog.get()));
myChangeHumanPlayerNameDialog = boost::shared_ptr<changeHumanPlayerNameDialogImpl>(new changeHumanPlayerNameDialogImpl(this, myConfig));
myJoinNetworkGameDialog = boost::shared_ptr<joinNetworkGameDialogImpl>(new joinNetworkGameDialogImpl(this, myConfig));
myConnectToServerDialog = boost::shared_ptr<connectToServerDialogImpl>(new connectToServerDialogImpl(this));
myStartNetworkGameDialog = boost::shared_ptr<startNetworkGameDialogImpl>(new startNetworkGameDialogImpl(this, myConfig));
myCreateNetworkGameDialog = boost::shared_ptr<createNetworkGameDialogImpl>(new createNetworkGameDialogImpl(this, myConfig));
myAboutPokerthDialog = boost::shared_ptr<aboutPokerthImpl>(new aboutPokerthImpl(this, myConfig));
myGameLobbyDialog = boost::shared_ptr<gameLobbyDialogImpl>(new gameLobbyDialogImpl(this, myConfig));
myStartNetworkGameDialog->setMyW(myW);
myGameLobbyDialog->setMyW(myW);
myTimeoutDialog.reset(new timeoutMsgBoxImpl(this));
connect( actionStart_Local_Game, SIGNAL( triggered() ), this, SLOT( callNewGameDialog() ) );
connect( pushButtonStart_Local_Game, SIGNAL( clicked() ), this, SLOT( callNewGameDialog() ) );
connect( actionInternet_Game, SIGNAL( triggered() ), this, SLOT( callGameLobbyDialog() ) );
connect(this, SIGNAL(signalShowClientDialog()), this, SLOT(showClientDialog()));
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)), myGameLobbyDialog.get(), SLOT(refresh(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(signalNetClientPlayerChanged(unsigned, QString)), myStartNetworkGameDialog.get(), SLOT(updatePlayer(unsigned, QString)));
connect(this, SIGNAL(signalNetClientPlayerLeft(unsigned, QString)), myStartNetworkGameDialog.get(), SLOT(removePlayer(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(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(signalNetClientPlayerChanged(unsigned, QString)), myGameLobbyDialog.get(), SLOT(updatePlayer(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(signalNetClientGameListNew(unsigned)), myGameLobbyDialog.get(), SLOT(addGame(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(signalNetClientGameListUpdateAdmin(unsigned, unsigned)), myGameLobbyDialog.get(), SLOT(updateGameAdmin(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(signalNetClientRemovedFromGame(int)), myGameLobbyDialog.get(), SLOT(removedFromGame(int)));
connect(this, SIGNAL(signalNetClientStatsUpdate(ServerStats)), myGameLobbyDialog.get(), SLOT(updateStats(ServerStats)));
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(signalIrcSelfJoined(QString, QString)), myGameLobbyDialog->getLobbyChat(), SLOT(selfJoined(QString, 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(signalIrcPlayerKicked(QString, QString, QString)), myGameLobbyDialog->getLobbyChat(), SLOT(playerKicked(QString, QString, 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(signalIrcError(int)), myGameLobbyDialog->getLobbyChat(), SLOT(chatError(int)));
connect(this, SIGNAL(signalIrcServerError(int)), myGameLobbyDialog->getLobbyChat(), SLOT(chatServerError(int)));
}
void startWindowImpl::callNewGameDialog() {
//wenn Dialogfenster gezeigt werden soll
if(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame")){
myNewGameDialog->exec();
if (myNewGameDialog->result() == QDialog::Accepted ) { myW->startNewLocalGame(myNewGameDialog.get()); }
}
// sonst mit gespeicherten Werten starten
else { myW->startNewLocalGame(); }
}
void startWindowImpl::callGameLobbyDialog() {
//Avoid join Lobby with "Human Player" nick
if(QString::fromUtf8(myConfig->readConfigString("MyName").c_str()) == QString("Human Player")) {
myChangeHumanPlayerNameDialog->label_Message->setText(tr("You cannot join Internet-Game-Lobby with \"Human Player\" as nickname.\nPlease choose another one."));
myChangeHumanPlayerNameDialog->exec();
if(myChangeHumanPlayerNameDialog->result() == QDialog::Accepted) {
joinGameLobby();
}
}
else {
joinGameLobby();
}
}
void startWindowImpl::joinGameLobby() {
// Stop local game.
myW->stopTimer();
// Join Lobby
mySession->terminateNetworkClient();
if (myServerGuiInterface.get())
myServerGuiInterface->getSession().terminateNetworkServer();
myGameLobbyDialog->setSession(&getSession());
myStartNetworkGameDialog->setSession(&getSession());
// Clear Lobby dialog.
myGameLobbyDialog->clearDialog();
//set clean irc nick
QString myNick(QString::fromUtf8(myConfig->readConfigString("MyName").c_str()));
myNick.replace(QString::fromUtf8("ä"),"ae");
myNick.replace(QString::fromUtf8("Ä"),"Ae");
myNick.replace(QString::fromUtf8("ü"),"ue");
myNick.replace(QString::fromUtf8("Ü"),"Ue");
myNick.replace(QString::fromUtf8("ö"),"oe");
myNick.replace(QString::fromUtf8("Ö"),"Oe");
myNick.replace(QString::fromUtf8("é"),"e");
myNick.replace(QString::fromUtf8("è"),"e");
myNick.replace(QString::fromUtf8("á"),"a");
myNick.replace(QString::fromUtf8("à"),"a");
myNick.replace(QString::fromUtf8("ó"),"o");
myNick.replace(QString::fromUtf8("ò"),"o");
myNick.replace(QString::fromUtf8("ú"),"u");
myNick.replace(QString::fromUtf8("ù"),"u");
myNick.replace(QString::fromUtf8("É"),"E");
myNick.replace(QString::fromUtf8("È"),"E");
myNick.replace(QString::fromUtf8("Á"),"A");
myNick.replace(QString::fromUtf8("À"),"A");
myNick.replace(QString::fromUtf8("Ó"),"O");
myNick.replace(QString::fromUtf8("Ò"),"O");
myNick.replace(QString::fromUtf8("Ú"),"U");
myNick.replace(QString::fromUtf8("Ù"),"U");
myNick.remove(QRegExp("[^A-Z^a-z^0-9|\\-_\\\\^`]*"));
myNick = myNick.mid(0,16);
mySession->setIrcNick(myNick.toUtf8().constData());
// Start client for dedicated server.
mySession->startInternetClient();
//Dialog mit Statusbalken
myConnectToServerDialog->exec();
if (myConnectToServerDialog->result() == QDialog::Rejected ) {
mySession->terminateNetworkClient();
}
else
{
showLobbyDialog();
}
}
void startWindowImpl::showClientDialog()
{
if (mySession->getGameType() == Session::GAME_TYPE_NETWORK)
{
if (!myStartNetworkGameDialog->isVisible())
showNetworkStartDialog();
}
else if (mySession->getGameType() == Session::GAME_TYPE_INTERNET)
{
if (!myGameLobbyDialog->isVisible())
showLobbyDialog();
}
}
void startWindowImpl::showLobbyDialog()
{
myGameLobbyDialog->exec();
if (myGameLobbyDialog->result() == QDialog::Accepted)
{
//some gui modifications
myW->networkGameModification();
}
else
{
mySession->terminateNetworkClient();
}
}
void startWindowImpl::showNetworkStartDialog()
{
myStartNetworkGameDialog->exec();
if (myStartNetworkGameDialog->result() == QDialog::Accepted ) {
//some gui modifications
myW->networkGameModification();
}
else {
mySession->terminateNetworkClient();
if (myServerGuiInterface)
myServerGuiInterface->getSession().terminateNetworkServer();
}
}
+86 -2
View File
@@ -20,20 +20,104 @@
#ifndef STARTWINDOWIMPL_H
#define STARTWINDOWIMPL_H
#include <boost/shared_ptr.hpp>
#include "ui_startwindow.h"
#include "game_defs.h"
class GuiInterface;
class Session;
class Game;
class ConfigFile;
class gameTableImpl;
class newGameDialogImpl;
class settingsDialogImpl;
class selectAvatarDialogImpl;
class aboutPokerthImpl;
class joinNetworkGameDialogImpl;
class connectToServerDialogImpl;
class createNetworkGameDialogImpl;
class startNetworkGameDialogImpl;
class changeHumanPlayerNameDialogImpl;
class gameLobbyDialogImpl;
class timeoutMsgBoxImpl;
class startWindowImpl: public QMainWindow, public Ui::startWindow {
Q_OBJECT
public:
startWindowImpl(gameTableImpl *w = 0, ConfigFile *c =0);
private:
void setSession(boost::shared_ptr<Session> session) { mySession = session; }
Session &getSession() { assert(mySession.get()); return *mySession; }
ConfigFile *myConfig;
signals:
void signalShowClientDialog();
void signalNetClientConnect(int actionID);
void signalNetClientGameInfo(int actionID);
void signalNetClientError(int errorID, int osErrorID);
void signalNetClientNotification(int notificationId);
void signalNetClientStatsUpdate(ServerStats stats);
void signalNetClientShowTimeoutDialog(int, unsigned);
void signalNetClientRemovedFromGame(int notificationId);
void signalNetServerError(int errorID, int osErrorID);
void signalNetClientSelfJoined(unsigned playerId, QString playerName, int rights);
void signalNetClientPlayerJoined(unsigned playerId, QString playerName, int rights);
void signalNetClientPlayerChanged(unsigned playerId, QString newPlayerName);
void signalNetClientPlayerLeft(unsigned playerId, QString playerName);
void signalNetClientNewGameAdmin(unsigned playerId, QString playerName);
void signalNetClientGameListNew(unsigned gameId);
void signalNetClientGameListRemove(unsigned gameId);
void signalNetClientGameListUpdateMode(unsigned gameId, int mode);
void signalNetClientGameListUpdateAdmin(unsigned gameId, unsigned adminPlayerId);
void signalNetClientGameListPlayerJoined(unsigned gameId, unsigned playerId);
void signalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId);
void signalNetClientGameStart(boost::shared_ptr<Game> game);
void signalNetClientChatMsg(QString nickName, QString msg);
void signalIrcConnect(QString server);
void signalIrcSelfJoined(QString nickName, QString channel);
void signalIrcPlayerJoined(QString nickName);
void signalIrcPlayerChanged(QString oldNick, QString newNick);
void signalIrcPlayerKicked(QString nickName, QString byWhom, QString reason);
void signalIrcPlayerLeft(QString nickName);
void signalIrcChatMessage(QString nickName, QString msg);
void signalIrcError(int errorCode);
void signalIrcServerError(int errorCode);
public slots:
void callNewGameDialog();
void callGameLobbyDialog();
void showLobbyDialog();
void joinGameLobby();
void showClientDialog();
void showNetworkStartDialog();
private:
gameTableImpl *myW;
ConfigFile *myConfig;
boost::shared_ptr<Session> mySession;
boost::shared_ptr<GuiInterface> myServerGuiInterface;
// Dialogs
boost::shared_ptr<aboutPokerthImpl> myAboutPokerthDialog;
boost::shared_ptr<newGameDialogImpl> myNewGameDialog;
boost::shared_ptr<settingsDialogImpl> mySettingsDialog;
boost::shared_ptr<selectAvatarDialogImpl> mySelectAvatarDialog;
boost::shared_ptr<changeHumanPlayerNameDialogImpl> myChangeHumanPlayerNameDialog;
boost::shared_ptr<joinNetworkGameDialogImpl> myJoinNetworkGameDialog;
boost::shared_ptr<connectToServerDialogImpl> myConnectToServerDialog;
boost::shared_ptr<startNetworkGameDialogImpl> myStartNetworkGameDialog;
boost::shared_ptr<createNetworkGameDialogImpl> myCreateNetworkGameDialog;
boost::shared_ptr<gameLobbyDialogImpl> myGameLobbyDialog;
boost::shared_ptr<timeoutMsgBoxImpl> myTimeoutDialog;
boost::shared_ptr<startWindowImpl> myStartWindow;
friend class GuiWrapper;
};
#endif