Files
pokerth/src/gui/qt/mainwindow/mainwindowimpl.h
T

438 lines
12 KiB
C++
Raw Normal View History

2007-01-13 02:40:33 +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. *
***************************************************************************/
#ifndef MAINWINDOWIMPL_H
#define MAINWINDOWIMPL_H
#include "ui_mainwindow.h"
#include "game_defs.h"
2007-01-13 14:27:56 +00:00
#include <string>
#include <boost/shared_ptr.hpp>
2007-01-13 02:40:33 +00:00
#include <QtGui>
#include <QtCore>
2007-01-31 22:48:44 +00:00
class Log;
2007-05-25 00:09:51 +00:00
class Chat;
2007-01-20 01:38:40 +00:00
class ConfigFile;
class Session;
class Game;
2007-01-13 22:29:17 +00:00
2007-05-14 12:40:42 +00:00
class GuiInterface;
2007-01-13 22:29:17 +00:00
class BoardInterface;
2007-02-04 23:58:50 +00:00
// class HandInterface;
2007-01-13 22:29:17 +00:00
class PlayerInterface;
2007-01-28 01:28:19 +00:00
class MyCardsPixmapLabel;
2007-03-21 00:41:29 +00:00
class newGameDialogImpl;
2007-05-13 12:35:27 +00:00
class settingsDialogImpl;
2007-05-23 10:19:10 +00:00
class selectAvatarDialogImpl;
2007-05-13 12:35:27 +00:00
class aboutPokerthImpl;
2007-02-18 21:06:21 +00:00
class joinNetworkGameDialogImpl;
class connectToServerDialogImpl;
class createNetworkGameDialogImpl;
class startNetworkGameDialogImpl;
2007-05-28 19:56:57 +00:00
class changeHumanPlayerNameDialogImpl;
2007-08-20 21:23:03 +00:00
class gameLobbyDialogImpl;
2007-01-28 01:28:19 +00:00
2007-01-13 02:40:33 +00:00
class QColor;
2007-06-01 22:49:37 +00:00
class SDLPlayer;
2007-01-13 14:27:56 +00:00
2007-01-13 02:40:33 +00:00
class mainWindowImpl: public QMainWindow, public Ui::mainWindow {
Q_OBJECT
2007-02-18 22:44:41 +00:00
2007-01-13 02:40:33 +00:00
public:
2007-05-13 12:35:27 +00:00
mainWindowImpl(ConfigFile *c = 0, QMainWindow *parent = 0);
2007-01-14 19:58:40 +00:00
2007-02-04 23:58:50 +00:00
~mainWindowImpl();
Session &getSession();
void setSession(boost::shared_ptr<Session> session);
2007-05-25 00:09:51 +00:00
void setLog(Log* l) { myLog = l; }
void setChat(Chat* c) { myChat = c; }
2007-01-13 02:40:33 +00:00
SDLPlayer* getMySDLPlayer() const { return mySDLPlayer; }
void setSpeeds();
signals:
void signalInitGui(int speed);
void signalShowNetworkStartDialog();
void signalRefreshSet();
void signalRefreshCash();
void signalRefreshAction(int =-1, int=-1);
void signalRefreshChangePlayer();
void signalRefreshPot();
void signalRefreshGroupbox(int =-1, int =-1);
void signalRefreshAll();
void signalRefreshPlayerName();
void signalRefreshButton();
void signalRefreshGameLabels(int);
void signalGuiUpdateDone();
void signalMeInAction();
void signalDisableMyButtons();
void signalStartTimeoutAnimation(int playerId, int timeoutSec);
void signalStopTimeoutAnimation(int playerId);
2007-08-07 00:05:29 +00:00
void signalDealBeRoCards(int myBeRoID);
void signalDealHoleCards();
void signalDealFlopCards0();
void signalDealTurnCards0();
void signalDealRiverCards0();
void signalNextPlayerAnimation();
2007-08-07 13:07:39 +00:00
void signalBeRoAnimation2(int);
void signalPreflopAnimation1();
void signalPreflopAnimation2();
void signalFlopAnimation1();
void signalFlopAnimation2();
void signalTurnAnimation1();
void signalTurnAnimation2();
void signalRiverAnimation1();
void signalRiverAnimation2();
void signalPostRiverAnimation1();
void signalPostRiverRunAnimation1();
void signalFlipHolecardsAllIn();
void signalNextRoundCleanGui();
void signalNetClientConnect(int actionID);
void signalNetClientGameInfo(int actionID);
void signalNetClientError(int errorID, int osErrorID);
void signalNetClientNotification(int notificationId);
void signalNetClientRemovedFromGame(int notificationId);
2007-06-04 17:04:03 +00:00
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 signalNetClientGameListNew(unsigned gameId);
void signalNetClientGameListRemove(unsigned gameId);
void signalNetClientGameListPlayerJoined(unsigned gameId, unsigned playerId);
void signalNetClientGameListPlayerLeft(unsigned gameId, unsigned playerId);
void signalNetClientGameStart(boost::shared_ptr<Game> game);
public slots:
void initGui(int speed);
void showNetworkStartDialog();
2007-01-13 02:40:33 +00:00
//refresh-Funktionen
void refreshSet();
void refreshCash();
void refreshAction(int =-1, int=-1);
2007-01-13 02:40:33 +00:00
void refreshChangePlayer();
void refreshPot();
void refreshGroupbox(int =-1, int =-1);
void refreshAll();
void refreshPlayerName();
void refreshGameLabels(int);
void refreshButton();
void refreshPlayerAvatar();
2007-01-13 02:40:33 +00:00
void guiUpdateDone();
void waitForGuiUpdateDone();
2007-01-13 02:40:33 +00:00
// Karten-Funktionen
void dealHoleCards();
//Spieler-Funktionen
void meInAction();
void disableMyButtons();
void startTimeoutAnimation(int playerId, int timoutSec);
void stopTimeoutAnimation(int playerId);
2007-01-13 02:40:33 +00:00
2007-01-15 09:07:34 +00:00
void setGameSpeed(const int theValue) { guiGameSpeed = theValue; setSpeeds(); } // Achtung Faktor 10!!!
2007-01-14 14:08:45 +00:00
2007-01-13 02:40:33 +00:00
void callNewGameDialog() ;
void callAboutPokerthDialog();
2007-01-17 01:22:55 +00:00
void callSettingsDialog();
void callCreateNetworkGameDialog();
2007-02-15 00:57:04 +00:00
void callJoinNetworkGameDialog();
2007-08-20 21:23:03 +00:00
void callGameLobbyDialog();
2007-02-15 00:57:04 +00:00
2007-03-28 10:21:51 +00:00
void myBetRaise();
void myFoldAllin();
void myCallCheckSet();
2007-01-13 02:40:33 +00:00
void myFold();
void myCheck();
void myCall();
void myBet();
void mySet();
void myRaise();
void myAllIn();
void myActionDone();
2007-08-07 00:05:29 +00:00
void dealBeRoCards(int);
2007-01-13 02:40:33 +00:00
void dealFlopCards0();
void dealFlopCards1();
void dealFlopCards2();
void dealFlopCards3();
void dealFlopCards4();
void dealFlopCards5();
void dealFlopCards6();
void dealTurnCards0();
void dealTurnCards1();
void dealTurnCards2();
void dealRiverCards0();
void dealRiverCards1();
void dealRiverCards2();
void nextPlayerAnimation();
2007-08-07 13:07:39 +00:00
void beRoAnimation2(int);
2007-01-13 02:40:33 +00:00
void preflopAnimation1();
void preflopAnimation1Action();
void preflopAnimation2();
void preflopAnimation2Action();
void flopAnimation1();
void flopAnimation1Action();
void flopAnimation2();
void flopAnimation2Action();
void turnAnimation1();
void turnAnimation1Action();
void turnAnimation2();
void turnAnimation2Action();
void riverAnimation1();
void riverAnimation1Action();
void riverAnimation2();
void riverAnimation2Action();
void postRiverAnimation1();
void postRiverAnimation1Action();
void postRiverRunAnimation1();
void postRiverRunAnimation2();
2007-08-11 14:36:20 +00:00
void postRiverRunAnimation2_flipHoleCards1();
void postRiverRunAnimation2_flipHoleCards2();
2007-01-13 02:40:33 +00:00
void postRiverRunAnimation3();
void postRiverRunAnimation4();
void postRiverRunAnimation5();
void postRiverRunAnimation6();
2007-05-01 21:14:46 +00:00
void blinkingStartButtonAnimationAction();
void flipHolecardsAllIn();
2007-02-28 20:51:43 +00:00
void showMyCards();
2007-01-13 02:40:33 +00:00
void handSwitchRounds();
void startNewHand();
2007-03-21 00:41:29 +00:00
void startNewLocalGame(newGameDialogImpl* =0);
2007-01-23 19:20:18 +00:00
2007-01-23 23:53:12 +00:00
void stopTimer();
2007-01-13 02:40:33 +00:00
void nextRoundCleanGui();
2007-01-15 08:35:26 +00:00
void breakButtonClicked();
2007-01-13 02:40:33 +00:00
2007-03-21 00:41:29 +00:00
void keyPressEvent ( QKeyEvent*);
2007-03-30 12:44:16 +00:00
// bool event ( QEvent * );
void switchChatWindow();
void switchHelpWindow();
void switchLogWindow();
2007-02-27 19:44:03 +00:00
void switchFullscreen();
2007-01-27 09:08:55 +00:00
2007-01-24 23:46:49 +00:00
void paintStartSplash();
2007-01-23 19:20:18 +00:00
2007-05-25 00:09:51 +00:00
void sendChatMessage();
2007-05-25 17:57:03 +00:00
void checkChatInputLength(QString);
void tabSwitchAction();
2007-05-25 00:09:51 +00:00
2007-03-21 00:41:29 +00:00
void networkError(int, int);
void networkNotification(int);
void networkStart(boost::shared_ptr<Game> game);
2007-02-04 23:58:50 +00:00
2007-05-14 13:01:16 +00:00
void closeEvent(QCloseEvent*);
2007-05-28 18:48:12 +00:00
void localGameModification();
void networkGameModification();
2007-05-14 13:01:16 +00:00
2007-08-19 12:33:24 +00:00
void mouseOverFlipCards(bool front);
2007-05-30 22:03:40 +00:00
void quitPokerTH();
2007-08-11 14:36:20 +00:00
2007-05-29 12:22:05 +00:00
2007-01-13 02:40:33 +00:00
private:
2007-05-14 12:40:42 +00:00
boost::shared_ptr<GuiInterface> myServerGuiInterface;
boost::shared_ptr<Session> mySession;
2007-01-31 22:48:44 +00:00
Log *myLog;
2007-05-25 00:09:51 +00:00
Chat *myChat;
2007-01-21 22:58:22 +00:00
ConfigFile *myConfig;
2007-09-18 21:31:39 +00:00
int playingMode;
2007-01-13 02:40:33 +00:00
2007-02-20 00:05:09 +00:00
//Logo
QLabel *label_logoleft;
QLabel *label_logoright;
2007-01-28 23:33:48 +00:00
//MyPixmapCardsLabel
MyCardsPixmapLabel *pixmapLabel_cardBoard0;
MyCardsPixmapLabel *pixmapLabel_cardBoard1;
MyCardsPixmapLabel *pixmapLabel_cardBoard2;
MyCardsPixmapLabel *pixmapLabel_cardBoard3;
MyCardsPixmapLabel *pixmapLabel_cardBoard4;
MyCardsPixmapLabel *pixmapLabel_card0a;
MyCardsPixmapLabel *pixmapLabel_card0b;
MyCardsPixmapLabel *pixmapLabel_card1a;
MyCardsPixmapLabel *pixmapLabel_card1b;
MyCardsPixmapLabel *pixmapLabel_card2a;
MyCardsPixmapLabel *pixmapLabel_card2b;
MyCardsPixmapLabel *pixmapLabel_card3a;
MyCardsPixmapLabel *pixmapLabel_card3b;
MyCardsPixmapLabel *pixmapLabel_card4a;
MyCardsPixmapLabel *pixmapLabel_card4b;
2007-03-26 00:12:35 +00:00
MyCardsPixmapLabel *pixmapLabel_card5a;
MyCardsPixmapLabel *pixmapLabel_card5b;
MyCardsPixmapLabel *pixmapLabel_card6a;
MyCardsPixmapLabel *pixmapLabel_card6b;
2007-01-23 19:20:18 +00:00
//Timer
2007-01-13 02:40:33 +00:00
QTimer *potDistributeTimer;
QTimer *timer;
2007-01-23 19:20:18 +00:00
QTimer *dealFlopCards0Timer;
QTimer *dealFlopCards1Timer;
QTimer *dealFlopCards2Timer;
QTimer *dealFlopCards3Timer;
QTimer *dealFlopCards4Timer;
QTimer *dealFlopCards5Timer;
QTimer *dealFlopCards6Timer;
QTimer *dealTurnCards0Timer;
QTimer *dealTurnCards1Timer;
QTimer *dealTurnCards2Timer;
QTimer *dealRiverCards0Timer;
QTimer *dealRiverCards1Timer;
QTimer *dealRiverCards2Timer;
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
QTimer *nextPlayerAnimationTimer;
QTimer *preflopAnimation1Timer;
QTimer *preflopAnimation2Timer;
QTimer *flopAnimation1Timer;
QTimer *flopAnimation2Timer;
QTimer *turnAnimation1Timer;
QTimer *turnAnimation2Timer;
QTimer *riverAnimation1Timer;
QTimer *riverAnimation2Timer;
QTimer *postRiverAnimation1Timer;
QTimer *postRiverRunAnimation1Timer;
QTimer *postRiverRunAnimation2Timer;
2007-08-11 14:36:20 +00:00
QTimer *postRiverRunAnimation2_flipHoleCards1Timer;
QTimer *postRiverRunAnimation2_flipHoleCards2Timer;
2007-01-23 19:20:18 +00:00
QTimer *postRiverRunAnimation3Timer;
QTimer *postRiverRunAnimation5Timer;
QTimer *postRiverRunAnimation6Timer;
2007-05-01 22:51:10 +00:00
QTimer *blinkingStartButtonAnimationTimer;
2007-01-23 19:20:18 +00:00
2007-05-01 22:51:10 +00:00
2007-03-28 10:21:51 +00:00
QWidget *userWidgetsArray[4];
QLabel *buttonLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *cashLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *cashTopLabelArray[MAX_NUMBER_OF_PLAYERS];
MySetLabel *setLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *actionLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *playerNameLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *playerAvatarLabelArray[MAX_NUMBER_OF_PLAYERS];
2007-03-27 16:02:23 +00:00
QGroupBox *groupBoxArray[MAX_NUMBER_OF_PLAYERS];
2007-01-28 01:28:19 +00:00
MyCardsPixmapLabel *boardCardsArray[5];
MyCardsPixmapLabel *holeCardsArray[MAX_NUMBER_OF_PLAYERS][2];
2007-01-13 02:40:33 +00:00
2007-01-28 23:33:48 +00:00
QPixmap *flipside;
2007-02-18 21:06:21 +00:00
//Dialoge
2007-05-13 12:35:27 +00:00
aboutPokerthImpl *myAboutPokerthDialog;
newGameDialogImpl *myNewGameDialog;
settingsDialogImpl *mySettingsDialog;
2007-05-23 10:19:10 +00:00
selectAvatarDialogImpl *mySelectAvatarDialog;
2007-05-28 19:56:57 +00:00
changeHumanPlayerNameDialogImpl *myChangeHumanPlayerNameDialog;
2007-02-18 21:06:21 +00:00
joinNetworkGameDialogImpl *myJoinNetworkGameDialog;
connectToServerDialogImpl *myConnectToServerDialog;
startNetworkGameDialogImpl *myStartNetworkGameDialog;
createNetworkGameDialogImpl *myCreateNetworkGameDialog;
2007-08-20 21:23:03 +00:00
gameLobbyDialogImpl *myGameLobbyDialog;
2007-06-01 22:49:37 +00:00
//Sound
SDLPlayer *mySDLPlayer;
QString myAppDataPath;
2007-08-29 19:27:12 +00:00
2007-01-13 02:40:33 +00:00
int distributePotAnimCounter;
//Speed
2007-01-15 09:07:34 +00:00
int guiGameSpeed;
2007-01-13 02:40:33 +00:00
int gameSpeed;
int dealCardsSpeed;
int preDealCardsSpeed;
int postDealCardsSpeed;
int AllInDealCardsSpeed;
2007-01-13 02:40:33 +00:00
int postRiverRunAnimationSpeed;
int winnerBlinkSpeed;
int newRoundSpeed;
int nextPlayerSpeed1;
int nextPlayerSpeed2;
int nextPlayerSpeed3;
int preflopNextPlayerSpeed;
int nextOpponentSpeed;
2007-05-26 12:40:45 +00:00
bool myActionIsBet;
bool myActionIsRaise;
2007-01-23 23:53:12 +00:00
2007-01-14 19:58:40 +00:00
bool breakAfterActualHand;
bool flipHolecardsAllInAlreadyDone;
2007-01-13 02:40:33 +00:00
QColor active;
QColor inactive;
QColor highlight;
2007-02-18 22:44:41 +00:00
2007-04-03 10:55:16 +00:00
// statistic testing
int statisticArray[15];
QSemaphore guiUpdateSemaphore;
2007-05-29 12:22:05 +00:00
2007-02-18 22:44:41 +00:00
friend class GuiWrapper;
2007-01-13 02:40:33 +00:00
};
#endif