2007-05-26 17:06:03 +00:00
|
|
|
/***************************************************************************
|
|
|
|
|
* Copyright (C) 2006 by FThauer FHammer *
|
|
|
|
|
* f.thauer@web.de *
|
|
|
|
|
* *
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
|
* (at your option) any later version. *
|
|
|
|
|
* *
|
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
|
* *
|
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
|
* along with this program; if not, write to the *
|
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "guiwrapper.h"
|
|
|
|
|
#include "session.h"
|
|
|
|
|
#include "log.h"
|
|
|
|
|
#include "chat.h"
|
|
|
|
|
#include "mainwindowimpl.h"
|
|
|
|
|
#include "configfile.h"
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GuiWrapper::GuiWrapper(ConfigFile *c) : myLog(0), myW(0), myConfig(c)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
myW = new mainWindowImpl(myConfig);
|
|
|
|
|
myW->show();
|
|
|
|
|
myLog = new Log(myW, myConfig);
|
|
|
|
|
myChat = new Chat(myW, myConfig);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GuiWrapper::~GuiWrapper()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-03 13:36:24 +00:00
|
|
|
void GuiWrapper::initGui(int speed) { myW->signalInitGui(speed); }
|
2007-05-26 17:06:03 +00:00
|
|
|
|
|
|
|
|
Session &GuiWrapper::getSession() { return myW->getSession(); }
|
|
|
|
|
void GuiWrapper::setSession(boost::shared_ptr<Session> session) { myW->setSession(session); }
|
|
|
|
|
|
|
|
|
|
void GuiWrapper::refreshSet() const { myW->signalRefreshSet(); }
|
|
|
|
|
void GuiWrapper::refreshCash() const { myW->signalRefreshCash(); }
|
|
|
|
|
void GuiWrapper::refreshAction(int playerID, int playerAction) const { myW->signalRefreshAction(playerID, playerAction); }
|
|
|
|
|
void GuiWrapper::refreshChangePlayer() const { myW->signalRefreshChangePlayer(); }
|
|
|
|
|
void GuiWrapper::refreshAll() const { myW->signalRefreshAll(); }
|
|
|
|
|
void GuiWrapper::refreshPot() const { myW->signalRefreshPot(); }
|
|
|
|
|
void GuiWrapper::refreshGroupbox(int playerID, int status) const { myW->signalRefreshGroupbox(playerID, status); }
|
|
|
|
|
void GuiWrapper::refreshPlayerName() const { myW->signalRefreshPlayerName(); }
|
|
|
|
|
void GuiWrapper::refreshButton() const { myW->signalRefreshButton(); }
|
2007-06-07 14:06:22 +00:00
|
|
|
void GuiWrapper::refreshGameLabels(GameState state) const { myW->signalRefreshGameLabels(state); }
|
2007-05-26 17:06:03 +00:00
|
|
|
|
2007-06-10 12:46:29 +00:00
|
|
|
void GuiWrapper::waitForGuiUpdateDone() const
|
|
|
|
|
{
|
|
|
|
|
myW->signalGuiUpdateDone();
|
|
|
|
|
myW->waitForGuiUpdateDone();
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-07 00:05:29 +00:00
|
|
|
void GuiWrapper::dealBeRoCards(int myBeRoID) { myW->signalDealBeRoCards(myBeRoID); }
|
|
|
|
|
|
2007-05-26 17:06:03 +00:00
|
|
|
void GuiWrapper::dealHoleCards() { myW->signalDealHoleCards(); }
|
|
|
|
|
void GuiWrapper::dealFlopCards() { myW->signalDealFlopCards0(); }
|
|
|
|
|
void GuiWrapper::dealTurnCard() { myW->signalDealTurnCards0(); }
|
|
|
|
|
void GuiWrapper::dealRiverCard() { myW->signalDealRiverCards0(); }
|
|
|
|
|
|
|
|
|
|
void GuiWrapper::nextPlayerAnimation() { myW->signalNextPlayerAnimation(); }
|
|
|
|
|
|
2007-08-07 13:07:39 +00:00
|
|
|
void GuiWrapper::beRoAnimation2(int myBeRoID) { myW->signalBeRoAnimation2(myBeRoID); }
|
|
|
|
|
|
2007-05-26 17:06:03 +00:00
|
|
|
void GuiWrapper::preflopAnimation1() { myW->signalPreflopAnimation1(); }
|
|
|
|
|
void GuiWrapper::preflopAnimation2() { myW->signalPreflopAnimation2(); }
|
|
|
|
|
|
|
|
|
|
void GuiWrapper::flopAnimation1() { myW->signalFlopAnimation1(); }
|
|
|
|
|
void GuiWrapper::flopAnimation2() { myW->signalFlopAnimation2(); }
|
|
|
|
|
|
|
|
|
|
void GuiWrapper::turnAnimation1() { myW->signalTurnAnimation1(); }
|
|
|
|
|
void GuiWrapper::turnAnimation2() { myW->signalTurnAnimation2(); }
|
|
|
|
|
|
|
|
|
|
void GuiWrapper::riverAnimation1() { myW->signalRiverAnimation1(); }
|
|
|
|
|
void GuiWrapper::riverAnimation2() { myW->signalRiverAnimation2(); }
|
|
|
|
|
|
|
|
|
|
void GuiWrapper::postRiverAnimation1() { myW->signalPostRiverAnimation1(); }
|
|
|
|
|
void GuiWrapper::postRiverRunAnimation1() { myW->signalPostRiverRunAnimation1(); }
|
|
|
|
|
|
|
|
|
|
void GuiWrapper::flipHolecardsAllIn() { myW->signalFlipHolecardsAllIn(); }
|
|
|
|
|
|
|
|
|
|
void GuiWrapper::nextRoundCleanGui() { myW->signalNextRoundCleanGui(); }
|
|
|
|
|
|
|
|
|
|
void GuiWrapper::meInAction() { myW->signalMeInAction(); }
|
2007-06-08 22:14:05 +00:00
|
|
|
void GuiWrapper::disableMyButtons() { myW->signalDisableMyButtons(); }
|
2007-06-07 23:24:22 +00:00
|
|
|
void GuiWrapper::startTimeoutAnimation(int playerId, int timeoutSec) { myW->signalStartTimeoutAnimation(playerId, timeoutSec); }
|
|
|
|
|
void GuiWrapper::stopTimeoutAnimation(int playerId) { myW->signalStopTimeoutAnimation(playerId); }
|
2007-05-26 17:06:03 +00:00
|
|
|
|
|
|
|
|
void GuiWrapper::logPlayerActionMsg(string playerName, int action, int setValue) { myLog->signalLogPlayerActionMsg(QString::fromUtf8(playerName.c_str()), action, setValue); }
|
|
|
|
|
void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->signalLogNewGameHandMsg(gameID, handID); }
|
2007-05-26 19:28:34 +00:00
|
|
|
void GuiWrapper::logPlayerWinsMsg(int playerID, int pot) { myLog->signalLogPlayerWinsMsg(playerID, pot); }
|
|
|
|
|
void GuiWrapper::logDealBoardCardsMsg(int roundID, int card1, int card2, int card3, int card4, int card5) { myLog->signalLogDealBoardCardsMsg(roundID, card1, card2, card3, card4, card5); }
|
2007-06-07 18:41:11 +00:00
|
|
|
void GuiWrapper::logFlipHoleCardsMsg(string playerName, int card1, int card2, int cardsValueInt, string showHas) { myLog->signalLogFlipHoleCardsMsg(QString::fromUtf8(playerName.c_str()), card1, card2, cardsValueInt, QString::fromUtf8(showHas.c_str())); }
|
2007-06-11 20:35:12 +00:00
|
|
|
void GuiWrapper::logPlayerWinGame(std::string playerName, int gameID) { myLog->signalLogPlayerWinGame(QString::fromUtf8(playerName.c_str()), gameID); }
|
2007-05-26 17:06:03 +00:00
|
|
|
|
|
|
|
|
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); }
|
2007-08-02 20:52:13 +00:00
|
|
|
void GuiWrapper::SignalNetClientSelfJoined(const string &playerName, PlayerRights rights) { myW->signalNetClientSelfJoined(QString::fromUtf8(playerName.c_str()), rights); }
|
|
|
|
|
void GuiWrapper::SignalNetClientPlayerJoined(const string &playerName, PlayerRights rights) { myW->signalNetClientPlayerJoined(QString::fromUtf8(playerName.c_str()), rights); }
|
2007-08-26 22:41:37 +00:00
|
|
|
void GuiWrapper::SignalNetClientPlayerChanged(const string &oldPlayerName, const string &newPlayerName)
|
|
|
|
|
{
|
|
|
|
|
myW->signalNetClientPlayerChanged(QString::fromUtf8(oldPlayerName.c_str()), QString::fromUtf8(newPlayerName.c_str()));
|
|
|
|
|
}
|
2007-06-15 10:38:41 +00:00
|
|
|
void GuiWrapper::SignalNetClientPlayerLeft(const string &playerName)
|
|
|
|
|
{
|
|
|
|
|
QString tmpName(QString::fromUtf8(playerName.c_str()));
|
|
|
|
|
myW->signalNetClientPlayerLeft(tmpName);
|
2007-08-27 09:57:51 +00:00
|
|
|
if (!playerName.empty() && playerName[0] != '#')
|
|
|
|
|
myLog->signalLogPlayerLeftMsg(tmpName);
|
2007-06-15 10:38:41 +00:00
|
|
|
}
|
2007-08-21 12:34:33 +00:00
|
|
|
|
2007-08-21 12:38:49 +00:00
|
|
|
void GuiWrapper::SignalNetClientGameListNew(const string &gameName) { myW->signalNetClientGameListNew(QString::fromUtf8(gameName.c_str())); }
|
|
|
|
|
void GuiWrapper::SignalNetClientGameListRemove(const string &gameName) { myW->signalNetClientGameListRemove(QString::fromUtf8(gameName.c_str())); }
|
2007-08-21 12:34:33 +00:00
|
|
|
|
2007-05-26 17:06:03 +00:00
|
|
|
void GuiWrapper::SignalNetClientGameStart(boost::shared_ptr<Game> game) { myW->signalNetClientGameStart(game); }
|
|
|
|
|
void GuiWrapper::SignalNetClientChatMsg(const string &playerName, const string &msg) { myChat->signalChatMessage(QString::fromUtf8(playerName.c_str()), QString::fromUtf8(msg.c_str())); }
|
2007-08-02 20:52:13 +00:00
|
|
|
void GuiWrapper::SignalNetClientWaitDialog() { myW->signalShowNetworkStartDialog(); }
|
2007-05-26 17:06:03 +00:00
|
|
|
|
|
|
|
|
void GuiWrapper::SignalNetServerSuccess(int actionID) { }
|
2007-06-04 17:04:03 +00:00
|
|
|
void GuiWrapper::SignalNetServerError(int errorID, int osErrorID) { myW->signalNetServerError(errorID, osErrorID); }
|
2007-08-02 20:52:13 +00:00
|
|
|
void GuiWrapper::SignalNetServerPlayerJoined(const string &playerName) { }
|
|
|
|
|
void GuiWrapper::SignalNetServerPlayerLeft(const string &playerName) { }
|
2007-05-26 17:06:03 +00:00
|
|
|
|