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

3952 lines
143 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. *
***************************************************************************/
#include "mainwindowimpl.h"
#include "newgamedialogimpl.h"
#include "aboutpokerthimpl.h"
2007-01-17 01:22:55 +00:00
#include "settingsdialogimpl.h"
2007-05-23 10:19:10 +00:00
#include "selectavatardialogimpl.h"
#include "joinnetworkgamedialogimpl.h"
#include "connecttoserverdialogimpl.h"
#include "createnetworkgamedialogimpl.h"
#include "startnetworkgamedialogimpl.h"
2007-05-28 19:56:57 +00:00
#include "changehumanplayernamedialogimpl.h"
#include "changecompleteblindsdialogimpl.h"
2007-08-20 21:23:03 +00:00
#include "gamelobbydialogimpl.h"
#include "lobbychat.h"
2007-03-14 09:02:41 +00:00
2007-01-24 23:46:49 +00:00
#include "startsplash.h"
2007-01-28 01:28:19 +00:00
#include "mycardspixmaplabel.h"
#include "mysetlabel.h"
2007-06-01 22:49:37 +00:00
#include "log.h"
#include "chat.h"
2007-01-13 22:29:17 +00:00
#include "playerinterface.h"
#include "boardinterface.h"
#include "handinterface.h"
#include "game.h"
2007-01-13 02:40:33 +00:00
#include "session.h"
#include "tools.h"
2007-01-13 02:40:33 +00:00
2007-01-19 02:03:30 +00:00
#include "configfile.h"
2007-06-01 22:49:37 +00:00
#include "sdlplayer.h"
#include <gamedata.h>
2007-05-14 12:40:42 +00:00
#include <generic/serverguiwrapper.h>
2007-01-13 02:40:33 +00:00
2007-03-21 00:41:29 +00:00
#include <net/socket_msg.h>
2007-01-13 02:40:33 +00:00
#define FORMATLEFT(X) "<p align='center'>(X)"
#define FORMATRIGHT(X) "(X)</p>"
using namespace std;
2007-05-13 12:35:27 +00:00
mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
2007-10-12 18:45:28 +00:00
: QMainWindow(parent), myChat(NULL), myConfig(c), gameSpeed(0), myActionIsBet(0), myActionIsRaise(0), breakAfterActualHand(FALSE)
{
2007-01-28 23:33:48 +00:00
int i;
2007-06-25 00:25:52 +00:00
// this->setStyle(new QPlastiqueStyle);
2007-04-30 23:14:30 +00:00
2007-04-03 10:55:16 +00:00
//for statistic development
for(i=0; i<15; i++) {
statisticArray[i] = 0;
}
////////////////////////////
myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
2007-08-29 19:27:12 +00:00
2007-01-13 02:40:33 +00:00
setupUi(this);
2007-01-28 01:28:19 +00:00
//pixmapCardsLabel erstellen und ins Layout einfügen!
2007-03-26 00:12:35 +00:00
pixmapLabel_cardBoard0 = new MyCardsPixmapLabel(frame_Board);
2007-03-27 16:02:23 +00:00
pixmapLabel_cardBoard0->setObjectName(QString::fromUtf8("pixmapLabel_BoardCard0"));
2007-02-01 23:46:34 +00:00
pixmapLabel_cardBoard0->setScaledContents(true);
2007-03-27 16:02:23 +00:00
pixmapLabel_cardBoard0->setGeometry(QRect(6, 64, 79, 114));
2007-01-28 01:28:19 +00:00
2007-03-26 00:12:35 +00:00
pixmapLabel_cardBoard1 = new MyCardsPixmapLabel(frame_Board);
2007-03-27 16:02:23 +00:00
pixmapLabel_cardBoard1->setObjectName(QString::fromUtf8("pixmapLabel_BoardCard1"));
pixmapLabel_cardBoard1->setScaledContents(true);
pixmapLabel_cardBoard1->setGeometry(QRect(95, 64, 79, 114));
2007-01-28 01:28:19 +00:00
2007-03-26 00:12:35 +00:00
pixmapLabel_cardBoard2 = new MyCardsPixmapLabel(frame_Board);
2007-03-27 16:02:23 +00:00
pixmapLabel_cardBoard2->setObjectName(QString::fromUtf8("pixmapLabel_BoardCard2"));
pixmapLabel_cardBoard2->setScaledContents(true);
pixmapLabel_cardBoard2->setGeometry(QRect(184, 64, 79, 114));
2007-01-28 01:28:19 +00:00
2007-03-26 00:12:35 +00:00
pixmapLabel_cardBoard3 = new MyCardsPixmapLabel(frame_Board);
2007-03-27 16:02:23 +00:00
pixmapLabel_cardBoard3->setObjectName(QString::fromUtf8("pixmapLabel_BoardCard3"));
pixmapLabel_cardBoard3->setScaledContents(true);
pixmapLabel_cardBoard3->setGeometry(QRect(280, 64, 79, 114));
2007-01-28 01:28:19 +00:00
2007-03-26 00:12:35 +00:00
pixmapLabel_cardBoard4 = new MyCardsPixmapLabel(frame_Board);
2007-03-27 16:02:23 +00:00
pixmapLabel_cardBoard4->setObjectName(QString::fromUtf8("pixmapLabel_BoardCard4"));
pixmapLabel_cardBoard4->setScaledContents(true);
pixmapLabel_cardBoard4->setGeometry(QRect(376, 64, 79, 114));
2007-01-28 01:28:19 +00:00
2007-03-26 00:12:35 +00:00
pixmapLabel_card0a = new MyCardsPixmapLabel(frame_Cards0);
pixmapLabel_card0a->setObjectName(QString::fromUtf8("pixmapLabel_card0a"));
2007-01-28 01:28:19 +00:00
pixmapLabel_card0a->setScaledContents(true);
2007-03-26 00:12:35 +00:00
pixmapLabel_card0a->setGeometry(QRect(0, 0, 80, 111));
2007-03-30 12:44:16 +00:00
// pixmapLabel_card0a->setFocusPolicy(Qt::NoFocus);
2007-03-26 00:12:35 +00:00
pixmapLabel_card0b = new MyCardsPixmapLabel(frame_Cards0);
pixmapLabel_card0b->setObjectName(QString::fromUtf8("pixmapLabel_card0b"));
2007-01-28 01:28:19 +00:00
pixmapLabel_card0b->setScaledContents(true);
2007-03-26 00:12:35 +00:00
pixmapLabel_card0b->setGeometry(QRect(39, 0, 80, 111));
2007-01-28 01:28:19 +00:00
2007-08-19 12:33:24 +00:00
pixmapLabel_card0b->setMyW(this);
pixmapLabel_card0a->setMyW(this);
2007-03-26 00:12:35 +00:00
pixmapLabel_card1a = new MyCardsPixmapLabel(frame_Cards1);
2007-01-28 01:28:19 +00:00
pixmapLabel_card1a->setObjectName(QString::fromUtf8("pixmapLabel_card1a"));
2007-02-01 22:45:32 +00:00
pixmapLabel_card1a->setScaledContents(true);
2007-03-26 00:12:35 +00:00
pixmapLabel_card1a->setGeometry(QRect(0, 0, 80, 111));
2007-01-28 01:28:19 +00:00
2007-03-26 00:12:35 +00:00
pixmapLabel_card1b = new MyCardsPixmapLabel(frame_Cards1);
2007-01-28 01:28:19 +00:00
pixmapLabel_card1b->setObjectName(QString::fromUtf8("pixmapLabel_card1b"));
2007-02-01 22:45:32 +00:00
pixmapLabel_card1b->setScaledContents(true);
2007-03-26 00:12:35 +00:00
pixmapLabel_card1b->setGeometry(QRect(39, 0, 80, 111));
2007-01-28 01:28:19 +00:00
2007-03-26 00:12:35 +00:00
pixmapLabel_card2a = new MyCardsPixmapLabel(frame_Cards2);
2007-01-28 01:28:19 +00:00
pixmapLabel_card2a->setObjectName(QString::fromUtf8("pixmapLabel_card2a"));
2007-02-01 23:46:34 +00:00
pixmapLabel_card2a->setScaledContents(true);
2007-03-26 00:12:35 +00:00
pixmapLabel_card2a->setGeometry(QRect(0, 0, 80, 111));
2007-01-28 01:28:19 +00:00
2007-03-26 00:12:35 +00:00
pixmapLabel_card2b = new MyCardsPixmapLabel(frame_Cards2);
2007-01-28 01:28:19 +00:00
pixmapLabel_card2b->setObjectName(QString::fromUtf8("pixmapLabel_card2b"));
2007-02-01 23:46:34 +00:00
pixmapLabel_card2b->setScaledContents(true);
2007-03-26 00:12:35 +00:00
pixmapLabel_card2b->setGeometry(QRect(39, 0, 80, 111));
2007-01-28 01:28:19 +00:00
2007-03-26 00:12:35 +00:00
pixmapLabel_card3a = new MyCardsPixmapLabel(frame_Cards3);
2007-01-28 01:28:19 +00:00
pixmapLabel_card3a->setObjectName(QString::fromUtf8("pixmapLabel_card3a"));
2007-02-01 23:46:34 +00:00
pixmapLabel_card3a->setScaledContents(true);
2007-03-26 00:12:35 +00:00
pixmapLabel_card3a->setGeometry(QRect(0, 0, 80, 111));
2007-01-28 01:28:19 +00:00
2007-03-26 00:12:35 +00:00
pixmapLabel_card3b = new MyCardsPixmapLabel(frame_Cards3);
2007-01-28 01:28:19 +00:00
pixmapLabel_card3b->setObjectName(QString::fromUtf8("pixmapLabel_card3b"));
2007-02-01 23:46:34 +00:00
pixmapLabel_card3b->setScaledContents(true);
2007-03-26 00:12:35 +00:00
pixmapLabel_card3b->setGeometry(QRect(39, 0, 80, 111));
2007-01-28 01:28:19 +00:00
2007-03-26 00:12:35 +00:00
pixmapLabel_card4a = new MyCardsPixmapLabel(frame_Cards4);
2007-01-28 01:28:19 +00:00
pixmapLabel_card4a->setObjectName(QString::fromUtf8("pixmapLabel_card4a"));
2007-02-01 23:46:34 +00:00
pixmapLabel_card4a->setScaledContents(true);
2007-03-26 00:12:35 +00:00
pixmapLabel_card4a->setGeometry(QRect(0, 0, 80, 111));
2007-01-28 01:28:19 +00:00
2007-03-26 00:12:35 +00:00
pixmapLabel_card4b = new MyCardsPixmapLabel(frame_Cards4);
2007-01-28 01:28:19 +00:00
pixmapLabel_card4b->setObjectName(QString::fromUtf8("pixmapLabel_card4b"));
2007-02-01 23:46:34 +00:00
pixmapLabel_card4b->setScaledContents(true);
2007-03-26 00:12:35 +00:00
pixmapLabel_card4b->setGeometry(QRect(39, 0, 80, 111));
pixmapLabel_card5a = new MyCardsPixmapLabel(frame_Cards5);
pixmapLabel_card5a->setObjectName(QString::fromUtf8("pixmapLabel_card5a"));
pixmapLabel_card5a->setScaledContents(true);
pixmapLabel_card5a->setGeometry(QRect(0, 0, 80, 111));
pixmapLabel_card5b = new MyCardsPixmapLabel(frame_Cards5);
pixmapLabel_card5b->setObjectName(QString::fromUtf8("pixmapLabel_card5b"));
pixmapLabel_card5b->setScaledContents(true);
pixmapLabel_card5b->setGeometry(QRect(39, 0, 80, 111));
pixmapLabel_card6a = new MyCardsPixmapLabel(frame_Cards6);
pixmapLabel_card6a->setObjectName(QString::fromUtf8("pixmapLabel_card6a"));
pixmapLabel_card6a->setScaledContents(true);
pixmapLabel_card6a->setGeometry(QRect(0, 0, 80, 111));
pixmapLabel_card6b = new MyCardsPixmapLabel(frame_Cards6);
pixmapLabel_card6b->setObjectName(QString::fromUtf8("pixmapLabel_card6b"));
pixmapLabel_card6b->setScaledContents(true);
pixmapLabel_card6b->setGeometry(QRect(39, 0, 80, 111));
2007-01-28 01:28:19 +00:00
2007-01-28 23:33:48 +00:00
//Flipside festlegen;
flipside = new QPixmap(myAppDataPath +"gfx/cards/default/flipside.png");
2007-01-28 23:33:48 +00:00
2007-02-03 22:47:16 +00:00
if (myConfig->readConfigInt("FlipsideOwn") && myConfig->readConfigString("FlipsideOwnFile") != "") {
2007-04-03 10:55:16 +00:00
QPixmap tmpFlipside(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str()));
2007-08-27 12:30:00 +00:00
flipside = new QPixmap(tmpFlipside.scaled(QSize(80, 111),Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
2007-01-28 23:33:48 +00:00
}
else { flipside->load(myAppDataPath +"gfx/cards/default/flipside.png"); }
2007-01-28 01:28:19 +00:00
//Flipside Animation noch nicht erledigt
flipHolecardsAllInAlreadyDone = FALSE;
2007-02-20 00:05:09 +00:00
//Toolboxen verstecken?
if (!myConfig->readConfigInt("ShowRightToolBox")) {
2007-04-03 22:36:17 +00:00
groupBox_RightToolBox->hide();
2007-02-20 00:05:09 +00:00
}
if (!myConfig->readConfigInt("ShowLeftToolBox")) {
2007-03-29 22:58:04 +00:00
groupBox_LeftToolBox->hide();
2007-02-20 00:05:09 +00:00
}
2007-02-01 02:18:59 +00:00
//Intro abspielen?
2007-02-03 22:47:16 +00:00
if (myConfig->readConfigInt("ShowIntro")) {
2007-02-20 00:05:09 +00:00
// label_logo->hide();
2007-01-27 14:19:50 +00:00
QTimer::singleShot(100, this, SLOT( paintStartSplash() )); }
2007-03-28 10:21:51 +00:00
2007-01-13 02:40:33 +00:00
// userWidgetsArray init
2007-03-28 10:21:51 +00:00
userWidgetsArray[0] = pushButton_BetRaise;
userWidgetsArray[1] = pushButton_CallCheckSet;
userWidgetsArray[2] = pushButton_FoldAllin;
userWidgetsArray[3] = spinBox_set;
userWidgetsArray[4] = horizontalSlider_bet;
2007-01-13 02:40:33 +00:00
2007-03-28 10:21:51 +00:00
//hide userWidgets
for(i=0; i<5; i++) {
2007-03-28 10:21:51 +00:00
userWidgetsArray[i]->hide();
2007-01-13 02:40:33 +00:00
}
2007-01-27 09:08:55 +00:00
//Timer Objekt erstellen
2007-01-23 19:20:18 +00:00
dealFlopCards0Timer = new QTimer(this);
dealFlopCards1Timer = new QTimer(this);
dealFlopCards2Timer = new QTimer(this);
dealFlopCards3Timer = new QTimer(this);
dealFlopCards4Timer = new QTimer(this);
dealFlopCards5Timer = new QTimer(this);
dealFlopCards6Timer = new QTimer(this);
dealTurnCards0Timer = new QTimer(this);
dealTurnCards1Timer = new QTimer(this);
dealTurnCards2Timer = new QTimer(this);
dealRiverCards0Timer = new QTimer(this);
dealRiverCards1Timer = new QTimer(this);
dealRiverCards2Timer = new QTimer(this);
nextPlayerAnimationTimer = new QTimer(this);
preflopAnimation1Timer = new QTimer(this);
preflopAnimation2Timer = new QTimer(this);
flopAnimation1Timer = new QTimer(this);
flopAnimation2Timer = new QTimer(this);
turnAnimation1Timer = new QTimer(this);
turnAnimation2Timer = new QTimer(this);
riverAnimation1Timer = new QTimer(this);
riverAnimation2Timer = new QTimer(this);
postRiverAnimation1Timer = new QTimer(this);
postRiverRunAnimation1Timer = new QTimer(this);
postRiverRunAnimation2Timer = new QTimer(this);
2007-08-11 14:36:20 +00:00
postRiverRunAnimation2_flipHoleCards1Timer = new QTimer(this);
postRiverRunAnimation2_flipHoleCards2Timer = new QTimer(this);
2007-01-23 19:20:18 +00:00
postRiverRunAnimation3Timer = new QTimer(this);
postRiverRunAnimation5Timer = new QTimer(this);
2007-01-13 02:40:33 +00:00
potDistributeTimer = new QTimer(this);
2007-01-23 19:20:18 +00:00
postRiverRunAnimation6Timer = new QTimer(this);
2007-05-01 22:51:10 +00:00
blinkingStartButtonAnimationTimer = new QTimer(this);
2007-01-23 19:20:18 +00:00
dealFlopCards0Timer->setSingleShot(TRUE);
dealFlopCards1Timer->setSingleShot(TRUE);
dealFlopCards2Timer->setSingleShot(TRUE);
dealFlopCards3Timer->setSingleShot(TRUE);
dealFlopCards4Timer->setSingleShot(TRUE);
dealFlopCards5Timer->setSingleShot(TRUE);
dealFlopCards6Timer->setSingleShot(TRUE);
dealTurnCards0Timer->setSingleShot(TRUE);
dealTurnCards1Timer->setSingleShot(TRUE);
dealTurnCards2Timer->setSingleShot(TRUE);
dealRiverCards0Timer->setSingleShot(TRUE);
dealRiverCards1Timer->setSingleShot(TRUE);
dealRiverCards2Timer->setSingleShot(TRUE);
nextPlayerAnimationTimer->setSingleShot(TRUE);
preflopAnimation1Timer->setSingleShot(TRUE);
preflopAnimation2Timer->setSingleShot(TRUE);
flopAnimation1Timer->setSingleShot(TRUE);
flopAnimation2Timer->setSingleShot(TRUE);
turnAnimation1Timer->setSingleShot(TRUE);
turnAnimation2Timer->setSingleShot(TRUE);
riverAnimation1Timer->setSingleShot(TRUE);
riverAnimation2Timer->setSingleShot(TRUE);
postRiverAnimation1Timer->setSingleShot(TRUE);
postRiverRunAnimation1Timer->setSingleShot(TRUE);
postRiverRunAnimation2Timer->setSingleShot(TRUE);
2007-08-11 14:36:20 +00:00
postRiverRunAnimation2_flipHoleCards1Timer->setSingleShot(TRUE);
postRiverRunAnimation2_flipHoleCards2Timer->setSingleShot(TRUE);
2007-01-23 19:20:18 +00:00
postRiverRunAnimation3Timer->setSingleShot(TRUE);
postRiverRunAnimation5Timer->setSingleShot(TRUE);
postRiverRunAnimation6Timer->setSingleShot(TRUE);
2007-01-13 02:40:33 +00:00
// buttonLabelArray init
buttonLabelArray[0] = textLabel_Button0;
buttonLabelArray[1] = textLabel_Button1;
buttonLabelArray[2] = textLabel_Button2;
buttonLabelArray[3] = textLabel_Button3;
buttonLabelArray[4] = textLabel_Button4;
2007-03-26 00:12:35 +00:00
buttonLabelArray[5] = textLabel_Button5;
buttonLabelArray[6] = textLabel_Button6;
2007-01-13 02:40:33 +00:00
// cashLabelArray init
cashLabelArray[0] = textLabel_Cash0;
cashLabelArray[1] = textLabel_Cash1;
cashLabelArray[2] = textLabel_Cash2;
cashLabelArray[3] = textLabel_Cash3;
cashLabelArray[4] = textLabel_Cash4;
2007-03-26 00:12:35 +00:00
cashLabelArray[5] = textLabel_Cash5;
cashLabelArray[6] = textLabel_Cash6;
2007-01-13 02:40:33 +00:00
// cashTopLabelArray init
cashTopLabelArray[0] = textLabel_TopCash0;
cashTopLabelArray[1] = textLabel_TopCash1;
cashTopLabelArray[2] = textLabel_TopCash2;
cashTopLabelArray[3] = textLabel_TopCash3;
cashTopLabelArray[4] = textLabel_TopCash4;
2007-03-26 00:12:35 +00:00
cashTopLabelArray[5] = textLabel_TopCash5;
cashTopLabelArray[6] = textLabel_TopCash6;
2007-03-27 16:02:23 +00:00
// playerNameLabelArray init
2007-03-26 00:12:35 +00:00
playerNameLabelArray[0] = label_PlayerName0;
playerNameLabelArray[1] = label_PlayerName1;
playerNameLabelArray[2] = label_PlayerName2;
playerNameLabelArray[3] = label_PlayerName3;
playerNameLabelArray[4] = label_PlayerName4;
playerNameLabelArray[5] = label_PlayerName5;
playerNameLabelArray[6] = label_PlayerName6;
2007-01-13 02:40:33 +00:00
2007-03-27 16:02:23 +00:00
// playerAvatarLabelArray init
playerAvatarLabelArray[0] = label_Avatar0;
playerAvatarLabelArray[1] = label_Avatar1;
playerAvatarLabelArray[2] = label_Avatar2;
playerAvatarLabelArray[3] = label_Avatar3;
playerAvatarLabelArray[4] = label_Avatar4;
playerAvatarLabelArray[5] = label_Avatar5;
playerAvatarLabelArray[6] = label_Avatar6;
2007-01-13 02:40:33 +00:00
// setLabelArray init
setLabelArray[0] = textLabel_Set0;
setLabelArray[1] = textLabel_Set1;
setLabelArray[2] = textLabel_Set2;
setLabelArray[3] = textLabel_Set3;
setLabelArray[4] = textLabel_Set4;
2007-03-26 00:12:35 +00:00
setLabelArray[5] = textLabel_Set5;
setLabelArray[6] = textLabel_Set6;
2007-05-30 07:21:24 +00:00
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { setLabelArray[i]->setMyW(this); }
2007-01-13 02:40:33 +00:00
// statusLabelArray init
actionLabelArray[0] = textLabel_Status0;
actionLabelArray[1] = textLabel_Status1;
actionLabelArray[2] = textLabel_Status2;
actionLabelArray[3] = textLabel_Status3;
actionLabelArray[4] = textLabel_Status4;
2007-03-26 00:12:35 +00:00
actionLabelArray[5] = textLabel_Status5;
actionLabelArray[6] = textLabel_Status6;
2007-01-13 02:40:33 +00:00
2007-08-19 12:33:24 +00:00
textLabel_Status0->setMyW(this);
2007-01-13 02:40:33 +00:00
// GroupBoxArray init
groupBoxArray[0] = groupBox0;
groupBoxArray[1] = groupBox1;
groupBoxArray[2] = groupBox2;
groupBoxArray[3] = groupBox3;
groupBoxArray[4] = groupBox4;
2007-03-26 00:12:35 +00:00
groupBoxArray[5] = groupBox5;
groupBoxArray[6] = groupBox6;
2007-01-13 02:40:33 +00:00
// boardCardsArray init
boardCardsArray[0] = pixmapLabel_cardBoard0;
boardCardsArray[1] = pixmapLabel_cardBoard1;
boardCardsArray[2] = pixmapLabel_cardBoard2;
boardCardsArray[3] = pixmapLabel_cardBoard3;
boardCardsArray[4] = pixmapLabel_cardBoard4;
// holeCardsArray int
holeCardsArray[0][0] = pixmapLabel_card0a;
holeCardsArray[0][1] = pixmapLabel_card0b;
holeCardsArray[1][0] = pixmapLabel_card1a;
holeCardsArray[1][1] = pixmapLabel_card1b;
holeCardsArray[2][0] = pixmapLabel_card2a;
holeCardsArray[2][1] = pixmapLabel_card2b;
holeCardsArray[3][0] = pixmapLabel_card3a;
holeCardsArray[3][1] = pixmapLabel_card3b;
holeCardsArray[4][0] = pixmapLabel_card4a;
holeCardsArray[4][1] = pixmapLabel_card4b;
2007-03-26 00:12:35 +00:00
holeCardsArray[5][0] = pixmapLabel_card5a;
holeCardsArray[5][1] = pixmapLabel_card5b;
holeCardsArray[6][0] = pixmapLabel_card6a;
holeCardsArray[6][1] = pixmapLabel_card6b;
2007-01-13 02:40:33 +00:00
// Farben initalisieren
active.setRgb(86,170,86);
inactive.setRgb(83,141,107);
highlight.setRgb(151,214,109);
2007-09-03 00:26:38 +00:00
// Schriftart laden und für Dialoge setzen
#ifdef _WIN32
font1String = "font-family: \"Arial\";";
2007-09-03 00:26:38 +00:00
// if(this->logicalDpiX() > 105) { tmpFont.setFont("Arial",8); }
// else { QFont tmpFont("Arial",9); }
#else
font1String = "font-family: \"Nimbus Sans L\";";
2007-09-03 00:26:38 +00:00
#endif
font2String = "font-family: \"Bitstream Vera Sans\";";
2007-03-27 16:02:23 +00:00
//Schriftart und Schriftgrößen für Widgets festlegen
#ifdef _WIN32
2007-09-06 19:02:03 +00:00
textBrowser_Log->setStyleSheet("QTextBrowser { "+ font1String +" font-size: 11px; color: #F0F0F0; background-color: #1D3B00; border:none; }");
2007-03-27 16:02:23 +00:00
#else
2007-09-06 19:02:03 +00:00
textBrowser_Log->setStyleSheet("QTextBrowser { "+ font1String +" font-size: 10px; color: #F0F0F0; background-color: #1D3B00; border:none; }");
2007-09-17 23:06:10 +00:00
// QScrollBar *myLogScrollBar = textBrowser_Log->verticalScrollBar();
// myLogScrollBar->setStyleSheet("QScrollBar { border: 2px solid grey; background: #32CC99; height: 15px; margin: 0px 20px 0 20px;} QScrollBar::handle { background: white; min-width: 20px;} QScrollBar::add-line { border: 2px solid grey; background: #32CC99; width: 20px; subcontrol-position: right; subcontrol-origin: margin; } QScrollBar::sub-line {border: 2px solid grey; background: #32CC99; width: 20px; subcontrol-position: left; subcontrol-origin: margin;}");
// textBrowser_Log->setVerticalScrollBar(myLogScrollBar);
// textBrowser_Log->verticalScrollBar()->setAutoFillBackground ( TRUE );
2007-10-16 20:34:20 +00:00
#endif
2007-09-06 19:02:03 +00:00
textBrowser_Chat->setStyleSheet("QTextBrowser { "+ font1String +" font-size: 10px; color: #F0F0F0; background-color: #1D3B00; border:none; }");
lineEdit_ChatInput->setStyleSheet("QLineEdit { "+ font1String +" font-size: 10px; color: #F0F0F0; background-color: #1D3B00; border-top: 2px solid #286400; }");
2007-10-16 20:34:20 +00:00
2007-09-02 07:58:30 +00:00
#ifdef __APPLE__
2007-09-03 00:26:38 +00:00
// tabWidget_Right->setStyleSheet("QTabWidget { "+ font1String +" font-size: 11px; background-color: #145300; }");
// tabWidget_Left->setStyleSheet("QTabWidget { "+ font1String +" font-size: 11px; background-color: #145300;}");
2007-09-02 07:58:30 +00:00
#else
2007-09-03 00:26:38 +00:00
// tabWidget_Right->setStyleSheet("QTabWidget::pane { "+ font1String +" font-size: 10px; background-color: #145300; border: 1px solid #286400; border-radius: 2px; }");
// tabWidget_Left->setStyleSheet("QTabWidget::pane { border: 1px solid #286400; border-radius: 2px; background-color: #145300; }");
2007-09-02 07:58:30 +00:00
#endif
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
2007-03-27 16:02:23 +00:00
2007-09-06 22:32:15 +00:00
cashTopLabelArray[i]->setStyleSheet("QLabel { "+ font2String +" font-size: 10px; font-weight: bold; color: #F0F0F0; }");
cashLabelArray[i]->setStyleSheet("QLabel { "+ font2String +" font-size: 10px; font-weight: bold; color: #F0F0F0; }");
2007-03-27 16:02:23 +00:00
}
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
2007-03-27 16:02:23 +00:00
2007-09-06 22:32:15 +00:00
setLabelArray[i]->setStyleSheet("QLabel { "+ font2String +" font-size: 12px; font-weight: bold; color: #F0F0F0; }");
2007-03-27 16:02:23 +00:00
}
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
2007-03-27 16:02:23 +00:00
2007-09-06 22:32:15 +00:00
playerNameLabelArray[i]->setStyleSheet("QLabel { "+ font2String +" font-size: 13px; font-weight: bold; color: #F0F0F0; }");
2007-03-27 16:02:23 +00:00
}
2007-09-06 22:32:15 +00:00
label_Sets->setStyleSheet("QLabel { "+ font2String +" font-size: 13px; font-weight: bold; color: #669900; }");
label_Total->setStyleSheet("QLabel { "+ font2String +" font-size: 13px; font-weight: bold; color: #669900; }");
textLabel_Sets->setStyleSheet("QLabel { "+ font2String +" font-size: 13px; font-weight: bold; color: #669900; }");
textLabel_Pot->setStyleSheet("QLabel { "+ font2String +" font-size: 13px; font-weight: bold; color: #669900; }");
label_handNumber->setStyleSheet("QLabel { "+ font2String +" font-size: 13px; font-weight: bold; color: #669900; }");
label_gameNumber->setStyleSheet("QLabel { "+ font2String +" font-size: 13px; font-weight: bold; color: #669900; }");
label_handNumberValue->setStyleSheet("QLabel { "+ font2String +" font-size: 13px; font-weight: bold; color: #669900; }");
label_gameNumberValue->setStyleSheet("QLabel { "+ font2String +" font-size: 13px; font-weight: bold; color: #669900; }");
2007-03-27 16:02:23 +00:00
2007-09-06 19:02:03 +00:00
textLabel_handLabel->setStyleSheet("QLabel { "+ font2String +" font-size: 17px; font-weight: bold; color: #669900; }");
2007-03-27 16:02:23 +00:00
2007-09-06 19:02:03 +00:00
label_Pot->setStyleSheet("QLabel { "+ font2String +" font-size: 18px; font-weight: bold; color: #669900; }");
2007-06-24 21:44:21 +00:00
2007-08-29 21:10:33 +00:00
//Widgets Grafiken setzen
label_CardHolder0->setPixmap(myAppDataPath + "gfx/gui/table/default/cardholder_flop.png");
label_CardHolder1->setPixmap(myAppDataPath + "gfx/gui/table/default/cardholder_flop.png");
label_CardHolder2->setPixmap(myAppDataPath + "gfx/gui/table/default/cardholder_flop.png");
label_CardHolder3->setPixmap(myAppDataPath + "gfx/gui/table/default/cardholder_turn.png");
label_CardHolder4->setPixmap(myAppDataPath + "gfx/gui/table/default/cardholder_river.png");
2007-08-29 21:10:33 +00:00
label_Handranking->setPixmap(myAppDataPath + "gfx/gui/misc/handRanking.png");
2007-08-29 21:10:33 +00:00
2007-03-27 16:02:23 +00:00
//Widgets Grafiken per Stylesheets setzen
this->setStyleSheet("QMainWindow { background-image: url(" + myAppDataPath +"gfx/gui/table/default/table.png); background-position: bottom center; background-origin: content;}");
2007-08-29 21:10:33 +00:00
2007-09-03 00:26:38 +00:00
menubar->setStyleSheet("QMenuBar { background-color: #145300; } QMenuBar::item { color: #669800; }");
pushButton_break->setStyleSheet("QPushButton { background-color: #145300; color: white;}");
2007-09-03 01:09:22 +00:00
// horizontalSlider_speed->setStyleSheet("QSlider::groove:horizontal { border: 1px solid #286400; height: 3px; background: #689700; } QSlider::handle:horizontal { background: #689700; border: 1px solid #286400; width: 10px; margin: -8px 0; border-radius: 3px; }");
statusbar->setStyleSheet(" QStatusBar { "+ font1String +" font-size: 12px; color: white; }");
2007-09-03 00:26:38 +00:00
2007-08-29 21:10:33 +00:00
//Groupbox Background
for (i=1; i<MAX_NUMBER_OF_PLAYERS; i++) {
2007-03-27 16:02:23 +00:00
groupBoxArray[i]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxInactiveGlow.png) }");
2007-03-27 16:02:23 +00:00
}
groupBoxArray[0]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxInactiveGlow_0.6.png) }");
2007-03-28 10:21:51 +00:00
//Human player button
pushButton_BetRaise->setStyleSheet("QPushButton { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playeraction_03_0.6.png); "+ font2String +" font-size: 11px; font-weight: bold; color: #F0F0F0; QPushButton }");
pushButton_CallCheckSet->setStyleSheet("QPushButton { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playeraction_05_0.6.png); "+ font2String +" font-size: 11px; font-weight: bold; color: #F0F0F0; }");
pushButton_FoldAllin->setStyleSheet("QPushButton { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playeraction_07_0.6.png); "+ font2String +" font-size: 11px; font-weight: bold; color: #F0F0F0; }");
2007-03-28 10:21:51 +00:00
spinBox_set->setStyleSheet("QSpinBox { "+ font2String +" font-size: 10px; font-weight: bold; background-color: #1D3B00; color: #F0F0F0; } QSpinBox:disabled { background-color: #316300; color: #6d7b5f }");
// away radiobuttons
QString radioButtonString("QRadioButton { color: #F0F0F0; } QRadioButton::indicator { width: 13px; height: 13px; } QRadioButton::indicator::checked { image: url("+myAppDataPath+"gfx/gui/misc/radiobutton_checked.png); }");
radioButton_manualAction->setStyleSheet(radioButtonString);
radioButton_autoCheckFold->setStyleSheet(radioButtonString);
radioButton_autoCheckCallAny->setStyleSheet(radioButtonString);
groupBox_RightToolBox->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/misc/toolboxFrameBG.png) }");
groupBox_LeftToolBox->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/misc/toolboxFrameBG.png) }");
2007-03-28 10:21:51 +00:00
2007-03-27 16:02:23 +00:00
2007-03-27 21:36:56 +00:00
//raise actionLable above just inserted mypixmaplabel
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { actionLabelArray[i]->raise(); }
2007-03-26 00:12:35 +00:00
2007-05-02 21:51:02 +00:00
//resize stop-button depending on translation
QFontMetrics tempMetrics = this->fontMetrics();
int width = tempMetrics.width(tr("Stop"));
pushButton_break->setMinimumSize(width+10,20);
2007-02-04 13:46:27 +00:00
2007-03-29 22:58:04 +00:00
//Clear Focus
groupBox_LeftToolBox->clearFocus();
2007-03-30 21:09:05 +00:00
//set Focus to mainwindow
this->setFocus();
2007-03-31 09:17:37 +00:00
//windowicon
2007-08-29 21:10:33 +00:00
// QString windowIconString();
this->setWindowIcon(QIcon(myAppDataPath+"gfx/gui/misc/windowicon.png"));
2007-03-31 09:17:37 +00:00
2007-02-10 21:52:05 +00:00
//Statusbar
2007-03-31 00:04:36 +00:00
if(myConfig->readConfigInt("ShowStatusbarMessages")) {
2007-04-30 23:14:30 +00:00
#ifdef __APPLE__
statusBar()->showMessage(tr("Cmd+N to start a new game"));
#else
statusBar()->showMessage(tr("Ctrl+N to start a new game"));
#endif
}
2007-02-10 21:52:05 +00:00
2007-02-18 21:06:21 +00:00
//Dialoge
2007-05-13 12:35:27 +00:00
myNewGameDialog = new newGameDialogImpl(this, myConfig);
2007-05-23 10:19:10 +00:00
mySelectAvatarDialog = new selectAvatarDialogImpl(this, myConfig);
mySettingsDialog = new settingsDialogImpl(this, myConfig, mySelectAvatarDialog);
2007-05-28 19:56:57 +00:00
myChangeHumanPlayerNameDialog = new changeHumanPlayerNameDialogImpl(this, myConfig);
2007-05-13 13:32:06 +00:00
myJoinNetworkGameDialog = new joinNetworkGameDialogImpl(this, myConfig);
2007-02-27 19:44:03 +00:00
myConnectToServerDialog = new connectToServerDialogImpl(this);
2007-06-05 21:56:33 +00:00
myStartNetworkGameDialog = new startNetworkGameDialogImpl(this, myConfig);
2007-05-13 13:32:06 +00:00
myCreateNetworkGameDialog = new createNetworkGameDialogImpl(this, myConfig);
myAboutPokerthDialog = new aboutPokerthImpl(this, myConfig);
2007-08-20 21:23:03 +00:00
myGameLobbyDialog = new gameLobbyDialogImpl(this, myConfig);
2007-10-12 18:45:28 +00:00
2007-08-08 12:54:20 +00:00
myStartNetworkGameDialog->setMyW(this);
2007-08-29 22:30:18 +00:00
myGameLobbyDialog->setMyW(this);
2007-08-08 12:54:20 +00:00
2007-10-12 18:45:28 +00:00
myChat = new Chat(this, myConfig);
2007-05-31 07:46:19 +00:00
// //ShortCuts
// QShortcut *quitPokerTHKeys = new QShortcut(QKeySequence(Qt::Key_Control + Qt::Key_Q), this);
// connect( quitPokerTHKeys, SIGNAL(activated() ), actionQuit, SLOT( trigger() ) );
lineEdit_ChatInput->installEventFilter(this);
this->installEventFilter(this);
2007-05-31 07:46:19 +00:00
2007-01-23 23:53:12 +00:00
//Connects
connect(dealFlopCards0Timer, SIGNAL(timeout()), this, SLOT( dealFlopCards1() ));
connect(dealFlopCards1Timer, SIGNAL(timeout()), this, SLOT( dealFlopCards2() ));
connect(dealFlopCards2Timer, SIGNAL(timeout()), this, SLOT( dealFlopCards3() ));
connect(dealFlopCards3Timer, SIGNAL(timeout()), this, SLOT( dealFlopCards4() ));
connect(dealFlopCards4Timer, SIGNAL(timeout()), this, SLOT( dealFlopCards5() ));
connect(dealFlopCards5Timer, SIGNAL(timeout()), this, SLOT( dealFlopCards6() ));
connect(dealFlopCards6Timer, SIGNAL(timeout()), this, SLOT( handSwitchRounds() ));
connect(dealTurnCards0Timer, SIGNAL(timeout()), this, SLOT( dealTurnCards1() ));
connect(dealTurnCards1Timer, SIGNAL(timeout()), this, SLOT( dealTurnCards2() ));
connect(dealTurnCards2Timer, SIGNAL(timeout()), this, SLOT( handSwitchRounds() ));
connect(dealRiverCards0Timer, SIGNAL(timeout()), this, SLOT( dealRiverCards1() ));
connect(dealRiverCards1Timer, SIGNAL(timeout()), this, SLOT( dealRiverCards2() ));
connect(dealRiverCards2Timer, SIGNAL(timeout()), this, SLOT( handSwitchRounds() ));
2007-01-13 02:40:33 +00:00
2007-01-23 23:53:12 +00:00
connect(nextPlayerAnimationTimer, SIGNAL(timeout()), this, SLOT( handSwitchRounds() ));
connect(preflopAnimation1Timer, SIGNAL(timeout()), this, SLOT( preflopAnimation1Action() ));
connect(preflopAnimation2Timer, SIGNAL(timeout()), this, SLOT( preflopAnimation2Action() ));
connect(flopAnimation1Timer, SIGNAL(timeout()), this, SLOT( flopAnimation1Action() ));
connect(flopAnimation2Timer, SIGNAL(timeout()), this, SLOT( flopAnimation2Action() ));
connect(turnAnimation1Timer, SIGNAL(timeout()), this, SLOT( turnAnimation1Action() ));
connect(turnAnimation2Timer, SIGNAL(timeout()), this, SLOT( turnAnimation2Action() ));
connect(riverAnimation1Timer, SIGNAL(timeout()), this, SLOT( riverAnimation1Action() ));
connect(riverAnimation2Timer, SIGNAL(timeout()), this, SLOT( riverAnimation2Action() ));
2007-01-23 19:20:18 +00:00
2007-01-23 23:53:12 +00:00
connect(postRiverAnimation1Timer, SIGNAL(timeout()), this, SLOT( postRiverAnimation1Action() ));
connect(postRiverRunAnimation1Timer, SIGNAL(timeout()), this, SLOT( postRiverRunAnimation2() ));
connect(postRiverRunAnimation2Timer, SIGNAL(timeout()), this, SLOT( postRiverRunAnimation3() ));
2007-08-11 14:36:20 +00:00
connect(postRiverRunAnimation2_flipHoleCards1Timer, SIGNAL(timeout()), this, SLOT( postRiverRunAnimation2_flipHoleCards1() ));
connect(postRiverRunAnimation2_flipHoleCards2Timer, SIGNAL(timeout()), this, SLOT( postRiverRunAnimation2_flipHoleCards2() ));
2007-01-23 23:53:12 +00:00
connect(postRiverRunAnimation3Timer, SIGNAL(timeout()), this, SLOT( postRiverRunAnimation4() ));
connect(potDistributeTimer, SIGNAL(timeout()), this, SLOT(postRiverRunAnimation5()));
connect(postRiverRunAnimation5Timer, SIGNAL(timeout()), this, SLOT( postRiverRunAnimation6() ));
connect(postRiverRunAnimation6Timer, SIGNAL(timeout()), this, SLOT( startNewHand() ));
2007-01-13 02:40:33 +00:00
2007-05-01 22:51:10 +00:00
connect(blinkingStartButtonAnimationTimer, SIGNAL(timeout()), this, SLOT( blinkingStartButtonAnimationAction()));
2007-02-01 19:04:18 +00:00
connect( actionNewGame, SIGNAL( triggered() ), this, SLOT( callNewGameDialog() ) );
connect( actionAboutPokerth, SIGNAL( triggered() ), this, SLOT( callAboutPokerthDialog() ) );
connect( actionSettings, SIGNAL( triggered() ), this, SLOT( callSettingsDialog() ) );
2007-02-15 00:57:04 +00:00
connect( actionJoin_network_Game, SIGNAL( triggered() ), this, SLOT( callJoinNetworkGameDialog() ) );
connect( actionCreate_network_Game, SIGNAL( triggered() ), this, SLOT( callCreateNetworkGameDialog() ) );
2007-08-20 21:23:03 +00:00
connect( actionInternet_Game, SIGNAL( triggered() ), this, SLOT( callGameLobbyDialog() ) );
2007-05-30 22:03:40 +00:00
connect( actionQuit, SIGNAL( triggered() ), this, SLOT( quitPokerTH() ) );
2007-02-27 19:44:03 +00:00
connect( actionFullScreen, SIGNAL( triggered() ), this, SLOT( switchFullscreen() ) );
connect( actionShowHideChat, SIGNAL( triggered() ), this, SLOT( switchChatWindow() ) );
connect( actionShowHideHelp, SIGNAL( triggered() ), this, SLOT( switchHelpWindow() ) );
connect( actionShowHideLog, SIGNAL( triggered() ), this, SLOT( switchLogWindow() ) );
2007-02-15 00:57:04 +00:00
connect( pushButton_BetRaise, SIGNAL( clicked() ), this, SLOT( mySet() ) );
2007-03-28 10:21:51 +00:00
connect( pushButton_FoldAllin, SIGNAL( clicked() ), this, SLOT( myFoldAllin() ) );
connect( pushButton_CallCheckSet, SIGNAL( clicked() ), this, SLOT( myCallCheckSet() ) );
2007-01-14 14:08:45 +00:00
connect ( horizontalSlider_speed, SIGNAL( valueChanged(int)), this, SLOT ( setGameSpeed(int) ) );
2007-01-15 08:35:26 +00:00
connect ( pushButton_break, SIGNAL( clicked()), this, SLOT ( breakButtonClicked() ) ); // auch wieder starten!!!!
2007-01-24 19:48:52 +00:00
2007-05-28 13:13:48 +00:00
connect( tabWidget_Left, SIGNAL( currentChanged(int) ), this, SLOT( tabSwitchAction() ) );
2007-05-25 00:09:51 +00:00
connect( lineEdit_ChatInput, SIGNAL( returnPressed () ), this, SLOT( sendChatMessage() ) );
2007-05-25 17:57:03 +00:00
connect( lineEdit_ChatInput, SIGNAL( textChanged (QString) ), this, SLOT( checkChatInputLength(QString) ) );
2007-10-12 18:45:28 +00:00
connect( lineEdit_ChatInput, SIGNAL( textEdited (QString) ), myChat, SLOT( setChatTextEdited() ) );
2007-05-25 00:09:51 +00:00
connect( radioButton_manualAction, SIGNAL( clicked() ) , this, SLOT( changePlayingMode() ) );
connect( radioButton_autoCheckFold, SIGNAL( clicked() ) , this, SLOT( changePlayingMode() ) );
connect( radioButton_autoCheckCallAny, SIGNAL( clicked() ), this, SLOT( changePlayingMode() ) );
2007-02-18 21:06:21 +00:00
//Nachrichten Thread-Save
connect(this, SIGNAL(signalInitGui(int)), this, SLOT(initGui(int)));
connect(this, SIGNAL(signalShowClientDialog()), this, SLOT(showClientDialog()));
connect(this, SIGNAL(signalRefreshSet()), this, SLOT(refreshSet()));
connect(this, SIGNAL(signalRefreshCash()), this, SLOT(refreshCash()));
connect(this, SIGNAL(signalRefreshAction(int, int)), this, SLOT(refreshAction(int, int)));
connect(this, SIGNAL(signalRefreshChangePlayer()), this, SLOT(refreshChangePlayer()));
connect(this, SIGNAL(signalRefreshPot()), this, SLOT(refreshPot()));
connect(this, SIGNAL(signalRefreshGroupbox(int, int)), this, SLOT(refreshGroupbox(int, int)));
connect(this, SIGNAL(signalRefreshAll()), this, SLOT(refreshAll()));
connect(this, SIGNAL(signalRefreshPlayerName()), this, SLOT(refreshPlayerName()));
connect(this, SIGNAL(signalRefreshButton()), this, SLOT(refreshButton()));
connect(this, SIGNAL(signalRefreshGameLabels(int)), this, SLOT(refreshGameLabels(int)));
connect(this, SIGNAL(signalGuiUpdateDone()), this, SLOT(guiUpdateDone()));
connect(this, SIGNAL(signalMeInAction()), this, SLOT(meInAction()));
connect(this, SIGNAL(signalDisableMyButtons()), this, SLOT(disableMyButtons()));
connect(this, SIGNAL(signalStartTimeoutAnimation(int, int)), this, SLOT(startTimeoutAnimation(int, int)));
connect(this, SIGNAL(signalStopTimeoutAnimation(int)), this, SLOT(stopTimeoutAnimation(int)));
2007-08-07 00:05:29 +00:00
connect(this, SIGNAL(signalDealBeRoCards(int)), this, SLOT(dealBeRoCards(int)));
connect(this, SIGNAL(signalDealHoleCards()), this, SLOT(dealHoleCards()));
connect(this, SIGNAL(signalDealFlopCards0()), this, SLOT(dealFlopCards0()));
connect(this, SIGNAL(signalDealTurnCards0()), this, SLOT(dealTurnCards0()));
connect(this, SIGNAL(signalDealRiverCards0()), this, SLOT(dealRiverCards0()));
connect(this, SIGNAL(signalNextPlayerAnimation()), this, SLOT(nextPlayerAnimation()));
2007-08-07 13:07:39 +00:00
;
connect(this, SIGNAL(signalBeRoAnimation2(int)), this, SLOT(beRoAnimation2(int)));
connect(this, SIGNAL(signalPreflopAnimation1()), this, SLOT(preflopAnimation1()));
connect(this, SIGNAL(signalPreflopAnimation2()), this, SLOT(preflopAnimation2()));
connect(this, SIGNAL(signalFlopAnimation1()), this, SLOT(flopAnimation1()));
connect(this, SIGNAL(signalFlopAnimation2()), this, SLOT(flopAnimation2()));
connect(this, SIGNAL(signalTurnAnimation1()), this, SLOT(turnAnimation1()));
connect(this, SIGNAL(signalTurnAnimation2()), this, SLOT(turnAnimation2()));
connect(this, SIGNAL(signalRiverAnimation1()), this, SLOT(riverAnimation1()));
connect(this, SIGNAL(signalRiverAnimation2()), this, SLOT(riverAnimation2()));
connect(this, SIGNAL(signalPostRiverAnimation1()), this, SLOT(postRiverAnimation1()));
connect(this, SIGNAL(signalPostRiverRunAnimation1()), this, SLOT(postRiverRunAnimation1()));
connect(this, SIGNAL(signalFlipHolecardsAllIn()), this, SLOT(flipHolecardsAllIn()));
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(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(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(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)));
// Errors are handled globally, not within one dialog.
connect(this, SIGNAL(signalNetClientError(int, int)), this, SLOT(networkError(int, int)));
connect(this, SIGNAL(signalNetClientNotification(int)), this, SLOT(networkNotification(int)));
connect(this, SIGNAL(signalNetClientRemovedFromGame(int)), this, SLOT(networkNotification(int)));
2007-06-04 17:04:03 +00:00
connect(this, SIGNAL(signalNetServerError(int, int)), this, SLOT(networkError(int, int)));
connect(this, SIGNAL(signalNetClientGameStart(boost::shared_ptr<Game>)), this, SLOT(networkStart(boost::shared_ptr<Game>)));
2007-01-24 19:48:52 +00:00
2007-10-12 18:45:28 +00:00
//Chat Messages
connect(this, SIGNAL(signalNetClientChatMsg(QString, QString)), myChat, SLOT(receiveMessage(QString, QString)));
connect(this, SIGNAL(signalNetClientChatMsg(QString, QString)), myStartNetworkGameDialog, SLOT(receiveChatMsg(QString, QString)));
2007-10-12 18:45:28 +00:00
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)));
2007-06-01 22:49:37 +00:00
//Sound
2007-06-13 09:27:28 +00:00
mySDLPlayer = new SDLPlayer(myConfig);
2007-02-26 09:05:38 +00:00
2007-01-13 02:40:33 +00:00
}
2007-04-21 20:42:50 +00:00
mainWindowImpl::~mainWindowImpl() {
delete myConfig;
myConfig = 0;
2007-05-29 12:22:05 +00:00
2007-04-21 20:42:50 +00:00
}
2007-01-13 02:40:33 +00:00
void mainWindowImpl::callNewGameDialog() {
2007-01-19 02:03:30 +00:00
//wenn Dialogfenster gezeigt werden soll
2007-02-03 22:47:16 +00:00
if(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame")){
2007-01-13 02:40:33 +00:00
2007-05-13 12:35:27 +00:00
myNewGameDialog->exec();
if (myNewGameDialog->result() == QDialog::Accepted ) { startNewLocalGame(myNewGameDialog); }
2007-03-28 17:44:22 +00:00
// else { startNewLocalGame(); }
}
2007-01-19 02:03:30 +00:00
// sonst mit gespeicherten Werten starten
2007-03-21 00:41:29 +00:00
else { startNewLocalGame(); }
}
2007-03-21 00:41:29 +00:00
void mainWindowImpl::startNewLocalGame(newGameDialogImpl *v) {
2007-03-21 00:41:29 +00:00
// Start new local game - terminate existing network game.
mySession->terminateNetworkClient();
2007-05-14 12:40:42 +00:00
if (myServerGuiInterface.get())
myServerGuiInterface->getSession().terminateNetworkServer();
2007-03-21 00:41:29 +00:00
//get values from local game dialog
GameData gameData;
2007-03-21 00:41:29 +00:00
if(v) {
// Set Game Data
gameData.maxNumberOfPlayers = v->spinBox_quantityPlayers->value();
2007-05-23 22:31:56 +00:00
gameData.startMoney = v->spinBox_startCash->value();
2007-09-27 20:40:40 +00:00
gameData.firstSmallBlind = v->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value();
2007-09-28 05:23:13 +00:00
if(v->getChangeCompleteBlindsDialog()->radioButton_raiseBlindsAtHands->isChecked()) {
2007-09-29 19:23:14 +00:00
gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER;
2007-09-28 05:23:13 +00:00
gameData.raiseSmallBlindEveryHandsValue = v->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value();
}
else {
2007-09-29 19:23:14 +00:00
gameData.raiseIntervalMode = RAISE_ON_MINUTES;
2007-09-28 05:23:13 +00:00
gameData.raiseSmallBlindEveryMinutesValue = v->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryMinutes->value();
}
if(v->getChangeCompleteBlindsDialog()->radioButton_alwaysDoubleBlinds->isChecked()) {
gameData.raiseMode = DOUBLE_BLINDS;
}
else {
gameData.raiseMode = MANUAL_BLINDS_ORDER;
list<int> tempBlindList;
int i;
bool ok = TRUE;
for(i=0; i<v->getChangeCompleteBlindsDialog()->listWidget_blinds->count(); i++) {
tempBlindList.push_back(v->getChangeCompleteBlindsDialog()->listWidget_blinds->item(i)->text().toInt(&ok,10));
}
gameData.manualBlindsList = tempBlindList;
if(v->getChangeCompleteBlindsDialog()->radioButton_afterThisAlwaysDoubleBlinds->isChecked()) { gameData.afterManualBlindsMode = AFTERMB_DOUBLE_BLINDS; }
else {
if(v->getChangeCompleteBlindsDialog()->radioButton_afterThisAlwaysRaiseAbout->isChecked()) {
gameData.afterManualBlindsMode = AFTERMB_RAISE_ABOUT;
gameData.afterMBAlwaysRaiseValue = v->getChangeCompleteBlindsDialog()->spinBox_afterThisAlwaysRaiseValue->value();
}
else { gameData.afterManualBlindsMode = AFTERMB_STAY_AT_LAST_BLIND; }
}
}
2007-09-27 20:40:40 +00:00
2007-05-02 21:20:54 +00:00
//Speeds
gameData.guiSpeed = v->spinBox_gameSpeed->value();
2007-03-21 00:41:29 +00:00
}
// start with default values
else {
// Set Game Data
gameData.maxNumberOfPlayers = myConfig->readConfigInt("NumberOfPlayers");
2007-05-23 22:31:56 +00:00
gameData.startMoney = myConfig->readConfigInt("StartCash");
2007-09-28 05:23:13 +00:00
gameData.firstSmallBlind = myConfig->readConfigInt("FirstSmallBlind");
if(myConfig->readConfigInt("RaiseBlindsAtHands")) {
2007-09-29 19:23:14 +00:00
gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER;
2007-09-28 05:23:13 +00:00
gameData.raiseSmallBlindEveryHandsValue = myConfig->readConfigInt("RaiseSmallBlindEveryHands");
}
else {
2007-09-29 19:23:14 +00:00
gameData.raiseIntervalMode = RAISE_ON_MINUTES;
2007-09-28 05:23:13 +00:00
gameData.raiseSmallBlindEveryMinutesValue = myConfig->readConfigInt("RaiseSmallBlindEveryMinutes");
}
if(myConfig->readConfigInt("AlwaysDoubleBlinds")) {
gameData.raiseMode = DOUBLE_BLINDS;
}
else {
gameData.raiseMode = MANUAL_BLINDS_ORDER;
gameData.manualBlindsList = myConfig->readConfigIntList("ManualBlindsList");
if(myConfig->readConfigInt("AfterMBAlwaysDoubleBlinds")) { gameData.afterManualBlindsMode = AFTERMB_DOUBLE_BLINDS; }
else {
if(myConfig->readConfigInt("AfterMBAlwaysRaiseAbout")) {
gameData.afterManualBlindsMode = AFTERMB_RAISE_ABOUT;
gameData.afterMBAlwaysRaiseValue = myConfig->readConfigInt("AfterMBAlwaysRaiseValue");
}
else { gameData.afterManualBlindsMode = AFTERMB_STAY_AT_LAST_BLIND; }
}
}
2007-05-02 21:20:54 +00:00
//Speeds
gameData.guiSpeed = myConfig->readConfigInt("GameSpeed");
2007-01-22 22:25:58 +00:00
}
// Set dealer pos.
StartData startData;
int tmpDealerPos = 0;
startData.numberOfPlayers = gameData.maxNumberOfPlayers;
Tools::getRandNumber(0, startData.numberOfPlayers-1, 1, &tmpDealerPos, 0);
2007-08-31 13:09:07 +00:00
if(DEBUG_MODE) {
2007-10-05 12:04:38 +00:00
tmpDealerPos = 1;
2007-08-31 13:09:07 +00:00
}
startData.startDealerPlayerId = static_cast<unsigned>(tmpDealerPos);
2007-05-28 18:48:12 +00:00
//some gui modifications
localGameModification();
//Start Game!!!
mySession->startLocalGame(gameData, startData);
2007-01-13 02:40:33 +00:00
}
2007-03-21 00:41:29 +00:00
2007-05-13 12:35:27 +00:00
void mainWindowImpl::callAboutPokerthDialog() { myAboutPokerthDialog->exec(); }
2007-01-13 02:40:33 +00:00
void mainWindowImpl::callCreateNetworkGameDialog() {
myCreateNetworkGameDialog->exec();
//
if (myCreateNetworkGameDialog->result() == QDialog::Accepted ) {
// Stop local game.
stopTimer();
2007-05-14 12:40:42 +00:00
if (!myServerGuiInterface.get())
{
// Create pseudo Gui Wrapper for the server.
myServerGuiInterface.reset(new ServerGuiWrapper(myConfig, mySession->getGui(), mySession->getGui(), mySession->getGui()));
2007-05-14 12:40:42 +00:00
{
boost::shared_ptr<Session> session(new Session(myServerGuiInterface.get(), myConfig));
session->init(mySession->getAvatarManager());
2007-05-14 12:40:42 +00:00
myServerGuiInterface->setSession(session);
}
}
// Terminate existing network games.
mySession->terminateNetworkClient();
2007-05-14 12:40:42 +00:00
myServerGuiInterface->getSession().terminateNetworkServer();
GameData gameData;
gameData.maxNumberOfPlayers = myCreateNetworkGameDialog->spinBox_quantityPlayers->value();
2007-05-23 22:31:56 +00:00
gameData.startMoney = myCreateNetworkGameDialog->spinBox_startCash->value();
2007-09-28 05:23:13 +00:00
gameData.firstSmallBlind = myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->spinBox_firstSmallBlind->value();
if(myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->radioButton_raiseBlindsAtHands->isChecked()) {
2007-09-29 19:23:14 +00:00
gameData.raiseIntervalMode = RAISE_ON_HANDNUMBER;
2007-09-28 05:23:13 +00:00
gameData.raiseSmallBlindEveryHandsValue = myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryHands->value();
}
else {
2007-09-29 19:23:14 +00:00
gameData.raiseIntervalMode = RAISE_ON_MINUTES;
2007-09-28 05:23:13 +00:00
gameData.raiseSmallBlindEveryMinutesValue = myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->spinBox_raiseSmallBlindEveryMinutes->value();
}
if(myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->radioButton_alwaysDoubleBlinds->isChecked()) {
gameData.raiseMode = DOUBLE_BLINDS;
}
else {
gameData.raiseMode = MANUAL_BLINDS_ORDER;
list<int> tempBlindList;
int i;
bool ok = TRUE;
for(i=0; i<myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->listWidget_blinds->count(); i++) {
tempBlindList.push_back(myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->listWidget_blinds->item(i)->text().toInt(&ok,10));
}
gameData.manualBlindsList = tempBlindList;
if(myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->radioButton_afterThisAlwaysDoubleBlinds->isChecked()) { gameData.afterManualBlindsMode = AFTERMB_DOUBLE_BLINDS; }
else {
if(myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->radioButton_afterThisAlwaysRaiseAbout->isChecked()) {
gameData.afterManualBlindsMode = AFTERMB_RAISE_ABOUT;
gameData.afterMBAlwaysRaiseValue = myCreateNetworkGameDialog->getChangeCompleteBlindsDialog()->spinBox_afterThisAlwaysRaiseValue->value();
}
else { gameData.afterManualBlindsMode = AFTERMB_STAY_AT_LAST_BLIND; }
}
}
gameData.guiSpeed = myCreateNetworkGameDialog->spinBox_gameSpeed->value();
gameData.playerActionTimeoutSec = myCreateNetworkGameDialog->spinBox_netTimeOutPlayerAction->value();
2007-09-01 21:15:11 +00:00
myGameLobbyDialog->setSession(&getSession());
myStartNetworkGameDialog->setSession(&getSession());
2007-05-14 12:40:42 +00:00
// Clear network game dialog.
myStartNetworkGameDialog->clearDialog();
myServerGuiInterface->getSession().startNetworkServer();
mySession->startNetworkClientForLocalServer(gameData);
myStartNetworkGameDialog->setMaxPlayerNumber(gameData.maxNumberOfPlayers);
2007-05-02 21:51:02 +00:00
myStartNetworkGameDialog->setWindowTitle("Start Network Game");
showNetworkStartDialog();
}
}
2007-02-15 00:57:04 +00:00
void mainWindowImpl::callJoinNetworkGameDialog() {
2007-05-28 18:48:12 +00:00
2007-02-18 21:06:21 +00:00
myJoinNetworkGameDialog->exec();
2007-02-15 00:57:04 +00:00
if (myJoinNetworkGameDialog->result() == QDialog::Accepted ) {
// Stop local game.
stopTimer();
mySession->terminateNetworkClient();
2007-05-14 12:40:42 +00:00
if (myServerGuiInterface.get())
myServerGuiInterface->getSession().terminateNetworkServer();
2007-09-01 21:15:11 +00:00
myGameLobbyDialog->setSession(&getSession());
myStartNetworkGameDialog->setSession(&getSession());
// Clear network game dialog
myStartNetworkGameDialog->clearDialog();
// Maybe use QUrl::toPunycode.
mySession->startNetworkClient(
myJoinNetworkGameDialog->lineEdit_ipAddress->text().toUtf8().constData(),
myJoinNetworkGameDialog->spinBox_port->value(),
myJoinNetworkGameDialog->checkBox_ipv6->isChecked(),
2007-06-04 16:49:19 +00:00
myJoinNetworkGameDialog->checkBox_sctp->isChecked(),
myJoinNetworkGameDialog->lineEdit_password->text().toUtf8().constData());
2007-02-17 19:36:32 +00:00
//Dialog mit Statusbalken
2007-02-18 21:06:21 +00:00
myConnectToServerDialog->exec();
2007-02-17 19:36:32 +00:00
2007-02-18 21:06:21 +00:00
if (myConnectToServerDialog->result() == QDialog::Rejected ) {
mySession->terminateNetworkClient();
actionJoin_network_Game->trigger(); // re-trigger
2007-02-17 23:18:34 +00:00
}
else {
//needed for join and ready sounds - TODO
//myStartNetworkGameDialog->setMaxPlayerNumber(gameData.maxNumberOfPlayers);
myStartNetworkGameDialog->setWindowTitle("Start Network Game");
showNetworkStartDialog();
}
2007-02-17 19:36:32 +00:00
}
2007-02-15 00:57:04 +00:00
}
2007-08-20 21:23:03 +00:00
void mainWindowImpl::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 mainWindowImpl::joinGameLobby() {
// Stop local game.
stopTimer();
// Join Lobby
mySession->terminateNetworkClient();
if (myServerGuiInterface.get())
myServerGuiInterface->getSession().terminateNetworkServer();
myGameLobbyDialog->setSession(&getSession());
myStartNetworkGameDialog->setSession(&getSession());
// Clear Lobby dialog.
myGameLobbyDialog->clearDialog();
// Start client for dedicated server.
mySession->startInternetClient();
//Dialog mit Statusbalken
myConnectToServerDialog->exec();
if (myConnectToServerDialog->result() == QDialog::Rejected ) {
mySession->terminateNetworkClient();
}
2007-08-21 20:06:11 +00:00
else
{
showLobbyDialog();
2007-08-21 20:06:11 +00:00
}
2007-08-20 21:23:03 +00:00
}
2007-01-17 01:22:55 +00:00
void mainWindowImpl::callSettingsDialog() {
2007-05-13 12:35:27 +00:00
mySettingsDialog->exec();
2007-03-28 17:44:22 +00:00
2007-08-24 13:07:24 +00:00
if (mySettingsDialog->result() == QDialog::Accepted && mySettingsDialog->getSettingsCorrect()) {
2007-03-28 17:44:22 +00:00
//Toolbox verstecken?
2007-03-29 22:58:04 +00:00
if (myConfig->readConfigInt("ShowLeftToolBox")) { groupBox_LeftToolBox->show(); }
else { groupBox_LeftToolBox->hide(); }
2007-03-28 17:44:22 +00:00
2007-03-29 22:58:04 +00:00
if (myConfig->readConfigInt("ShowRightToolBox")) { groupBox_RightToolBox->show(); }
else { groupBox_RightToolBox->hide(); }
//Falls Spielernamen geändert wurden --> neu zeichnen --> erst beim nächsten Neustart neu ausgelesen
if (mySettingsDialog->getPlayerNickIsChanged() && mySession->getCurrentGame() && !mySession->isNetworkClientRunning()) {
// HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
// currentHand->getPlayerArray()[0]->setMyName(mySettingsDialog->lineEdit_HumanPlayerName->text().toUtf8().constData());
// currentHand->getPlayerArray()[1]->setMyName(mySettingsDialog->lineEdit_Opponent1Name->text().toUtf8().constData());
// currentHand->getPlayerArray()[2]->setMyName(mySettingsDialog->lineEdit_Opponent2Name->text().toUtf8().constData());
// currentHand->getPlayerArray()[3]->setMyName(mySettingsDialog->lineEdit_Opponent3Name->text().toUtf8().constData());
// currentHand->getPlayerArray()[4]->setMyName(mySettingsDialog->lineEdit_Opponent4Name->text().toUtf8().constData());
// currentHand->getPlayerArray()[5]->setMyName(mySettingsDialog->lineEdit_Opponent5Name->text().toUtf8().constData());
// currentHand->getPlayerArray()[6]->setMyName(mySettingsDialog->lineEdit_Opponent6Name->text().toUtf8().constData());
// mySettingsDialog->setPlayerNickIsChanged(FALSE);
//
// refreshPlayerName();
2007-10-02 20:50:28 +00:00
Game *currentGame = mySession->getCurrentGame();
PlayerListIterator it = currentGame->getSeatsList()->begin();
(*it)->setMyName(mySettingsDialog->lineEdit_HumanPlayerName->text().toUtf8().constData());
(*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent1Name->text().toUtf8().constData());
(*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent2Name->text().toUtf8().constData());
(*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent3Name->text().toUtf8().constData());
(*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent4Name->text().toUtf8().constData());
(*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent5Name->text().toUtf8().constData());
(*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent6Name->text().toUtf8().constData());
2007-05-13 12:35:27 +00:00
mySettingsDialog->setPlayerNickIsChanged(FALSE);
refreshPlayerName();
}
2007-03-29 22:58:04 +00:00
2007-06-11 13:23:51 +00:00
if(mySession->getCurrentGame() && !mySession->isNetworkClientRunning()) {
2007-03-29 22:58:04 +00:00
// HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
// currentHand->getPlayerArray()[0]->setMyAvatar(mySettingsDialog->pushButton_HumanPlayerAvatar->getMyLink().toUtf8().constData());
// currentHand->getPlayerArray()[1]->setMyAvatar(mySettingsDialog->pushButton_Opponent1Avatar->getMyLink().toUtf8().constData());
// currentHand->getPlayerArray()[2]->setMyAvatar(mySettingsDialog->pushButton_Opponent2Avatar->getMyLink().toUtf8().constData());
// currentHand->getPlayerArray()[3]->setMyAvatar(mySettingsDialog->pushButton_Opponent3Avatar->getMyLink().toUtf8().constData());
// currentHand->getPlayerArray()[4]->setMyAvatar(mySettingsDialog->pushButton_Opponent4Avatar->getMyLink().toUtf8().constData());
// currentHand->getPlayerArray()[5]->setMyAvatar(mySettingsDialog->pushButton_Opponent5Avatar->getMyLink().toUtf8().constData());
// currentHand->getPlayerArray()[6]->setMyAvatar(mySettingsDialog->pushButton_Opponent6Avatar->getMyLink().toUtf8().constData());
//
// //avatar refresh
// refreshPlayerAvatar();
2007-10-02 20:50:28 +00:00
Game *currentGame = mySession->getCurrentGame();
PlayerListIterator it = currentGame->getSeatsList()->begin();
(*it)->setMyAvatar(mySettingsDialog->pushButton_HumanPlayerAvatar->getMyLink().toUtf8().constData());
(*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent1Avatar->getMyLink().toUtf8().constData());
(*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent2Avatar->getMyLink().toUtf8().constData());
(*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent3Avatar->getMyLink().toUtf8().constData());
(*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent4Avatar->getMyLink().toUtf8().constData());
(*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent5Avatar->getMyLink().toUtf8().constData());
(*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent6Avatar->getMyLink().toUtf8().constData());
2007-03-29 22:58:04 +00:00
//avatar refresh
refreshPlayerAvatar();
2007-03-29 22:58:04 +00:00
}
2007-01-28 23:33:48 +00:00
//Flipside refresh
2007-02-03 22:47:16 +00:00
if (myConfig->readConfigInt("FlipsideOwn") && myConfig->readConfigString("FlipsideOwnFile") != "") {
2007-04-03 10:55:16 +00:00
QPixmap tmpFlipside(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str()));
2007-02-03 22:47:16 +00:00
flipside = new QPixmap(tmpFlipside.scaled(QSize(57, 80)));
2007-01-28 23:33:48 +00:00
}
else { flipside->load(myAppDataPath +"gfx/cards/default/flipside.png"); }
2007-01-28 23:33:48 +00:00
2007-05-17 23:28:36 +00:00
if(mySession->getCurrentGame()) {
//blind buttons refresh
refreshButton();
}
2007-01-29 00:53:20 +00:00
int i,j;
for (i=1; i<MAX_NUMBER_OF_PLAYERS; i++ ) {
2007-01-29 00:53:20 +00:00
for ( j=0; j<=1; j++ ) {
if (holeCardsArray[i][j]->getIsFlipside()) {
holeCardsArray[i][j]->setPixmap(*flipside, TRUE);
}
}
}
// Re-init audio.
2007-06-16 10:18:47 +00:00
mySDLPlayer->audioDone();
mySDLPlayer->initAudio();
2007-01-20 01:38:40 +00:00
}
2007-01-17 01:22:55 +00:00
}
2007-01-13 02:40:33 +00:00
2007-05-02 21:20:54 +00:00
void mainWindowImpl::initGui(int speed)
{
//restliche Singleshots killen!!!
stopTimer();
2007-09-06 21:58:36 +00:00
label_Pot->setText("Pot");
label_Total->setText("Total:");
label_Sets->setText("Sets:");
label_handNumber->setText("Hand:");
label_gameNumber->setText("Game:");
2007-05-02 21:20:54 +00:00
//Tools und Board aufhellen und enablen
// QPalette tempPalette = groupBox_board->palette();
// tempPalette.setColor(QPalette::Window, active);
// groupBox_board->setPalette(tempPalette);
groupBox_RightToolBox->setDisabled(FALSE);
groupBox_LeftToolBox->setDisabled(FALSE);
//show human player buttons
for(int i=0; i<5; i++) {
2007-05-02 21:20:54 +00:00
userWidgetsArray[i]->show();
}
//set speeds for local game and for first network game
if( !mySession->isNetworkClientRunning() || (mySession->isNetworkClientRunning() && !mySession->getCurrentGame()) ) {
guiGameSpeed = speed;
//positioning Slider
horizontalSlider_speed->setValue(guiGameSpeed);
setSpeeds();
}
2007-05-02 21:20:54 +00:00
}
void mainWindowImpl::showClientDialog()
{
if (mySession->getGameType() == Session::GAME_TYPE_NETWORK)
showNetworkStartDialog();
else if (mySession->getGameType() == Session::GAME_TYPE_INTERNET)
showLobbyDialog();
}
void mainWindowImpl::showNetworkStartDialog()
{
myStartNetworkGameDialog->exec();
if (myStartNetworkGameDialog->result() == QDialog::Accepted ) {
//some gui modifications
networkGameModification();
}
else {
mySession->terminateNetworkClient();
if (myServerGuiInterface)
myServerGuiInterface->getSession().terminateNetworkServer();
}
}
void mainWindowImpl::showLobbyDialog()
{
myGameLobbyDialog->exec();
if (myGameLobbyDialog->result() == QDialog::Accepted)
{
//some gui modifications
networkGameModification();
}
else
{
mySession->terminateNetworkClient();
}
}
Session &mainWindowImpl::getSession() { assert(mySession.get()); return *mySession; }
void mainWindowImpl::setSession(boost::shared_ptr<Session> session) { mySession = session; }
2007-05-25 00:09:51 +00:00
2007-01-14 19:58:40 +00:00
2007-01-13 02:40:33 +00:00
//refresh-Funktionen
void mainWindowImpl::refreshSet() {
2007-01-16 21:23:39 +00:00
// int i;
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// if(mySession->getCurrentGame()->getCurrentHand()->getPlayerArray()[i]->getMySet() == 0) setLabelArray[i]->setText("");
// else setLabelArray[i]->setText("Set: "+QString::number(mySession->getCurrentGame()->getCurrentHand()->getPlayerArray()[i]->getMySet(),10)+" $");
// }
2007-10-02 20:50:28 +00:00
Game *currentGame = mySession->getCurrentGame();
PlayerListConstIterator it_c;
2007-10-02 20:50:28 +00:00
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
2007-10-05 12:49:23 +00:00
if( (*it_c)->getMySet() == 0 )
setLabelArray[(*it_c)->getMyID()]->setText("");
else
setLabelArray[(*it_c)->getMyID()]->setText("Set: "+QString::number((*it_c)->getMySet(),10)+" $");
2007-01-13 02:40:33 +00:00
}
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::refreshButton() {
QPixmap dealerButton(myAppDataPath +"gfx/gui/table/default/dealerPuck.png");
QPixmap smallblindButton(myAppDataPath +"gfx/gui/table/default/smallblindPuck.png");
QPixmap bigblindButton(myAppDataPath +"gfx/gui/table/default/bigblindPuck.png");
QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
2007-01-13 02:40:33 +00:00
2007-09-30 08:21:29 +00:00
// int i;
// int k;
//Aktive Spieler zählen
// int activePlayersCounter = 0;
// for (k=0; k<MAX_NUMBER_OF_PLAYERS; k++) {
// if (mySession->getCurrentGame()->getCurrentHand()->getPlayerArray()[k]->getMyActiveStatus() == 1) activePlayersCounter++;
// }
2007-10-02 20:50:28 +00:00
Game *currentGame = mySession->getCurrentGame();
PlayerListConstIterator it_c;
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
// if(activePlayersCounter > 2) {
// switch (currentHand->getPlayerArray()[i]->getMyButton()) {
//
// case 1 : buttonLabelArray[i]->setPixmap(dealerButton);
// break;
// case 2 : {
// if ( myConfig->readConfigInt("ShowBlindButtons")) buttonLabelArray[i]->setPixmap(smallblindButton);
// else { buttonLabelArray[i]->setPixmap(onePix); }
// }
// break;
// case 3 : {
// if (myConfig->readConfigInt("ShowBlindButtons")) buttonLabelArray[i]->setPixmap(bigblindButton);
// else { buttonLabelArray[i]->setPixmap(onePix); }
// }
// break;
// default: buttonLabelArray[i]->setPixmap(onePix);
//
// }
// }
// else {
// switch (currentHand->getPlayerArray()[i]->getMyButton()) {
//
// case 2 : buttonLabelArray[i]->setPixmap(dealerButton);
// break;
// case 3 : {
// if (myConfig->readConfigInt("ShowBlindButtons")) buttonLabelArray[i]->setPixmap(bigblindButton);
// else { buttonLabelArray[i]->setPixmap(onePix); }
// }
// break;
// default: buttonLabelArray[i]->setPixmap(onePix);
//
// }
// }
// }
// else { buttonLabelArray[i]->setPixmap(onePix); }
// }
2007-10-02 20:50:28 +00:00
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
if( (*it_c)->getMyActiveStatus() ) {
2007-10-02 20:50:28 +00:00
if( currentGame->getActivePlayerList()->size() > 2 ) {
switch ( (*it_c)->getMyButton() ) {
2007-05-17 23:28:36 +00:00
2007-09-30 00:56:43 +00:00
case 1 : buttonLabelArray[(*it_c)->getMyID()]->setPixmap(dealerButton);
break;
case 2 : {
2007-10-05 12:49:23 +00:00
if(myConfig->readConfigInt("ShowBlindButtons"))
buttonLabelArray[(*it_c)->getMyID()]->setPixmap(smallblindButton);
else
buttonLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
}
break;
case 3 : {
2007-10-05 12:49:23 +00:00
if(myConfig->readConfigInt("ShowBlindButtons"))
buttonLabelArray[(*it_c)->getMyID()]->setPixmap(bigblindButton);
else
buttonLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
}
break;
default: buttonLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
2007-05-17 23:28:36 +00:00
2007-03-28 10:21:51 +00:00
}
}
2007-03-28 10:21:51 +00:00
else {
switch ((*it_c)->getMyButton()) {
2007-05-18 11:38:37 +00:00
2007-09-30 00:56:43 +00:00
case 2 : buttonLabelArray[(*it_c)->getMyID()]->setPixmap(dealerButton);
break;
case 3 : {
2007-10-05 12:49:23 +00:00
if(myConfig->readConfigInt("ShowBlindButtons"))
buttonLabelArray[(*it_c)->getMyID()]->setPixmap(bigblindButton);
else
buttonLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
}
break;
default: buttonLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
2007-05-18 11:38:37 +00:00
2007-03-28 10:21:51 +00:00
}
}
2007-01-16 21:23:39 +00:00
}
else { buttonLabelArray[(*it_c)->getMyID()]->setPixmap(onePix); }
2007-01-16 21:23:39 +00:00
}
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::refreshPlayerName() {
// int i;
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// if(mySession->getCurrentGame()->getCurrentHand()->getPlayerArray()[i]->getMyActiveStatus()) {
// playerNameLabelArray[i]->setText(QString::fromUtf8(mySession->getCurrentGame()->getCurrentHand()->getPlayerArray()[i]->getMyName().c_str()));
//
// } else {
// playerNameLabelArray[i]->setText("");
//
// }
//
// }
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
if((*it_c)->getMyActiveStatus()) {
playerNameLabelArray[(*it_c)->getMyID()]->setText(QString::fromUtf8((*it_c)->getMyName().c_str()));
2007-03-27 16:02:23 +00:00
} else {
playerNameLabelArray[(*it_c)->getMyID()]->setText("");
2007-03-27 16:02:23 +00:00
}
}
2007-03-27 16:02:23 +00:00
}
QStringList mainWindowImpl::getPlayerNicksList() {
QStringList list;
PlayerListConstIterator it_c;
for (it_c=mySession->getCurrentGame()->getSeatsList()->begin(); it_c!=mySession->getCurrentGame()->getSeatsList()->end(); it_c++) {
list << QString::fromUtf8((*it_c)->getMyName().c_str());
}
return list;
}
2007-03-27 16:02:23 +00:00
void mainWindowImpl::refreshPlayerAvatar() {
QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
2007-09-30 08:21:29 +00:00
// int i;
2007-03-27 16:02:23 +00:00
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
//
// if(!i) {
// if(currentHand->getPlayerArray()[0]->getMyAvatar() == "" || !QFile::QFile(QString::fromUtf8(currentHand->getPlayerArray()[0]->getMyAvatar().c_str())).exists()) {
// playerAvatarLabelArray[0]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/genereticAvatar.png"));
// }
// else {
// playerAvatarLabelArray[0]->setPixmap(QString::fromUtf8(currentHand->getPlayerArray()[0]->getMyAvatar().c_str()));
// }
// }
// else {
// if(currentHand->getPlayerArray()[i]->getMyAvatar() == "" || !QFile::QFile(QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyAvatar().c_str())).exists()) {
// playerAvatarLabelArray[i]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/genereticAvatar.png"));
// }
// else {
// playerAvatarLabelArray[i]->setPixmap(QString::fromUtf8(currentHand->getPlayerArray()[i]->getMyAvatar().c_str()));
// }
// }
// }
// else {
// playerAvatarLabelArray[i]->setPixmap(onePix);
// }
// }
2007-03-28 17:44:22 +00:00
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
if((*it_c)->getMyActiveStatus()) {
if((*it_c)->getMyAvatar() == "" || !QFile::QFile(QString::fromUtf8((*it_c)->getMyAvatar().c_str())).exists()) {
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/genereticAvatar.png"));
2007-03-28 17:44:22 +00:00
}
else {
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(QString::fromUtf8((*it_c)->getMyAvatar().c_str()));
2007-03-28 17:44:22 +00:00
}
2007-03-27 16:02:23 +00:00
}
else {
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
2007-03-27 16:02:23 +00:00
}
2007-03-26 00:12:35 +00:00
}
2007-01-13 02:40:33 +00:00
}
2007-03-29 22:58:04 +00:00
void mainWindowImpl::refreshAction(int playerID, int playerAction) {
2007-01-13 02:40:33 +00:00
QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
2007-03-27 21:36:56 +00:00
QPixmap action;
2007-01-13 02:40:33 +00:00
QStringList actionArray;
2007-03-27 21:36:56 +00:00
actionArray << "" << "fold" << "check" << "call" << "bet" << "raise" << "allin";
2007-01-13 02:40:33 +00:00
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
2007-03-29 22:58:04 +00:00
if(playerID == -1 || playerAction == -1) {
2007-01-13 02:40:33 +00:00
// int i;
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
//
// //if no action --> clear Pixmap
// if(currentHand->getPlayerArray()[i]->getMyAction() == 0) {
// actionLabelArray[i]->setPixmap(onePix);
// }
// else {
// // if(i!=0 || ( i==0 && currentHand->getPlayerArray()[0]->getMyAction() != 1) ) {
// //paint action pixmap
// actionLabelArray[i]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/action_"+actionArray[currentHand->getPlayerArray()[i]->getMyAction()]+".png"));
// // }
// }
//
// if (currentHand->getPlayerArray()[i]->getMyAction()==1) {
// // groupBoxArray[i]->setDisabled(TRUE);
//
// if(i != 0) {
// holeCardsArray[i][0]->setPixmap(onePix, FALSE);
// holeCardsArray[i][1]->setPixmap(onePix, FALSE);
// }
// }
// }
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
2007-03-29 22:58:04 +00:00
//if no action --> clear Pixmap
if( (*it_c)->getMyAction() == 0) {
actionLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
2007-03-29 22:58:04 +00:00
}
else {
// if(i!=0 || ( i==0 && currentHand->getPlayerArray()[0]->getMyAction() != 1) ) {
2007-03-29 22:58:04 +00:00
//paint action pixmap
actionLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/action_"+actionArray[(*it_c)->getMyAction()]+".png"));
// }
2007-03-29 22:58:04 +00:00
}
if ((*it_c)->getMyAction()==1) {
2007-03-29 22:58:04 +00:00
// groupBoxArray[i]->setDisabled(TRUE);
if((*it_c)->getMyID() != 0) {
holeCardsArray[(*it_c)->getMyID()][0]->setPixmap(onePix, FALSE);
holeCardsArray[(*it_c)->getMyID()][1]->setPixmap(onePix, FALSE);
2007-03-29 22:58:04 +00:00
}
}
}
2007-03-29 22:58:04 +00:00
}
else {
2007-03-27 21:36:56 +00:00
//if no action --> clear Pixmap
2007-03-29 22:58:04 +00:00
if(playerAction == 0) {
actionLabelArray[playerID]->setPixmap(onePix);
2007-03-27 21:36:56 +00:00
}
else {
2007-03-29 22:58:04 +00:00
// paint action pixmap and raise
actionLabelArray[playerID]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/action_"+actionArray[playerAction]+".png"));
2007-06-03 10:03:54 +00:00
//play sounds if exist
if(myConfig->readConfigInt("PlayGameActions"))
mySDLPlayer->playSound(actionArray[playerAction].toStdString(), playerID);
2007-03-27 21:36:56 +00:00
}
2007-03-29 22:58:04 +00:00
if (playerAction == 1) { // FOLD
2007-08-19 23:19:30 +00:00
if (playerID == 0 && !myConfig->readConfigInt("AntiPeekMode")) {
holeCardsArray[0][0]->startFadeOut(10);
holeCardsArray[0][1]->startFadeOut(10);
}
else {
2007-03-29 22:58:04 +00:00
holeCardsArray[playerID][0]->setPixmap(onePix, FALSE);
holeCardsArray[playerID][1]->setPixmap(onePix, FALSE);
2007-01-13 02:40:33 +00:00
}
}
}
}
void mainWindowImpl::refreshCash() {
// int i;
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
2007-01-13 02:40:33 +00:00
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
//
// cashLabelArray[i]->setText(QString::number(currentHand->getPlayerArray()[i]->getMyCash(),10)+" $");
// cashTopLabelArray[i]->setText("Cash:");
//
// } else {
// cashLabelArray[i]->setText("");
// cashTopLabelArray[i]->setText("");
// }
// }
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
if((*it_c)->getMyActiveStatus()) {
cashLabelArray[(*it_c)->getMyID()]->setText(QString::number((*it_c)->getMyCash(),10)+" $");
cashTopLabelArray[(*it_c)->getMyID()]->setText("Cash:");
2007-03-27 16:02:23 +00:00
2007-01-13 02:40:33 +00:00
} else {
cashLabelArray[(*it_c)->getMyID()]->setText("");
cashTopLabelArray[(*it_c)->getMyID()]->setText("");
2007-01-13 02:40:33 +00:00
}
}
2007-01-13 02:40:33 +00:00
}
2007-03-29 22:58:04 +00:00
void mainWindowImpl::refreshGroupbox(int playerID, int status) {
2007-01-13 02:40:33 +00:00
// int i;
int j;
2007-05-24 22:37:10 +00:00
2007-03-29 22:58:04 +00:00
if(playerID == -1 || status == -1) {
2007-01-13 02:40:33 +00:00
// HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
//
// if(currentHand->getPlayerArray()[i]->getMyTurn()) {
// //Groupbox glow wenn der Spiele dran ist.
// if(i==0) {
// groupBoxArray[0]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxActiveGlow.png) }");
// }
// else {
// groupBoxArray[i]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxActiveGlow.png) }");
// }
//
// } else {
// //Groupbox auf Hintergrundfarbe setzen wenn der Spiele nicht dran aber aktiv ist.
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus()) {
// if(i==0) {
// groupBoxArray[0]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxInactiveGlow.png) }");
// //show buttons
// for(j=0; j<3; j++) {
// userWidgetsArray[j]->show();
// }
// }
// else {
// groupBoxArray[i]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxInactiveGlow.png) }");
// }
// }
// //Groupbox verdunkeln wenn der Spiele inactive ist.
// else {
// if(i==0) {
// groupBoxArray[0]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxInactiveGlow.png) }");
// //hide buttons
// for(j=0; j<4; j++) {
// userWidgetsArray[j]->hide();
// }
// }
// else {
// groupBoxArray[i]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxInactiveGlow.png) }");
// }
// }
// }
// }
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
2007-03-29 22:58:04 +00:00
if((*it_c)->getMyTurn()) {
2007-03-29 22:58:04 +00:00
//Groupbox glow wenn der Spiele dran ist.
if((*it_c)->getMyID()==0) {
groupBoxArray[0]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxActiveGlow_0.6.png) }");
2007-03-28 10:21:51 +00:00
}
else {
groupBoxArray[(*it_c)->getMyID()]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxActiveGlow.png) }");
2007-03-28 10:21:51 +00:00
}
2007-03-29 22:58:04 +00:00
} else {
//Groupbox auf Hintergrundfarbe setzen wenn der Spiele nicht dran aber aktiv ist.
if((*it_c)->getMyActiveStatus()) {
if((*it_c)->getMyID()==0) {
groupBoxArray[0]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxInactiveGlow_0.6.png) }");
2007-03-29 22:58:04 +00:00
//show buttons
for(j=0; j<5; j++) {
2007-03-29 22:58:04 +00:00
userWidgetsArray[j]->show();
}
}
else {
groupBoxArray[(*it_c)->getMyID()]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxInactiveGlow.png) }");
2007-03-29 22:58:04 +00:00
}
}
//Groupbox verdunkeln wenn der Spiele inactive ist.
2007-03-28 10:21:51 +00:00
else {
if((*it_c)->getMyID()==0) {
groupBoxArray[0]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxInactiveGlow_0.6.png) }");
2007-03-29 22:58:04 +00:00
//hide buttons
for(j=0; j<5; j++) {
2007-03-29 22:58:04 +00:00
userWidgetsArray[j]->hide();
}
}
else {
groupBoxArray[(*it_c)->getMyID()]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxInactiveGlow.png) }");
2007-03-29 22:58:04 +00:00
}
2007-03-28 10:21:51 +00:00
}
2007-01-13 02:40:33 +00:00
}
}
2007-01-13 02:40:33 +00:00
}
2007-03-29 22:58:04 +00:00
else {
switch(status) {
//inactive
case 0: {
if (!playerID) {
groupBoxArray[playerID]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxInactiveGlow_0.6.png) }");
2007-05-24 22:37:10 +00:00
//hide buttons
for(j=0; j<5; j++) {
2007-05-24 22:37:10 +00:00
userWidgetsArray[j]->hide();
}
2007-03-29 22:58:04 +00:00
}
else {
groupBoxArray[playerID]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxInactiveGlow.png) }");
2007-03-29 22:58:04 +00:00
}
}
break;
//active but fold
case 1: {
if (!playerID) {
groupBoxArray[playerID]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxInactiveGlow_0.6.png) }");
2007-05-24 22:37:10 +00:00
//show buttons
for(j=0; j<5; j++) {
2007-05-24 22:37:10 +00:00
userWidgetsArray[j]->show();
}
2007-03-29 22:58:04 +00:00
}
else {
groupBoxArray[playerID]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxInactiveGlow.png) }");
2007-03-29 22:58:04 +00:00
}
}
break;
//active in action
case 2: {
if (!playerID) {
groupBoxArray[playerID]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxActiveGlow_0.6.png) }");
2007-03-29 22:58:04 +00:00
}
else {
groupBoxArray[playerID]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxActiveGlow.png) }");
2007-03-29 22:58:04 +00:00
}
}
break;
2007-05-24 22:49:44 +00:00
//active not in action
case 3: {
if (!playerID) {
groupBoxArray[playerID]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxInactiveGlow_0.6.png) }");
2007-05-24 22:49:44 +00:00
}
else {
groupBoxArray[playerID]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/opponentBoxInactiveGlow.png) }");
2007-05-24 22:49:44 +00:00
}
}
break;
2007-03-29 22:58:04 +00:00
default: {}
}
}
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::refreshGameLabels(int gameState) {
2007-01-13 02:40:33 +00:00
switch(gameState) {
2007-05-29 18:37:49 +00:00
case 0: {
textLabel_handLabel->setText("Preflop");
} break;
case 1: {
textLabel_handLabel->setText("Flop");
} break;
case 2: {
textLabel_handLabel->setText("Turn");
} break;
case 3: {
textLabel_handLabel->setText("River");
} break;
case 4: {
textLabel_handLabel->setText("");
} break;
default: {
textLabel_handLabel->setText("!!! ERROR !!!");
}
2007-01-13 02:40:33 +00:00
}
2007-05-29 18:37:49 +00:00
2007-09-06 22:32:15 +00:00
label_handNumberValue->setText(QString::number(mySession->getCurrentGame()->getCurrentHand()->getMyID(),10));
label_gameNumberValue->setText(QString::number(mySession->getCurrentGame()->getMyGameID(),10));
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::refreshAll() {
2007-06-03 08:17:33 +00:00
// int i;
2007-06-03 08:17:33 +00:00
2007-01-13 02:40:33 +00:00
refreshSet();
refreshButton();
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// refreshAction( i, mySession->getCurrentGame()->getPlayerArray()[i]->getMyAction());
// }
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
refreshAction( (*it_c)->getMyID(), (*it_c)->getMyAction());
2007-06-03 08:17:33 +00:00
}
2007-01-13 02:40:33 +00:00
refreshCash();
refreshGroupbox();
2007-03-27 16:02:23 +00:00
refreshPlayerName();
refreshPlayerAvatar();
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::refreshChangePlayer() {
// int i;
2007-06-03 08:17:33 +00:00
2007-03-29 22:58:04 +00:00
refreshSet();
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// refreshAction( i, mySession->getCurrentGame()->getPlayerArray()[i]->getMyAction());
// }
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
refreshAction( (*it_c)->getMyID(), (*it_c)->getMyAction());
2007-06-03 08:17:33 +00:00
}
2007-03-29 22:58:04 +00:00
refreshCash();
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::refreshPot() {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
2007-01-13 02:40:33 +00:00
2007-09-06 21:58:36 +00:00
textLabel_Sets->setText(QString::number(currentHand->getBoard()->getSets(),10)+" $");
textLabel_Pot->setText(QString::number(currentHand->getBoard()->getPot(),10)+" $");
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::guiUpdateDone() {
guiUpdateSemaphore.release();
}
void mainWindowImpl::waitForGuiUpdateDone() {
guiUpdateSemaphore.acquire();
}
2007-01-13 02:40:33 +00:00
void mainWindowImpl::dealHoleCards() {
QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
2007-01-13 02:40:33 +00:00
//TempArrays
QPixmap tempCardsPixmapArray[2];
int tempCardsIntArray[2];
// Karten der Gegner und eigene Karten austeilen
// int i;
int j;
Game *currentGame = mySession->getCurrentGame();
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// currentGame->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
// for(j=0; j<2; j++) {
// if(currentGame->getPlayerArray()[i]->getMyActiveStatus()) {
// if ((i == 0) || DEBUG_MODE) {
// if(myConfig->readConfigInt("AntiPeekMode")) {
// holeCardsArray[i][j]->setPixmap(*flipside, TRUE);
// tempCardsPixmapArray[j].load(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png");
// holeCardsArray[i][j]->setFrontPixmap(tempCardsPixmapArray[j]);
// }
// else {
// tempCardsPixmapArray[j].load(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png");
// holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j],FALSE);
// }
// }
// else {
// holeCardsArray[i][j]->setPixmap(*flipside, TRUE);
// /* holeCardsArray[i][j]->setStyleSheet("QLabel:hover { background-image:url(:/cards/resources/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png");*/
// }
// }
// else {
//
// holeCardsArray[i][j]->setPixmap(onePix, FALSE);
// // holeCardsArray[i][j]->repaint();
// }
// }
// }
PlayerListConstIterator it_c;
for(it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
(*it_c)->getMyCards(tempCardsIntArray);
2007-01-13 02:40:33 +00:00
for(j=0; j<2; j++) {
if((*it_c)->getMyActiveStatus()) {
if (( (*it_c)->getMyID() == 0) || DEBUG_MODE) {
2007-08-19 23:19:30 +00:00
if(myConfig->readConfigInt("AntiPeekMode")) {
holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(*flipside, TRUE);
tempCardsPixmapArray[j].load(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png");
holeCardsArray[(*it_c)->getMyID()][j]->setFrontPixmap(tempCardsPixmapArray[j]);
2007-08-19 23:19:30 +00:00
}
else {
tempCardsPixmapArray[j].load(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png");
holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(tempCardsPixmapArray[j],FALSE);
2007-08-19 23:19:30 +00:00
}
2007-01-13 02:40:33 +00:00
}
2007-08-19 12:33:24 +00:00
else {
holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(*flipside, TRUE);
2007-08-19 12:33:24 +00:00
/* holeCardsArray[i][j]->setStyleSheet("QLabel:hover { background-image:url(:/cards/resources/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png");*/
}
2007-01-13 02:40:33 +00:00
}
else {
holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(onePix, FALSE);
// holeCardsArray[i][j]->repaint();
2007-01-13 02:40:33 +00:00
}
}
}
2007-08-19 23:19:30 +00:00
//fix press mouse button during bankrupt with anti-peek-mode
this->mouseOverFlipCards(FALSE);
2007-01-13 02:40:33 +00:00
}
2007-08-07 00:05:29 +00:00
void mainWindowImpl::dealBeRoCards(int myBeRoID) {
switch(myBeRoID) {
case 1: { dealFlopCards0(); }
break;
case 2: { dealTurnCards0(); }
break;
case 3: { dealRiverCards0(); }
break;
2007-08-31 13:09:07 +00:00
default: { cout << "dealBeRoCards() Error" << endl; }
2007-08-07 00:05:29 +00:00
}
}
void mainWindowImpl::dealFlopCards0() { dealFlopCards0Timer->start(preDealCardsSpeed); }
2007-01-13 02:40:33 +00:00
void mainWindowImpl::dealFlopCards1() {
2007-01-29 00:53:20 +00:00
boardCardsArray[0]->setPixmap(*flipside, TRUE);
2007-01-23 23:53:12 +00:00
dealFlopCards1Timer->start(dealCardsSpeed);
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::dealFlopCards2() {
2007-01-29 00:53:20 +00:00
boardCardsArray[1]->setPixmap(*flipside, TRUE);
2007-01-23 19:20:18 +00:00
dealFlopCards2Timer->start(dealCardsSpeed);
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::dealFlopCards3() {
2007-01-28 23:33:48 +00:00
2007-01-29 00:53:20 +00:00
boardCardsArray[2]->setPixmap(*flipside, TRUE);
2007-01-23 19:20:18 +00:00
dealFlopCards3Timer->start(dealCardsSpeed);
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::dealFlopCards4() {
int tempBoardCardsArray[5];
QPixmap tempCardsPixmap;
mySession->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
tempCardsPixmap.load(myAppDataPath +"gfx/cards/default/"+QString::number(tempBoardCardsArray[0], 10)+".png");
2007-01-13 02:40:33 +00:00
QPixmap card(tempCardsPixmap);
//Config? mit oder ohne Eye-Candy?
2007-02-03 22:47:16 +00:00
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
//mit Eye-Candy
boardCardsArray[0]->startFlipCards(guiGameSpeed, card, flipside);
}
else {
//ohne Eye-Candy
boardCardsArray[0]->setPixmap(card, FALSE);
}
2007-01-23 23:53:12 +00:00
dealFlopCards4Timer->start(dealCardsSpeed);
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::dealFlopCards5() {
int tempBoardCardsArray[5];
QPixmap tempCardsPixmap;
mySession->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
tempCardsPixmap.load(myAppDataPath +"gfx/cards/default/"+QString::number(tempBoardCardsArray[1], 10)+".png");
2007-01-13 02:40:33 +00:00
QPixmap card(tempCardsPixmap);
//Config? mit oder ohne Eye-Candy?
2007-02-03 22:47:16 +00:00
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
//mit Eye-Candy
boardCardsArray[1]->startFlipCards(guiGameSpeed, card, flipside);
}
else {
//ohne Eye-Candy
boardCardsArray[1]->setPixmap(card, FALSE);
}
2007-01-23 23:53:12 +00:00
dealFlopCards5Timer->start(dealCardsSpeed);
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::dealFlopCards6() {
int tempBoardCardsArray[5];
QPixmap tempCardsPixmap;
mySession->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
tempCardsPixmap.load(myAppDataPath +"gfx/cards/default/"+QString::number(tempBoardCardsArray[2], 10)+".png");
2007-01-13 02:40:33 +00:00
QPixmap card(tempCardsPixmap);
//Config? mit oder ohne Eye-Candy?
2007-02-03 22:47:16 +00:00
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
//mit Eye-Candy
boardCardsArray[2]->startFlipCards(guiGameSpeed, card, flipside);
}
else {
//ohne Eye-Candy
boardCardsArray[2]->setPixmap(card, FALSE);
}
2007-02-13 02:00:11 +00:00
2007-01-13 02:40:33 +00:00
// stable
// wenn alle All In
if(mySession->getCurrentGame()->getCurrentHand()->getAllInCondition()) { dealFlopCards6Timer->start(AllInDealCardsSpeed); }
2007-01-13 02:40:33 +00:00
// sonst normale Variante
else { dealFlopCards6Timer->start(postDealCardsSpeed);}
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::dealTurnCards0() { dealTurnCards0Timer->start(preDealCardsSpeed); }
2007-01-13 02:40:33 +00:00
void mainWindowImpl::dealTurnCards1() {
2007-01-29 00:53:20 +00:00
boardCardsArray[3]->setPixmap(*flipside, TRUE);
2007-01-23 19:20:18 +00:00
dealTurnCards1Timer->start(dealCardsSpeed);
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::dealTurnCards2() {
int tempBoardCardsArray[5];
QPixmap tempCardsPixmap;
mySession->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
tempCardsPixmap.load(myAppDataPath +"gfx/cards/default/"+QString::number(tempBoardCardsArray[3], 10)+".png");
2007-01-13 02:40:33 +00:00
QPixmap card(tempCardsPixmap);
//Config? mit oder ohne Eye-Candy?
2007-02-03 22:47:16 +00:00
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
//mit Eye-Candy
boardCardsArray[3]->startFlipCards(guiGameSpeed, card, flipside);
}
else {
//ohne Eye-Candy
boardCardsArray[3]->setPixmap(card, FALSE);
}
2007-01-13 02:40:33 +00:00
// stable
// wenn alle All In
if(mySession->getCurrentGame()->getCurrentHand()->getAllInCondition()) { dealTurnCards2Timer->start(AllInDealCardsSpeed);
2007-01-13 02:40:33 +00:00
}
// sonst normale Variante
else { dealTurnCards2Timer->start(postDealCardsSpeed); }
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::dealRiverCards0() { dealRiverCards0Timer->start(preDealCardsSpeed); }
2007-01-13 02:40:33 +00:00
void mainWindowImpl::dealRiverCards1() {
2007-01-29 00:53:20 +00:00
boardCardsArray[4]->setPixmap(*flipside, TRUE);
2007-01-23 19:20:18 +00:00
// QTimer::singleShot(dealCardsSpeed, this, SLOT( dealRiverCards2() ));
dealRiverCards1Timer->start(dealCardsSpeed);
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::dealRiverCards2() {
int tempBoardCardsArray[5];
QPixmap tempCardsPixmap;
mySession->getCurrentGame()->getCurrentHand()->getBoard()->getMyCards(tempBoardCardsArray);
tempCardsPixmap.load(myAppDataPath +"gfx/cards/default/"+QString::number(tempBoardCardsArray[4], 10)+".png");
2007-01-13 02:40:33 +00:00
QPixmap card(tempCardsPixmap);
//Config? mit oder ohne Eye-Candy?
2007-02-03 22:47:16 +00:00
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
//mit Eye-Candy
boardCardsArray[4]->startFlipCards(guiGameSpeed, card, flipside);
}
else {
//ohne Eye-Candy
boardCardsArray[4]->setPixmap(card, FALSE);
}
2007-01-13 02:40:33 +00:00
// stable
// wenn alle All In
if(mySession->getCurrentGame()->getCurrentHand()->getAllInCondition()) { dealRiverCards2Timer->start(AllInDealCardsSpeed); }
2007-01-13 02:40:33 +00:00
// sonst normale Variante
else {
dealRiverCards2Timer->start(postDealCardsSpeed);
2007-01-13 02:40:33 +00:00
}
}
void mainWindowImpl::provideMyActions() {
2007-01-13 02:40:33 +00:00
2007-05-23 22:31:56 +00:00
Game *currentGame = mySession->getCurrentGame();
HandInterface *currentHand = currentGame->getCurrentHand();
2007-03-31 00:04:36 +00:00
switch (currentHand->getActualRound()) {
2007-01-13 02:40:33 +00:00
case 0: {
if (currentGame->getSeatsList()->front()->getMyCash()+currentGame->getSeatsList()->front()->getMySet() > currentHand->getCurrentBeRo()->getHighestSet()) {
pushButton_BetRaise->setText("Raise");
}
2007-01-13 02:40:33 +00:00
if (currentGame->getSeatsList()->front()->getMySet()== currentHand->getCurrentBeRo()->getHighestSet() && currentGame->getSeatsList()->front()->getMyButton() == 3) { pushButton_CallCheckSet->setText("Check"); }
else { pushButton_CallCheckSet->setText("Call "+QString::number(getMyCallAmount())+"$" ); }
2007-03-28 10:21:51 +00:00
pushButton_FoldAllin->setText("Fold");
2007-01-13 02:40:33 +00:00
}
break;
case 1: {
2007-03-28 10:21:51 +00:00
pushButton_FoldAllin->setText("Fold");
2007-01-13 02:40:33 +00:00
2007-08-08 00:17:31 +00:00
// cout << "highestSet in meInAction " << currentHand->getCurrentBeRo()->getHighestSet() << endl;
if (currentHand->getCurrentBeRo()->getHighestSet() == 0) {
2007-03-28 10:21:51 +00:00
pushButton_CallCheckSet->setText("Check");
pushButton_BetRaise->setText("Bet");
2007-01-13 02:40:33 +00:00
}
if (currentHand->getCurrentBeRo()->getHighestSet() > 0 && currentHand->getCurrentBeRo()->getHighestSet() > currentGame->getSeatsList()->front()->getMySet()) {
pushButton_CallCheckSet->setText("Call "+QString::number(getMyCallAmount())+"$" );
if (currentGame->getSeatsList()->front()->getMyCash()+currentGame->getSeatsList()->front()->getMySet() > currentHand->getCurrentBeRo()->getHighestSet()) {
pushButton_BetRaise->setText("Raise");
}
2007-01-13 02:40:33 +00:00
}
}
break;
case 2: {
2007-03-28 10:21:51 +00:00
pushButton_FoldAllin->setText("Fold");
2007-01-13 02:40:33 +00:00
2007-08-08 00:17:31 +00:00
// cout << "highestSet in meInAction " << currentHand->getCurrentBeRo()->getHighestSet() << endl;
if (currentHand->getCurrentBeRo()->getHighestSet() == 0) {
2007-03-28 10:21:51 +00:00
pushButton_CallCheckSet->setText("Check");
pushButton_BetRaise->setText("Bet");
2007-01-13 02:40:33 +00:00
}
if (currentHand->getCurrentBeRo()->getHighestSet() > 0 && currentHand->getCurrentBeRo()->getHighestSet() > currentGame->getSeatsList()->front()->getMySet()) {
pushButton_CallCheckSet->setText("Call "+QString::number(getMyCallAmount())+"$" );
if (currentGame->getSeatsList()->front()->getMyCash()+currentGame->getSeatsList()->front()->getMySet() > currentHand->getCurrentBeRo()->getHighestSet()) {
pushButton_BetRaise->setText("Raise");
}
2007-01-13 02:40:33 +00:00
}
}
break;
case 3: {
2007-03-28 10:21:51 +00:00
pushButton_FoldAllin->setText("Fold");
2007-01-13 02:40:33 +00:00
2007-08-08 00:17:31 +00:00
// cout << "highestSet in meInAction " << currentHand->getCurrentBeRo()->getHighestSet() << endl;
if (currentHand->getCurrentBeRo()->getHighestSet() == 0) {
2007-03-28 10:21:51 +00:00
pushButton_CallCheckSet->setText("Check");
pushButton_BetRaise->setText("Bet");
2007-01-13 02:40:33 +00:00
}
if (currentHand->getCurrentBeRo()->getHighestSet() > 0 && currentHand->getCurrentBeRo()->getHighestSet() > currentGame->getSeatsList()->front()->getMySet()) {
pushButton_CallCheckSet->setText("Call "+QString::number(getMyCallAmount())+"$" );
if (currentGame->getSeatsList()->front()->getMyCash()+currentGame->getSeatsList()->front()->getMySet() > currentHand->getCurrentBeRo()->getHighestSet()) {
pushButton_BetRaise->setText("Raise");
}
2007-01-13 02:40:33 +00:00
}
}
break;
default: {}
}
}
2007-09-18 21:31:39 +00:00
void mainWindowImpl::meInAction() {
//fix buttons if escape is pressed during raise or bet
// spinBox_set->hide();
// pushButton_BetRaise->show();
myButtonsCheckable(FALSE);
horizontalSlider_bet->setEnabled(TRUE);
spinBox_set->setEnabled(TRUE);
myActionIsRaise = 0;
myActionIsBet = 0;
if(myConfig->readConfigInt("ShowStatusbarMessages")) {
if ( myConfig->readConfigInt("AlternateFKeysUserActionMode") == 0 ) {
statusBar()->showMessage(tr("F1 - Fold/All-In | F2 - Check/Call | F3 - Bet/Raise"), 15000);
} else {
statusBar()->showMessage(tr("F1 - Bet/Raise | F2 - Check/Call | F3 - Fold/All-In"), 15000);
}
}
provideMyActions();
myBetRaise();
2007-09-18 21:31:39 +00:00
switch (playingMode) {
case 0: // Manual mode
break;
case 1: // Auto check / call all
myCallCheckSet();
break;
case 2: // Auto check / fold all
if (pushButton_CallCheckSet->text() == "Check") {
myCheck();
} else {
myFold();
}
break;
}
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::startTimeoutAnimation(int playerId, int timeoutSec) {
assert(playerId >= 0 && playerId < mySession->getCurrentGame()->getStartQuantityPlayers());
//beep for player 0
if(playerId) { setLabelArray[playerId]->startTimeOutAnimation(timeoutSec, FALSE); }
else { setLabelArray[playerId]->startTimeOutAnimation(timeoutSec, TRUE); }
}
void mainWindowImpl::stopTimeoutAnimation(int playerId) {
assert(playerId >= 0 && playerId < mySession->getCurrentGame()->getStartQuantityPlayers());
setLabelArray[playerId]->stopTimeOutAnimation();
}
2007-01-13 02:40:33 +00:00
void mainWindowImpl::disableMyButtons() {
2007-03-28 10:21:51 +00:00
//clear userWidgets
2007-03-29 22:58:04 +00:00
spinBox_set->setMinimum(0);
horizontalSlider_bet->setMinimum(0);
2007-10-16 21:48:53 +00:00
// spinBox_set->setValue(0);
spinBox_set->clear();
horizontalSlider_bet->setValue(0);
spinBox_set->setDisabled(TRUE);
horizontalSlider_bet->setDisabled(TRUE);
// spinBox_set->hide();
// pushButton_BetRaise->show();
// pushButton_BetRaise->setText("");
// pushButton_CallCheckSet->setText("");
// pushButton_FoldAllin->setText("");
myButtonsCheckable(TRUE);
2007-10-16 21:48:53 +00:00
2007-01-13 02:40:33 +00:00
}
2007-03-28 10:21:51 +00:00
void mainWindowImpl::myBetRaise() {
if(pushButton_BetRaise->text() == "Raise") {
myRaise();
}
else if(pushButton_BetRaise->text() == "Bet") {
myBet();
}
else {
spinBox_set->setMinimum(0);
horizontalSlider_bet->setMinimum(0);
spinBox_set->setValue(0);
horizontalSlider_bet->setValue(0);
spinBox_set->setDisabled(TRUE);
horizontalSlider_bet->setDisabled(TRUE);
}
2007-03-28 10:21:51 +00:00
}
void mainWindowImpl::myFoldAllin() {
if(!pushButton_FoldAllin->isCheckable()) {
if(pushButton_FoldAllin->text() == "Fold") { myFold(); }
}
2007-03-28 10:21:51 +00:00
}
void mainWindowImpl::myCallCheckSet() {
if(!pushButton_CallCheckSet->isCheckable()) {
if(pushButton_CallCheckSet->text().startsWith("Call")) { myCall(); }
if(pushButton_CallCheckSet->text() == "Check") { myCheck(); }
}
2007-03-28 10:21:51 +00:00
}
2007-01-13 02:40:33 +00:00
void mainWindowImpl::myFold(){
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
currentHand->getSeatsList()->front()->setMyAction(1);
currentHand->getSeatsList()->front()->setMyTurn(0);
2007-01-13 02:40:33 +00:00
2007-03-29 22:58:04 +00:00
//set that i was the last active player. need this for unhighlighting groupbox
currentHand->setLastPlayersTurn(0);
2007-01-13 02:40:33 +00:00
2007-03-31 00:04:36 +00:00
statusBar()->clearMessage();
2007-01-13 02:40:33 +00:00
//Spiel läuft weiter
myActionDone();
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::myCheck() {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
2007-05-26 12:40:45 +00:00
currentHand->getSeatsList()->front()->setMyTurn(0);
currentHand->getSeatsList()->front()->setMyAction(2);
2007-01-13 02:40:33 +00:00
2007-03-29 22:58:04 +00:00
//set that i was the last active player. need this for unhighlighting groupbox
currentHand->setLastPlayersTurn(0);
2007-03-29 22:58:04 +00:00
2007-03-31 00:04:36 +00:00
statusBar()->clearMessage();
2007-01-13 02:40:33 +00:00
//Spiel läuft weiter
myActionDone();
2007-01-13 02:40:33 +00:00
}
int mainWindowImpl::getMyCallAmount() {
int tempHighestSet = 0;
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
tempHighestSet = currentHand->getCurrentBeRo()->getHighestSet();
if (currentHand->getPlayerArray()[0]->getMyCash()+currentHand->getPlayerArray()[0]->getMySet() <= tempHighestSet) {
return currentHand->getPlayerArray()[0]->getMyCash();
}
else {
return tempHighestSet - currentHand->getPlayerArray()[0]->getMySet();
}
}
2007-01-13 02:40:33 +00:00
void mainWindowImpl::myCall(){
int tempHighestSet = 0;
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
2007-08-08 00:17:31 +00:00
tempHighestSet = currentHand->getCurrentBeRo()->getHighestSet();
2007-01-13 02:40:33 +00:00
if (currentHand->getSeatsList()->front()->getMyCash()+currentHand->getSeatsList()->front()->getMySet() <= tempHighestSet) {
2007-01-13 02:40:33 +00:00
currentHand->getSeatsList()->front()->setMySet(currentHand->getSeatsList()->front()->getMyCash());
currentHand->getSeatsList()->front()->setMyCash(0);
currentHand->getSeatsList()->front()->setMyAction(6);
2007-01-13 02:40:33 +00:00
}
else {
currentHand->getSeatsList()->front()->setMySet(tempHighestSet - currentHand->getSeatsList()->front()->getMySet());
currentHand->getSeatsList()->front()->setMyAction(3);
2007-01-13 02:40:33 +00:00
}
currentHand->getSeatsList()->front()->setMyTurn(0);
2007-01-13 02:40:33 +00:00
currentHand->getBoard()->collectSets();
2007-01-13 02:40:33 +00:00
refreshPot();
2007-03-29 22:58:04 +00:00
//set that i was the last active player. need this for unhighlighting groupbox
currentHand->setLastPlayersTurn(0);
2007-03-29 22:58:04 +00:00
2007-03-31 00:04:36 +00:00
statusBar()->clearMessage();
2007-01-13 02:40:33 +00:00
//Spiel läuft weiter
myActionDone();
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::myBet(){
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
2007-09-02 20:14:14 +00:00
spinBox_set->setMinimum(currentHand->getSmallBlind()*2);
horizontalSlider_bet->setMinimum(currentHand->getSmallBlind()*2);
spinBox_set->setMaximum(currentHand->getSeatsList()->front()->getMyCash());
horizontalSlider_bet->setMaximum(currentHand->getSeatsList()->front()->getMyCash());
2007-01-13 02:40:33 +00:00
spinBox_set->setValue(spinBox_set->minimum());
2007-10-16 23:07:59 +00:00
horizontalSlider_bet->setSingleStep(10);
2007-10-16 21:48:53 +00:00
if(lineEdit_ChatInput->text() == "") {
spinBox_set->setFocus();
spinBox_set->selectAll();
}
2007-01-13 02:40:33 +00:00
2007-05-26 12:40:45 +00:00
myActionIsBet = 1;
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::myRaise(){
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
2007-01-13 02:40:33 +00:00
spinBox_set->setMinimum(currentHand->getCurrentBeRo()->getHighestSet() - currentHand->getSeatsList()->front()->getMySet() + currentHand->getCurrentBeRo()->getMinimumRaise());
horizontalSlider_bet->setMinimum(currentHand->getCurrentBeRo()->getHighestSet() - currentHand->getSeatsList()->front()->getMySet() + currentHand->getCurrentBeRo()->getMinimumRaise());
spinBox_set->setMaximum(currentHand->getSeatsList()->front()->getMyCash());
horizontalSlider_bet->setMaximum(currentHand->getSeatsList()->front()->getMyCash());
2007-01-13 02:40:33 +00:00
spinBox_set->setValue(spinBox_set->minimum());
2007-10-16 23:07:59 +00:00
horizontalSlider_bet->setSingleStep(10);
2007-10-16 21:48:53 +00:00
if(lineEdit_ChatInput->text() == "") {
spinBox_set->setFocus();
spinBox_set->selectAll();
}
2007-05-26 12:40:45 +00:00
myActionIsRaise = 1;
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::mySet(){
if(!pushButton_BetRaise->isCheckable() && pushButton_BetRaise->text() != "") {
2007-01-13 02:40:33 +00:00
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
int tempCash = currentHand->getSeatsList()->front()->getMyCash();
2007-05-26 12:40:45 +00:00
// cout << "Set-Value " << spinBox_set->value() << endl;
currentHand->getSeatsList()->front()->setMySet(spinBox_set->value());
// cout << "MySET " << currentHand->getPlayerArray()[0]->getMySet() << endl;
if (spinBox_set->value() >= tempCash ) {
currentHand->getSeatsList()->front()->setMySet(currentHand->getSeatsList()->front()->getMyCash());
currentHand->getSeatsList()->front()->setMyCash(0);
currentHand->getSeatsList()->front()->setMyAction(6);
2007-05-30 21:36:48 +00:00
}
if(myActionIsRaise) {
//do not if allIn
if(currentHand->getSeatsList()->front()->getMyAction() != 6) {
currentHand->getSeatsList()->front()->setMyAction(5);
}
myActionIsRaise = 0;
2007-05-26 12:40:45 +00:00
currentHand->getCurrentBeRo()->setMinimumRaise(currentHand->getSeatsList()->front()->getMySet() - currentHand->getCurrentBeRo()->getHighestSet());
}
if(myActionIsBet) {
//do not if allIn
if(currentHand->getSeatsList()->front()->getMyAction() != 6) {
currentHand->getSeatsList()->front()->setMyAction(4);
}
myActionIsBet = 0;
currentHand->getCurrentBeRo()->setMinimumRaise(currentHand->getSeatsList()->front()->getMySet());
}
currentHand->getCurrentBeRo()->setHighestSet(currentHand->getSeatsList()->front()->getMySet());
currentHand->getSeatsList()->front()->setMyTurn(0);
currentHand->getBoard()->collectSets();
refreshPot();
statusBar()->clearMessage();
//set that i was the last active player. need this for unhighlighting groupbox
currentHand->setLastPlayersTurn(0);
//Spiel läuft weiter
myActionDone();
2007-05-26 12:40:45 +00:00
}
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::myAllIn(){
2007-05-26 12:40:45 +00:00
// HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
//
// currentHand->getSeatsList()->front()->setMySet(currentHand->getSeatsList()->front()->getMyCash());
// currentHand->getSeatsList()->front()->setMyCash(0);
// currentHand->getSeatsList()->front()->setMyAction(6);
//
// if(currentHand->getSeatsList()->front()->getMySet() > currentHand->getCurrentBeRo()->getHighestSet()) {
// currentHand->getCurrentBeRo()->setMinimumRaise(currentHand->getSeatsList()->front()->getMySet() - currentHand->getCurrentBeRo()->getHighestSet());
//
// currentHand->getCurrentBeRo()->setHighestSet(currentHand->getSeatsList()->front()->getMySet());
//
// }
//
// currentHand->getSeatsList()->front()->setMyTurn(0);
//
// currentHand->getBoard()->collectSets();
// refreshPot();
//
// statusBar()->clearMessage();
//
// //set that i was the last active player. need this for unhighlighting groupbox
// currentHand->setLastPlayersTurn(0);
//
// //Spiel läuft weiter
// myActionDone();
}
void mainWindowImpl::myActionDone() {
// If a network client is running, we need
// to transfer the action to the server.
mySession->sendClientPlayerAction();
// TODO: Should not call in networking game.
disableMyButtons();
if (!mySession->isNetworkClientRunning())
nextPlayerAnimation();
//prevent escape button working while allIn
myActionIsRaise = 0;
myActionIsBet = 0;
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::nextPlayerAnimation() {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
2007-03-29 22:58:04 +00:00
//refresh Change Player
refreshSet();
// refreshAction(currentHand->getLastPlayersTurn(), currentHand->getPlayerArray()[currentHand->getLastPlayersTurn()]->getMyAction());
PlayerListConstIterator it_c;
for(it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
if((*it_c)->getMyID() == currentHand->getLastPlayersTurn()) break;
}
refreshAction(currentHand->getLastPlayersTurn(), (*it_c)->getMyAction());
2007-05-23 22:31:56 +00:00
refreshCash();
2007-03-29 22:58:04 +00:00
//refresh actions for human player
provideMyActions();
2007-01-23 19:20:18 +00:00
nextPlayerAnimationTimer->start(nextPlayerSpeed1);
2007-01-13 02:40:33 +00:00
}
2007-08-07 13:07:39 +00:00
void mainWindowImpl::beRoAnimation2(int myBeRoID) {
switch(myBeRoID) {
case 0: { preflopAnimation2(); }
break;
case 1: { flopAnimation2(); }
break;
case 2: { turnAnimation2(); }
break;
case 3: { riverAnimation2(); }
break;
2007-08-31 13:09:07 +00:00
default: { cout << "beRoAnimation2() Error" << endl; }
2007-08-07 13:07:39 +00:00
}
}
2007-01-23 19:20:18 +00:00
void mainWindowImpl::preflopAnimation1() { preflopAnimation1Timer->start(nextPlayerSpeed2); }
2007-08-08 00:17:31 +00:00
void mainWindowImpl::preflopAnimation1Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->run(); }
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
void mainWindowImpl::preflopAnimation2() { preflopAnimation2Timer->start(preflopNextPlayerSpeed); }
2007-08-08 00:17:31 +00:00
void mainWindowImpl::preflopAnimation2Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->nextPlayer(); }
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
void mainWindowImpl::flopAnimation1() { flopAnimation1Timer->start(nextPlayerSpeed2); }
2007-08-08 00:17:31 +00:00
void mainWindowImpl::flopAnimation1Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->run(); }
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
void mainWindowImpl::flopAnimation2() { flopAnimation2Timer->start(nextPlayerSpeed3); }
2007-08-08 00:17:31 +00:00
void mainWindowImpl::flopAnimation2Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->nextPlayer(); }
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
void mainWindowImpl::turnAnimation1() { turnAnimation1Timer->start(nextPlayerSpeed2); }
2007-08-08 00:17:31 +00:00
void mainWindowImpl::turnAnimation1Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->run(); }
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
void mainWindowImpl::turnAnimation2() { turnAnimation2Timer->start(nextPlayerSpeed3); }
2007-08-08 00:17:31 +00:00
void mainWindowImpl::turnAnimation2Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->nextPlayer(); }
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
void mainWindowImpl::riverAnimation1() { riverAnimation1Timer->start(nextPlayerSpeed2); }
2007-08-08 00:17:31 +00:00
void mainWindowImpl::riverAnimation1Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->run(); }
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
void mainWindowImpl::riverAnimation2() { riverAnimation2Timer->start(nextPlayerSpeed3); }
2007-08-08 00:17:31 +00:00
void mainWindowImpl::riverAnimation2Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->nextPlayer(); }
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
void mainWindowImpl::postRiverAnimation1() { postRiverAnimation1Timer->start(nextPlayerSpeed2); }
void mainWindowImpl::postRiverAnimation1Action() { mySession->getCurrentGame()->getCurrentHand()->getCurrentBeRo()->postRiverRun(); }
2007-01-13 02:40:33 +00:00
2007-08-11 14:36:20 +00:00
void mainWindowImpl::postRiverRunAnimation1() { postRiverRunAnimation1Timer->start(postRiverRunAnimationSpeed); }
2007-01-13 02:40:33 +00:00
void mainWindowImpl::postRiverRunAnimation2() {
// int i;
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
2007-01-13 02:40:33 +00:00
//Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen
// int activePlayersCounter = 0;
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// if (currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyActiveStatus()) activePlayersCounter++;
// }
int nonfoldPlayersCounter = 0;
PlayerListConstIterator it_c;
for (it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
2007-10-05 12:49:23 +00:00
if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD)
nonfoldPlayersCounter++;
2007-01-13 02:40:33 +00:00
}
// if(nonfoldPlayersCounter!=1) {
//
// if(!flipHolecardsAllInAlreadyDone) {
//
// //TODO - Turn cards like in the rules
//
// // postRiverRunAnimation2_flipHoleCards1Timer->start(nextPlayerSpeed2);
//
// // //Config? mit oder ohne Eye-Candy?
// if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
// // mit Eye-Candy
//
// //TempArrays
// int tempCardsIntArray[2];
//
// int i, j;
//
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// currentHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
// if(i || (i==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
// for(j=0; j<2; j++) {
//
// holeCardsArray[i][j]->startFlipCards(guiGameSpeed, QPixmap(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png"), flipside);
// }
// }
// //set Player value (logging)
// currentHand->getPlayerArray()[i]->setMyCardsFlip(1,1);
// }
// }
// }
// else {
// //Ohne Eye-Candy
//
// //Karten der aktiven Spieler umdrehen
// QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
//
// //TempArrays
// QPixmap tempCardsPixmapArray[2];
// int tempCardsIntArray[2];
//
// int i, j;
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// currentHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
// if(i || (i==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
// for(j=0; j<2; j++) {
// tempCardsPixmapArray[j].load(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png");
// holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j], FALSE);
//
// }
// }
// //set Player value (logging)
// currentHand->getPlayerArray()[i]->setMyCardsFlip(1,1);
// }
// }
// }
// //Wenn einmal umgedreht dann fertig!!
// flipHolecardsAllInAlreadyDone = TRUE;
// }
// else {
// int tempCardsIntArray[2];
// int i;
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// currentHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
//
// //set Player value (logging)
// currentHand->getPlayerArray()[i]->setMyCardsFlip(1,3);
// }
// }
// }
// postRiverRunAnimation2Timer->start(postRiverRunAnimationSpeed);
// }
// else { postRiverRunAnimation3(); }
if(nonfoldPlayersCounter!=1) {
2007-01-13 02:40:33 +00:00
if(!flipHolecardsAllInAlreadyDone) {
2007-08-11 14:36:20 +00:00
//TODO - Turn cards like in the rules
// postRiverRunAnimation2_flipHoleCards1Timer->start(nextPlayerSpeed2);
// //Config? mit oder ohne Eye-Candy?
2007-02-03 22:47:16 +00:00
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
// mit Eye-Candy
//TempArrays
int tempCardsIntArray[2];
int j;
2007-02-13 02:00:11 +00:00
2007-10-05 12:04:38 +00:00
for (it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
(*it_c)->getMyCards(tempCardsIntArray);
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
2007-10-05 12:04:38 +00:00
if((*it_c)->getMyID() || ((*it_c)->getMyID()==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
2007-02-22 21:35:44 +00:00
for(j=0; j<2; j++) {
2007-10-02 14:44:25 +00:00
holeCardsArray[(*it_c)->getMyID()][j]->startFlipCards(guiGameSpeed, QPixmap(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png"), flipside);
2007-02-22 21:35:44 +00:00
}
}
2007-05-29 13:15:58 +00:00
//set Player value (logging)
(*it_c)->setMyCardsFlip(1,1);
}
2007-02-22 21:35:44 +00:00
}
2007-01-13 02:40:33 +00:00
}
else {
//Ohne Eye-Candy
//Karten der aktiven Spieler umdrehen
QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
//TempArrays
QPixmap tempCardsPixmapArray[2];
int tempCardsIntArray[2];
int j;
for (it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
(*it_c)->getMyCards(tempCardsIntArray);
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
if((*it_c)->getMyID() || ((*it_c)->getMyID()==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
2007-02-22 21:35:44 +00:00
for(j=0; j<2; j++) {
tempCardsPixmapArray[j].load(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png");
holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(tempCardsPixmapArray[j], FALSE);
2007-02-22 21:35:44 +00:00
}
}
2007-05-29 13:15:58 +00:00
//set Player value (logging)
(*it_c)->setMyCardsFlip(1,1);
}
}
}
//Wenn einmal umgedreht dann fertig!!
flipHolecardsAllInAlreadyDone = TRUE;
2007-01-13 02:40:33 +00:00
}
2007-03-17 12:02:28 +00:00
else {
2007-03-17 14:58:12 +00:00
int tempCardsIntArray[2];
// int i;
for (it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
(*it_c)->getMyCards(tempCardsIntArray);
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
2007-03-17 14:58:12 +00:00
2007-05-29 13:15:58 +00:00
//set Player value (logging)
(*it_c)->setMyCardsFlip(1,3);
2007-03-17 14:58:12 +00:00
}
}
2007-03-17 12:02:28 +00:00
}
2007-01-23 19:20:18 +00:00
postRiverRunAnimation2Timer->start(postRiverRunAnimationSpeed);
2007-01-13 02:40:33 +00:00
}
else { postRiverRunAnimation3(); }
2007-01-13 02:40:33 +00:00
}
2007-08-11 14:36:20 +00:00
// TODO
void mainWindowImpl::postRiverRunAnimation2_flipHoleCards1() {
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
currentHand->getCurrentBeRo()->setPlayersTurn(currentHand->getCurrentBeRo()->getLastActionPlayer());
postRiverRunAnimation2_flipHoleCards2Timer->start(nextPlayerSpeed2);
}
void mainWindowImpl::postRiverRunAnimation2_flipHoleCards2() {
// if() {
// postRiverRunAnimation2_flipHoleCards1Timer->start(nextPlayerSpeed2);
// }
// else {
// postRiverRunAnimation2Timer->start(postRiverRunAnimationSpeed);
// }
}
2007-01-13 02:40:33 +00:00
void mainWindowImpl::postRiverRunAnimation3() {
// int i;
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
2007-01-13 02:40:33 +00:00
//Alle Winner erhellen und "Winner" schreiben
2007-08-11 14:36:20 +00:00
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
//
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyCardsValueInt() == currentHand->getCurrentBeRo()->getHighestCardsValue() ) {
//
// // QPalette tempPalette = groupBoxArray[i]->palette();
// // tempPalette.setColor(QPalette::Window, highlight);
// // groupBoxArray[i]->setPalette(tempPalette);
// actionLabelArray[i]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/action_winner.png"));
//
// //show winnercards if more than one player is active TODO
// if ( currentHand->getActivePlayerList()->size() != 1 && myConfig->readConfigInt("ShowFadeOutCardsAnimation")) {
//
// int j;
// int bestHandPos[5];
// currentHand->getPlayerArray()[i]->getMyBestHandPosition(bestHandPos);
//
// //index 0 testen --> Karte darf nicht im MyBestHand Position Array drin sein, es darf nicht nur ein Spieler Aktiv sein, die Config fordert die Animation
// bool index0 = TRUE;
// for(j=0; j<5; j++) {
// // cout << (currentHand->getPlayerArray()[i]->getMyBestHandPosition())[j] << endl;
// if (bestHandPos[j] == 0 ) { index0 = FALSE; }
// }
// if (index0) { holeCardsArray[i][0]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index0" << endl;*/}
// //index 1 testen
// bool index1 = TRUE;
// for(j=0; j<5; j++) {
// if (bestHandPos[j] == 1 ) { index1 = FALSE; }
// }
// if (index1) { holeCardsArray[i][1]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index1" << endl;*/}
// //index 2 testen
// bool index2 = TRUE;
// for(j=0; j<5; j++) {
// if (bestHandPos[j] == 2 ) { index2 = FALSE; }
// }
// if (index2) { boardCardsArray[0]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index2" << endl;*/}
// //index 3 testen
// bool index3 = TRUE;
// for(j=0; j<5; j++) {
// if (bestHandPos[j] == 3 ) { index3 = FALSE; }
// }
// if (index3) { boardCardsArray[1]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index3" << endl;*/}
// //index 4 testen
// bool index4 = TRUE;
// for(j=0; j<5; j++) {
// if (bestHandPos[j] == 4 ) { index4 = FALSE; }
// }
// if (index4) { boardCardsArray[2]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index4" << endl;*/}
// //index 5 testen
// bool index5 = TRUE;
// for(j=0; j<5; j++) {
// if (bestHandPos[j] == 5 ) { index5 = FALSE; }
// }
// if (index5) { boardCardsArray[3]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index5" << endl;*/}
// //index 6 testen
// bool index6 = TRUE;
// for(j=0; j<5; j++) {
// if (bestHandPos[j] == 6 ) { index6 = FALSE; }
// }
// if (index6) { boardCardsArray[4]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index6" << endl;*/}
// }
// //Pot-Verteilung Loggen
// //Pro Spieler den Cash aus dem Player und dem Label auslesen. Player_cash - Label_cash = Gewinnsumme
// bool toIntBool = TRUE;
// int pot = currentHand->getPlayerArray()[i]->getMyCash() - cashLabelArray[i]->text().remove(" $").toInt(&toIntBool,10) ;
// //Wenn River dann auch das Blatt loggen!
// // if (textLabel_handLabel->text() == "River") {
//
// //set Player value (logging)
// currentHand->getPlayerArray()[i]->setMyWinnerState(1, pot);
//
// // }
// // else {
// // myLog->logPlayerWinsMsg(i, pot);
// // }
// }
// else {
//
// if( currentHand->getActivePlayerList()->size() != 1 && currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyActiveStatus() && myConfig->readConfigInt("ShowFadeOutCardsAnimation") ) {
//
// //aufgedeckte Gegner auch ausblenden
// holeCardsArray[i][0]->startFadeOut(guiGameSpeed);
// holeCardsArray[i][1]->startFadeOut(guiGameSpeed);
// }
// }
// }
2007-09-30 21:49:51 +00:00
int nonfoldPlayerCounter = 0;
PlayerListConstIterator it_c;
2007-09-30 21:49:51 +00:00
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
nonfoldPlayerCounter++;
}
}
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() == currentHand->getCurrentBeRo()->getHighestCardsValue() ) {
2007-02-04 23:58:50 +00:00
2007-03-27 16:02:23 +00:00
// QPalette tempPalette = groupBoxArray[i]->palette();
// tempPalette.setColor(QPalette::Window, highlight);
// groupBoxArray[i]->setPalette(tempPalette);
actionLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap(myAppDataPath +"gfx/gui/table/default/action_winner.png"));
2007-01-28 01:28:19 +00:00
//show winnercards if more than one player is active TODO
2007-09-30 21:49:51 +00:00
if ( nonfoldPlayerCounter != 1 && myConfig->readConfigInt("ShowFadeOutCardsAnimation")) {
2007-01-28 01:28:19 +00:00
int j;
int bestHandPos[5];
(*it_c)->getMyBestHandPosition(bestHandPos);
//index 0 testen --> Karte darf nicht im MyBestHand Position Array drin sein, es darf nicht nur ein Spieler Aktiv sein, die Config fordert die Animation
bool index0 = TRUE;
2007-04-30 11:56:31 +00:00
for(j=0; j<5; j++) {
// cout << (currentHand->getPlayerArray()[i]->getMyBestHandPosition())[j] << endl;
if (bestHandPos[j] == 0 ) { index0 = FALSE; }
}
if (index0) { holeCardsArray[(*it_c)->getMyID()][0]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index0" << endl;*/}
//index 1 testen
bool index1 = TRUE;
2007-04-30 11:56:31 +00:00
for(j=0; j<5; j++) {
if (bestHandPos[j] == 1 ) { index1 = FALSE; }
}
if (index1) { holeCardsArray[(*it_c)->getMyID()][1]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index1" << endl;*/}
//index 2 testen
bool index2 = TRUE;
2007-04-30 11:56:31 +00:00
for(j=0; j<5; j++) {
if (bestHandPos[j] == 2 ) { index2 = FALSE; }
}
if (index2) { boardCardsArray[0]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index2" << endl;*/}
//index 3 testen
bool index3 = TRUE;
2007-04-30 11:56:31 +00:00
for(j=0; j<5; j++) {
if (bestHandPos[j] == 3 ) { index3 = FALSE; }
}
if (index3) { boardCardsArray[1]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index3" << endl;*/}
//index 4 testen
bool index4 = TRUE;
2007-04-30 11:56:31 +00:00
for(j=0; j<5; j++) {
if (bestHandPos[j] == 4 ) { index4 = FALSE; }
}
if (index4) { boardCardsArray[2]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index4" << endl;*/}
//index 5 testen
bool index5 = TRUE;
2007-04-30 11:56:31 +00:00
for(j=0; j<5; j++) {
if (bestHandPos[j] == 5 ) { index5 = FALSE; }
}
if (index5) { boardCardsArray[3]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index5" << endl;*/}
//index 6 testen
bool index6 = TRUE;
2007-04-30 11:56:31 +00:00
for(j=0; j<5; j++) {
if (bestHandPos[j] == 6 ) { index6 = FALSE; }
}
if (index6) { boardCardsArray[4]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index6" << endl;*/}
2007-02-02 00:59:51 +00:00
}
2007-02-13 02:00:11 +00:00
//Pot-Verteilung Loggen
//Pro Spieler den Cash aus dem Player und dem Label auslesen. Player_cash - Label_cash = Gewinnsumme
bool toIntBool = TRUE;
int pot = (*it_c)->getMyCash() - cashLabelArray[(*it_c)->getMyID()]->text().remove(" $").toInt(&toIntBool,10) ;
2007-02-14 23:24:17 +00:00
//Wenn River dann auch das Blatt loggen!
// if (textLabel_handLabel->text() == "River") {
2007-05-29 13:15:58 +00:00
//set Player value (logging)
(*it_c)->setMyWinnerState(1, pot);
2007-05-29 13:15:58 +00:00
2007-02-14 23:24:17 +00:00
// }
// else {
// myLog->logPlayerWinsMsg(i, pot);
// }
2007-02-02 00:59:51 +00:00
}
else {
if( currentHand->getActivePlayerList()->size() != 1 && (*it_c)->getMyAction() != PLAYER_ACTION_FOLD && myConfig->readConfigInt("ShowFadeOutCardsAnimation") ) {
2007-02-02 00:59:51 +00:00
//aufgedeckte Gegner auch ausblenden
holeCardsArray[(*it_c)->getMyID()][0]->startFadeOut(guiGameSpeed);
holeCardsArray[(*it_c)->getMyID()][1]->startFadeOut(guiGameSpeed);
2007-02-02 00:59:51 +00:00
}
2007-01-13 02:40:33 +00:00
}
}
2007-03-28 10:21:51 +00:00
2007-01-23 19:20:18 +00:00
postRiverRunAnimation3Timer->start(postRiverRunAnimationSpeed/2);
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::postRiverRunAnimation4() {
distributePotAnimCounter=0;
potDistributeTimer->start(winnerBlinkSpeed);
}
void mainWindowImpl::postRiverRunAnimation5() {
// int i;
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
2007-01-13 02:40:33 +00:00
//CashTopLabel und PotLabel blinken lassen
// if (distributePotAnimCounter<10) {
//
// if (distributePotAnimCounter==0 || distributePotAnimCounter==2 || distributePotAnimCounter==4 || distributePotAnimCounter==6 || distributePotAnimCounter==8) {
//
// label_Pot->setText("");
//
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyCardsValueInt() == currentHand->getCurrentBeRo()->getHighestCardsValue() ) {
//
// cashTopLabelArray[i]->setText("");
// }
// }
// }
// else {
// label_Pot->setText("Pot");
//
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyCardsValueInt() == currentHand->getCurrentBeRo()->getHighestCardsValue() ) {
//
// cashTopLabelArray[i]->setText("Cash:");
// }
// }
// }
//
// distributePotAnimCounter++;
// }
// else {
// potDistributeTimer->stop();
// postRiverRunAnimation5Timer->start(gameSpeed);
// }
PlayerListConstIterator it_c;
2007-01-13 02:40:33 +00:00
if (distributePotAnimCounter<10) {
if (distributePotAnimCounter==0 || distributePotAnimCounter==2 || distributePotAnimCounter==4 || distributePotAnimCounter==6 || distributePotAnimCounter==8) {
2007-03-27 16:02:23 +00:00
label_Pot->setText("");
2007-01-13 02:40:33 +00:00
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() == currentHand->getCurrentBeRo()->getHighestCardsValue() ) {
2007-01-13 02:40:33 +00:00
cashTopLabelArray[(*it_c)->getMyID()]->setText("");
2007-01-13 02:40:33 +00:00
}
}
}
else {
2007-09-06 21:58:36 +00:00
label_Pot->setText("Pot");
2007-01-13 02:40:33 +00:00
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() == currentHand->getCurrentBeRo()->getHighestCardsValue() ) {
2007-01-13 02:40:33 +00:00
cashTopLabelArray[(*it_c)->getMyID()]->setText("Cash:");
2007-01-13 02:40:33 +00:00
}
}
}
distributePotAnimCounter++;
}
else {
potDistributeTimer->stop();
2007-01-23 19:20:18 +00:00
postRiverRunAnimation5Timer->start(gameSpeed);
2007-01-13 02:40:33 +00:00
}
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::postRiverRunAnimation6() {
// int i;
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
2007-04-03 10:55:16 +00:00
2007-01-13 02:40:33 +00:00
refreshCash();
refreshPot();
// TODO HACK
// Check for network client, do not start new hand if client is running.
if (mySession->isNetworkClientRunning())
return;
2007-01-13 02:40:33 +00:00
// wenn nur noch ein Spieler aktive "neues Spiel"-Dialog anzeigen
int playersPositiveCashCounter = 0;
// for (i=0; i<mySession->getCurrentGame()->getStartQuantityPlayers(); i++) {
// // cout << "player 0 cash: " << currentHand->getPlayerArray()[0]->getMyCash()
//
// if (currentHand->getPlayerArray()[i]->getMyCash() > 0)
// playersPositiveCashCounter++;
// }
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
// cout << "player 0 cash: " << currentHand->getPlayerArray()[0]->getMyCash()
2007-01-13 02:40:33 +00:00
if ((*it_c)->getMyCash() > 0) playersPositiveCashCounter++;
2007-01-13 02:40:33 +00:00
}
2007-01-13 02:40:33 +00:00
if (playersPositiveCashCounter==1) {
2007-04-03 10:55:16 +00:00
// for (i=0; i<mySession->getCurrentGame()->getStartQuantityPlayers(); i++) {
// // cout << "player 0 cash: " << currentHand->getPlayerArray()[0]->getMyCash()
// if (currentHand->get/*PlayerArray*/()[i]->getMyCash() > 0) {
// (statisticArray[currentHand->getPlayerArray()[i]->getMyDude4()+7])++;
2007-04-03 10:55:16 +00:00
// }
// }
// for(i=0; i<15; i++) {
// cout << i-7 << ": " << statisticArray[i] << " | ";
// }
// cout << endl;
2007-01-13 02:40:33 +00:00
callNewGameDialog();
2007-01-29 21:25:33 +00:00
//Bei Cancel nichts machen!!!
return;
2007-01-13 02:40:33 +00:00
}
2007-01-29 21:25:33 +00:00
2007-01-23 19:20:18 +00:00
postRiverRunAnimation6Timer->start(newRoundSpeed);
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::flipHolecardsAllIn() {
// int i;
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
// if(!flipHolecardsAllInAlreadyDone) {
// //Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen
// int activePlayersCounter = 0;
// for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// if (currentHand->getPlayerArray()[i]->getMyAction() != 1 && currentHand->getPlayerArray()[i]->getMyActiveStatus() == 1) activePlayersCounter++;
// }
//
// if(activePlayersCounter!=1) {
//
// //Config? mit oder ohne Eye-Candy?
// if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
// // mit Eye-Candy
//
// //TempArrays
// int tempCardsIntArray[2];
//
// int i, j;
//
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// currentHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
// if(i || (i==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
// for(j=0; j<2; j++) {
// holeCardsArray[i][j]->startFlipCards(guiGameSpeed, QPixmap(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png"), flipside);
// }
// }
// //set Player value (logging)
// currentHand->getPlayerArray()[i]->setMyCardsFlip(1,2);
//
// }
// }
// }
// else {
// //Ohne Eye-Candy
//
// //Karten der aktiven Spieler umdrehen
// QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
//
// //TempArrays
// QPixmap tempCardsPixmapArray[2];
// int temp2CardsIntArray[2];
//
// int i, j;
// for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
// currentHand->getPlayerArray()[i]->getMyCards(temp2CardsIntArray);
// if(currentHand->getPlayerArray()[i]->getMyActiveStatus() && currentHand->getPlayerArray()[i]->getMyAction() != 1) {
// if(i || (i==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
// for(j=0; j<2; j++) {
//
// tempCardsPixmapArray[j].load(myAppDataPath +"gfx/cards/default/"+QString::number(temp2CardsIntArray[j], 10)+".png");
// holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j], FALSE);
// }
// }
// //set Player value (logging)
// currentHand->getPlayerArray()[i]->setMyCardsFlip(1,2);
// }
// }
// }
// }
// }
if(!flipHolecardsAllInAlreadyDone) {
//Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen
int nonfoldPlayersCounter = 0;
PlayerListConstIterator it_c;
for (it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
if ((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) nonfoldPlayersCounter++;
}
if(nonfoldPlayersCounter!=1) {
//Config? mit oder ohne Eye-Candy?
2007-02-03 22:47:16 +00:00
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
// mit Eye-Candy
//TempArrays
int tempCardsIntArray[2];
int j;
for (it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
(*it_c)->getMyCards(tempCardsIntArray);
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
if((*it_c)->getMyID() || ((*it_c)->getMyID()==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
2007-02-22 21:35:44 +00:00
for(j=0; j<2; j++) {
holeCardsArray[(*it_c)->getMyID()][j]->startFlipCards(guiGameSpeed, QPixmap(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[j], 10)+".png"), flipside);
2007-02-22 21:35:44 +00:00
}
2007-02-13 02:00:11 +00:00
}
2007-05-29 13:15:58 +00:00
//set Player value (logging)
(*it_c)->setMyCardsFlip(1,2);
2007-02-13 02:00:11 +00:00
}
2007-02-22 21:35:44 +00:00
}
}
else {
//Ohne Eye-Candy
//Karten der aktiven Spieler umdrehen
QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
//TempArrays
QPixmap tempCardsPixmapArray[2];
int temp2CardsIntArray[2];
int j;
for (it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
(*it_c)->getMyCards(temp2CardsIntArray);
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
if((*it_c)->getMyID() || ((*it_c)->getMyID()==0 && myConfig->readConfigInt("AntiPeekMode")) ) {
2007-02-22 21:35:44 +00:00
for(j=0; j<2; j++) {
tempCardsPixmapArray[j].load(myAppDataPath +"gfx/cards/default/"+QString::number(temp2CardsIntArray[j], 10)+".png");
holeCardsArray[(*it_c)->getMyID()][j]->setPixmap(tempCardsPixmapArray[j], FALSE);
2007-02-22 21:35:44 +00:00
}
}
2007-05-29 13:15:58 +00:00
//set Player value (logging)
(*it_c)->setMyCardsFlip(1,2);
}
}
}
2007-02-13 02:00:11 +00:00
}
}
2007-02-13 02:00:11 +00:00
//Wenn einmal umgedreht dann fertig!!
flipHolecardsAllInAlreadyDone = TRUE;
}
2007-02-28 20:51:43 +00:00
void mainWindowImpl::showMyCards() {
//TempArrays
int tempCardsIntArray[2];
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
2007-02-28 20:51:43 +00:00
currentHand->getSeatsList()->front()->getMyCards(tempCardsIntArray);
if( currentHand->getSeatsList()->front()->getMyCardsFlip() == 0 && currentHand->getActualRound() == 4 && currentHand->getSeatsList()->front()->getMyActiveStatus() && currentHand->getSeatsList()->front()->getMyAction() != PLAYER_ACTION_FOLD) {
2007-05-29 13:15:58 +00:00
//set Player value (logging)
currentHand->getSeatsList()->front()->setMyCardsFlip(1,1);
2007-02-28 20:51:43 +00:00
}
}
2007-01-13 02:40:33 +00:00
void mainWindowImpl::startNewHand() {
if( !breakAfterActualHand){
mySession->getCurrentGame()->initHand();
mySession->getCurrentGame()->startHand();
2007-03-21 00:59:05 +00:00
}
else {
pushButton_break->setDisabled(FALSE);
2007-05-02 21:51:02 +00:00
QFontMetrics tempMetrics = this->fontMetrics();
int width = tempMetrics.width(tr("Start"));
pushButton_break->setMinimumSize(width+10,20);
2007-05-02 10:32:19 +00:00
pushButton_break->setText(tr("Start"));
2007-03-21 00:59:05 +00:00
breakAfterActualHand=FALSE;
2007-05-01 22:51:10 +00:00
blinkingStartButtonAnimationTimer->start(500);
2007-03-21 00:59:05 +00:00
}
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::handSwitchRounds() { mySession->getCurrentGame()->getCurrentHand()->switchRounds(); }
2007-01-23 23:53:12 +00:00
2007-01-13 02:40:33 +00:00
void mainWindowImpl::nextRoundCleanGui() {
int i,j;
2007-01-13 02:40:33 +00:00
// GUI bereinigen - Bilder löschen, Animationen unterbrechen
QPixmap onePix(myAppDataPath +"gfx/gui/misc/1px.png");
for (i=0; i<5; i++ ) {
boardCardsArray[i]->setPixmap(onePix, FALSE);
boardCardsArray[i]->setFadeOutAction(FALSE);
2007-05-18 08:13:05 +00:00
boardCardsArray[i]->stopFlipCardsAnimation();
2007-08-24 13:37:45 +00:00
setLabelArray[i]->stopTimeOutAnimation();
}
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++ ) {
for ( j=0; j<=1; j++ ) { holeCardsArray[i][j]->setFadeOutAction(FALSE);}
}
2007-01-13 02:40:33 +00:00
2007-03-27 16:02:23 +00:00
// QPalette labelPalette = label_Pot->palette();
// labelPalette.setColor(QPalette::WindowText, c);
// label_Pot->setPalette(labelPalette);
2007-01-13 02:40:33 +00:00
2007-03-29 22:58:04 +00:00
// for startNewGame during human player is active
if(mySession->getCurrentGame()->getCurrentHand()->getSeatsList()->front()->getMyActiveStatus() == 1) {
2007-03-29 22:58:04 +00:00
disableMyButtons();
}
2007-03-26 00:12:35 +00:00
// QPalette tempPalette = frame_Pot->palette();
// tempPalette.setColor(QPalette::Window, active);
// frame_Pot->setPalette(tempPalette);
2007-01-13 02:40:33 +00:00
2007-02-08 01:28:58 +00:00
textLabel_handLabel->setText("");
2007-01-13 02:40:33 +00:00
2007-03-26 00:12:35 +00:00
// tempPalette = frame_handLabel->palette();
// tempPalette.setColor(QPalette::Window, active);
// frame_handLabel->setPalette(tempPalette);
2007-01-13 02:40:33 +00:00
refreshAll();
flipHolecardsAllInAlreadyDone = FALSE;
//Wenn Pause zwischen den Hands in der Konfiguration steht den Stop Button drücken!
2007-05-03 22:44:08 +00:00
if (myConfig->readConfigInt("PauseBetweenHands") && blinkingStartButtonAnimationTimer->isActive() == FALSE ) {
pushButton_break->click();
}
2007-02-10 21:52:05 +00:00
else {
//FIX STRG+N Bug
pushButton_break->setEnabled(TRUE);
breakAfterActualHand=FALSE;
}
2007-05-03 22:44:08 +00:00
//Clean breakbutton
blinkingStartButtonAnimationTimer->stop();
pushButton_break->setStyleSheet("QPushButton { background-color: #145300; color: white;}");
2007-05-03 22:44:08 +00:00
blinkingStartButtonAnimationTimer->stop();
QFontMetrics tempMetrics = this->fontMetrics();
int width = tempMetrics.width(tr("Stop"));
pushButton_break->setMinimumSize(width+10,20);
pushButton_break->setText(tr("Stop"));
2007-02-10 21:52:05 +00:00
//Clear Statusbarmessage
statusBar()->clearMessage();
2007-08-19 23:19:30 +00:00
//fix press mouse button during bankrupt with anti-peek-mode
this->mouseOverFlipCards(FALSE);
2007-01-13 02:40:33 +00:00
}
2007-01-23 23:53:12 +00:00
void mainWindowImpl::stopTimer() {
2007-01-23 19:20:18 +00:00
2007-01-23 23:53:12 +00:00
dealFlopCards0Timer->stop();
dealFlopCards1Timer->stop();
dealFlopCards2Timer->stop();
dealFlopCards3Timer->stop();
dealFlopCards4Timer->stop();
dealFlopCards5Timer->stop();
dealFlopCards6Timer->stop();
dealTurnCards0Timer->stop();
dealTurnCards1Timer->stop();
dealTurnCards2Timer->stop();
dealRiverCards0Timer->stop();
dealRiverCards1Timer->stop();
dealRiverCards2Timer->stop();
2007-01-23 19:20:18 +00:00
2007-01-23 23:53:12 +00:00
nextPlayerAnimationTimer->stop();
preflopAnimation1Timer->stop();
preflopAnimation2Timer->stop();
flopAnimation1Timer->stop();
flopAnimation2Timer->stop();
turnAnimation1Timer->stop();
turnAnimation2Timer->stop();
riverAnimation1Timer->stop();
riverAnimation2Timer->stop();
2007-01-23 19:20:18 +00:00
2007-01-23 23:53:12 +00:00
postRiverAnimation1Timer->stop();
postRiverRunAnimation1Timer->stop();
postRiverRunAnimation2Timer->stop();
postRiverRunAnimation3Timer->stop();
postRiverRunAnimation5Timer->stop();
postRiverRunAnimation6Timer->stop();
potDistributeTimer->stop();
2007-01-23 19:20:18 +00:00
}
2007-01-14 14:08:45 +00:00
void mainWindowImpl::setSpeeds() {
2007-01-15 09:07:34 +00:00
gameSpeed = (11-guiGameSpeed)*10;
2007-01-14 14:08:45 +00:00
dealCardsSpeed = (gameSpeed/2)*10; //milliseconds
preDealCardsSpeed = dealCardsSpeed*2; //Zeit for Karten aufdecken auf dem Board (Flop, Turn, River)
2007-03-29 22:58:04 +00:00
postDealCardsSpeed = dealCardsSpeed*3; //Zeit nach Karten aufdecken auf dem Board (Flop, Turn, River)
AllInDealCardsSpeed = dealCardsSpeed*4; //Zeit nach Karten aufdecken auf dem Board (Flop, Turn, River) bei AllIn
2007-01-14 14:08:45 +00:00
postRiverRunAnimationSpeed = gameSpeed*18;
winnerBlinkSpeed = gameSpeed*3; //milliseconds
newRoundSpeed = gameSpeed*35;
nextPlayerSpeed1 = gameSpeed*10; // Zeit zwischen dem Setzen des Spielers und dem Verdunkeln
nextPlayerSpeed2 = gameSpeed*4; // Zeit zwischen Verdunkeln des einen und aufhellen des anderen Spielers
nextPlayerSpeed3 = gameSpeed*7; // Zeit bis zwischen Aufhellen und Aktion
preflopNextPlayerSpeed = gameSpeed*10; // Zeit bis zwischen Aufhellen und Aktion im Preflop (etwas langsamer da nicht gerechnet wird. )
}
2007-01-14 19:58:40 +00:00
2007-01-15 08:35:26 +00:00
void mainWindowImpl::breakButtonClicked() {
2007-01-14 19:58:40 +00:00
2007-05-02 10:32:19 +00:00
if (pushButton_break->text() == tr("Stop")) {
2007-01-15 08:35:26 +00:00
pushButton_break->setDisabled(TRUE);
breakAfterActualHand=TRUE;
}
else {
2007-05-01 22:51:10 +00:00
blinkingStartButtonAnimationTimer->stop();
//Set default Color
pushButton_break->setStyleSheet("QPushButton { background-color: #145300; color: white;}");
2007-05-02 21:51:02 +00:00
QFontMetrics tempMetrics = this->fontMetrics();
int width = tempMetrics.width(tr("Stop"));
pushButton_break->setMinimumSize(width+10,20);
pushButton_break->setText(tr("Stop"));
2007-01-15 08:35:26 +00:00
startNewHand();
}
2007-01-14 19:58:40 +00:00
}
2007-01-27 09:08:55 +00:00
void mainWindowImpl::paintStartSplash() {
2007-09-08 22:01:30 +00:00
StartSplash *mySplash = new StartSplash(this, myConfig);
2007-04-30 23:14:30 +00:00
#ifdef __APPLE__
int offset = 305;
#else
int offset = 237;
#endif
mySplash->setGeometry(this->pos().x()+offset,this->pos().y()+210,400,250);
// mySplash->setWindowFlags(Qt::SplashScreen);
mySplash->show();
2007-01-27 09:08:55 +00:00
}
2007-01-24 23:46:49 +00:00
2007-04-30 23:14:30 +00:00
void mainWindowImpl::networkError(int errorID, int /*osErrorID*/) {
2007-03-21 00:41:29 +00:00
switch (errorID) {
case ERR_SOCK_SERVERADDR_NOT_SET:
{QMessageBox::warning(this, tr("Network Error"),
tr("Server address was not set."),
QMessageBox::Close); }
break;
case ERR_SOCK_INVALID_PORT:
{ QMessageBox::warning(this, tr("Network Error"),
tr("An invalid port was set (ports 0-1023 are not allowed)."),
QMessageBox::Close); }
break;
case ERR_SOCK_CREATION_FAILED:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Could not create a socket for TCP communication."),
QMessageBox::Close); }
break;
case ERR_SOCK_SET_ADDR_FAILED:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Could not set the IP address."),
QMessageBox::Close); }
break;
case ERR_SOCK_SET_PORT_FAILED:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Could not set the port for this type of address."),
QMessageBox::Close); }
break;
case ERR_SOCK_RESOLVE_FAILED:
{ QMessageBox::warning(this, tr("Network Error"),
tr("The server name could not be resolved."),
QMessageBox::Close); }
break;
case ERR_SOCK_BIND_FAILED:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Bind failed - please choose a different port."),
QMessageBox::Close); }
break;
case ERR_SOCK_LISTEN_FAILED:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Internal network error: \"listen\" failed."),
QMessageBox::Close); }
break;
case ERR_SOCK_ACCEPT_FAILED:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Server execution was terminated."),
QMessageBox::Close); }
break;
case ERR_SOCK_CONNECT_FAILED:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Could not connect to the server."),
QMessageBox::Close); }
break;
2007-05-20 11:11:07 +00:00
case ERR_SOCK_CONNECT_TIMEOUT:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Connection timed out.\nPlease check the server address.\n\nIf the server is behind a NAT-Router, make sure port forwarding has been set up on server side."),
QMessageBox::Close); }
break;
2007-03-21 00:41:29 +00:00
case ERR_SOCK_SELECT_FAILED:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Internal network error: \"select\" failed."),
QMessageBox::Close); }
break;
case ERR_SOCK_SEND_FAILED:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Internal network error: \"send\" failed."),
QMessageBox::Close); }
break;
case ERR_SOCK_RECV_FAILED: // Sometimes windows reports recv failed on close.
2007-03-21 00:41:29 +00:00
case ERR_SOCK_CONN_RESET:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Connection was closed by the server."),
2007-03-21 00:41:29 +00:00
QMessageBox::Close); }
break;
2007-04-29 18:48:20 +00:00
case ERR_SOCK_CONN_EXISTS:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Internal network error: Duplicate TCP connection."),
QMessageBox::Close); }
break;
2007-04-29 18:48:20 +00:00
case ERR_SOCK_INVALID_PACKET:
{ QMessageBox::warning(this, tr("Network Error"),
tr("An invalid network packet was received.\nPlease make sure that all players use the same version of PokerTH."),
QMessageBox::Close); }
break;
2007-04-29 18:48:20 +00:00
case ERR_SOCK_INVALID_STATE:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Internal state error.\nPlease make sure that all players use the same version of PokerTH."),
QMessageBox::Close); }
break;
2007-04-29 18:48:20 +00:00
case ERR_NET_VERSION_NOT_SUPPORTED:
{ QMessageBox::warning(this, tr("Network Error"),
2007-10-16 22:16:41 +00:00
tr("The PokerTH server does not support this version of the game.\nPlease go to <a href=\"http://www.pokerth.net/\" target=\"_blank\">http://www.pokerth.net/<a/> and download the latest version."),
QMessageBox::Close); }
break;
2007-04-29 18:48:20 +00:00
case ERR_NET_SERVER_FULL:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Sorry, this server is already full."),
QMessageBox::Close); }
break;
2007-04-29 18:48:20 +00:00
case ERR_NET_INVALID_PASSWORD:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Invalid password when joining the game.\nPlease reenter the password and try again."),
QMessageBox::Close); }
2007-04-29 18:48:20 +00:00
break;
case ERR_NET_INVALID_PASSWORD_STR:
{ QMessageBox::warning(this, tr("Network Error"),
tr("The password is too long. Please choose another one."),
QMessageBox::Close); }
2007-04-29 18:48:20 +00:00
break;
case ERR_NET_PLAYER_NAME_IN_USE:
2007-05-28 21:21:48 +00:00
{ myChangeHumanPlayerNameDialog->label_Message->setText(tr("Your player name is already used by another player.\nPlease choose a different name."));
myChangeHumanPlayerNameDialog->exec(); }
2007-04-29 18:48:20 +00:00
break;
case ERR_NET_INVALID_PLAYER_NAME:
{ myChangeHumanPlayerNameDialog->label_Message->setText(tr("The player name is too short, too long or invalid. Please choose another one."));
2007-05-28 21:21:48 +00:00
myChangeHumanPlayerNameDialog->exec(); }
2007-04-29 18:48:20 +00:00
break;
2007-08-21 20:46:55 +00:00
case ERR_NET_INVALID_GAME_NAME:
{ QMessageBox::warning(this, tr("Network Error"),
tr("The game name is either too short or too long. Please choose another one."),
QMessageBox::Close); }
2007-08-21 20:46:55 +00:00
break;
case ERR_NET_UNKNOWN_GAME:
{ QMessageBox::warning(this, tr("Network Error"),
tr("The game could not be found."),
QMessageBox::Close); }
break;
case ERR_NET_INVALID_CHAT_TEXT:
{ QMessageBox::warning(this, tr("Network Error"),
tr("The chat text is invalid."),
QMessageBox::Close); }
break;
case ERR_NET_UNKNOWN_PLAYER_ID:
{ QMessageBox::warning(this, tr("Network Error"),
tr("The server referred to an unknown player. Aborting."),
QMessageBox::Close); }
break;
case ERR_NET_NO_CURRENT_PLAYER:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Internal error: The current player could not be found."),
QMessageBox::Close); }
break;
case ERR_NET_PLAYER_NOT_ACTIVE:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Internal error: The current player is not active."),
QMessageBox::Close); }
break;
case ERR_NET_PLAYER_KICKED:
{ QMessageBox::warning(this, tr("Network Error"),
tr("You were kicked from the server."),
QMessageBox::Close); }
break;
case ERR_NET_INVALID_PLAYER_COUNT:
{ QMessageBox::warning(this, tr("Network Error"),
tr("The client player count is invalid."),
QMessageBox::Close); }
break;
case ERR_NET_TOO_MANY_MANUAL_BLINDS:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Too many manual blinds were set. Please reconfigure the manual blinds."),
QMessageBox::Close); }
break;
case ERR_NET_INVALID_AVATAR_FILE:
case ERR_NET_WRONG_AVATAR_SIZE:
{ QMessageBox::warning(this, tr("Network Error"),
tr("An invalid avatar file was configured. Please choose a different avatar."),
QMessageBox::Close); }
break;
case ERR_NET_AVATAR_TOO_LARGE:
{ QMessageBox::warning(this, tr("Network Error"),
tr("The selected avatar file is too large. Please choose a different avatar."),
QMessageBox::Close); }
break;
case ERR_NET_INVALID_REQUEST_ID:
{ QMessageBox::warning(this, tr("Network Error"),
tr("The server requested a non-existing avatar."),
QMessageBox::Close); }
break;
case ERR_NET_START_TIMEOUT:
{ QMessageBox::warning(this, tr("Network Error"),
tr("Could not start game: Synchronization failed."),
QMessageBox::Close); }
break;
case ERR_NET_SERVER_MAINTENANCE:
{ QMessageBox::warning(this, tr("Network Error"),
tr("The server is down for maintenance. Please try again later."),
QMessageBox::Close); }
break;
2007-03-21 00:41:29 +00:00
default: { QMessageBox::warning(this, tr("Network Error"),
tr("An internal error occured."),
2007-03-21 00:41:29 +00:00
QMessageBox::Close); }
}
// close dialogs
2007-08-21 20:46:55 +00:00
myGameLobbyDialog->reject();
2007-03-21 00:41:29 +00:00
myConnectToServerDialog->reject();
myStartNetworkGameDialog->reject();
}
void mainWindowImpl::networkNotification(int notificationId)
{
switch (notificationId)
{
case NTF_NET_REMOVED_KICKED:
{ QMessageBox::warning(this, tr("Network Notification"),
tr("You were kicked from the game."),
QMessageBox::Close); }
break;
case NTF_NET_REMOVED_GAME_FULL:
case NTF_NET_JOIN_GAME_FULL:
{ QMessageBox::warning(this, tr("Network Notification"),
tr("Sorry, this game is already full."),
QMessageBox::Close); }
break;
case NTF_NET_REMOVED_ALREADY_RUNNING:
case NTF_NET_JOIN_ALREADY_RUNNING:
{ QMessageBox::warning(this, tr("Network Notification"),
tr("Unable to join - the server has already started the game."),
QMessageBox::Close); }
break;
case NTF_NET_JOIN_INVALID_PASSWORD:
{ QMessageBox::warning(this, tr("Network Notification"),
tr("Invalid password when joining the game.\nPlease reenter the password and try again."),
QMessageBox::Close); }
break;
2007-10-12 14:42:33 +00:00
case NTF_NET_NEW_RELEASE_AVAILABLE:
{ QMessageBox::information(this, tr("Network Notification"),
2007-10-16 22:16:41 +00:00
tr("A new release of PokerTH is available.\nPlease go to <a href=\"http://www.pokerth.net/\" target=\"_blank\">http://www.pokerth.net/<a/> and download the latest version."),
QMessageBox::Close); }
break;
2007-10-12 14:42:33 +00:00
case NTF_NET_OUTDATED_BETA:
{ QMessageBox::information(this, tr("Network Notification"),
2007-10-16 22:16:41 +00:00
tr("This beta release of PokerTH is outdated.\nPlease go to <a href=\"http://www.pokerth.net/\" target=\"_blank\">http://www.pokerth.net/<a/> and download the latest version."),
QMessageBox::Close); }
break;
}
}
void mainWindowImpl::networkStart(boost::shared_ptr<Game> game)
{
mySession->startClientGame(game);
//send playerNicksList to chat for nick-autocompletition
myChat->setPlayerNicksList(getPlayerNicksList());
}
2007-01-20 01:38:40 +00:00
void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) {
2007-08-26 20:27:26 +00:00
// cout << event->key() << endl;
2007-01-24 23:46:49 +00:00
2007-02-04 13:46:27 +00:00
bool ctrlPressed = FALSE;
2007-10-16 23:07:59 +00:00
if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return ) { if(spinBox_set->hasFocus()) pushButton_BetRaise->click(); } //ENTER
2007-09-17 08:38:09 +00:00
if (event->key() == Qt::Key_F1) {
if (myConfig->readConfigInt("AlternateFKeysUserActionMode") == 0) {
pushButton_FoldAllin->click();
} else {
pushButton_BetRaise->click();
}
}
2007-03-31 00:04:36 +00:00
if (event->key() == Qt::Key_F2) { pushButton_CallCheckSet->click(); }
2007-09-17 08:38:09 +00:00
if (event->key() == Qt::Key_F3 ) {
if (myConfig->readConfigInt("AlternateFKeysUserActionMode") == 0) {
pushButton_BetRaise->click();
} else {
pushButton_FoldAllin->click();
}
}
if (event->key() == Qt::Key_F4) { radioButton_manualAction->click(); }
if (event->key() == Qt::Key_F5) { radioButton_autoCheckFold->click(); }
if (event->key() == Qt::Key_F6) { radioButton_autoCheckCallAny->click(); }
if (event->key() == 16777249) { //CTRL
2007-02-04 13:46:27 +00:00
pushButton_break->click();
ctrlPressed = TRUE;
}
if (event->key() == Qt::Key_Escape && (myActionIsBet || myActionIsRaise)) {
meInAction();
}
if (event->key() == Qt::Key_Up && lineEdit_ChatInput->hasFocus()) {
if((keyUpDownChatCounter + 1) <= myChat->getChatLinesHistorySize()) { keyUpDownChatCounter++; }
// std::cout << "Up keyUpDownChatCounter: " << keyUpDownChatCounter << "\n";
myChat->showChatHistoryIndex(keyUpDownChatCounter);
}
else if(event->key() == Qt::Key_Down && lineEdit_ChatInput->hasFocus()) {
if((keyUpDownChatCounter - 1) >= 0) { keyUpDownChatCounter--; }
// std::cout << "Down keyUpDownChatCounter: " << keyUpDownChatCounter << "\n";
myChat->showChatHistoryIndex(keyUpDownChatCounter);
}
else { keyUpDownChatCounter = 0; }
2007-01-20 01:38:40 +00:00
}
2007-01-20 17:49:33 +00:00
void mainWindowImpl::changePlayingMode() {
int mode;
if(radioButton_manualAction->isChecked()) { mode=0; }
if(radioButton_autoCheckFold->isChecked()) { mode=2; }
if(radioButton_autoCheckCallAny->isChecked()) { mode=1; }
switch (mode) {
case 0: { statusBar()->showMessage(tr("Manual mode set. You've got to choose yourself now."), 5000); }
break;
case 1: { statusBar()->showMessage(tr("Auto mode set: Check or call any."), 5000); }
break;
case 2: { statusBar()->showMessage(tr("Auto mode set: Check or fold."), 5000); }
break;
default: { cout << "changePlayingMode ERROR!!!!" << endl; }
}
playingMode = mode;
}
bool mainWindowImpl::eventFilter(QObject *obj, QEvent *event)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
2007-03-30 12:44:16 +00:00
2007-10-14 22:05:00 +00:00
if (/*obj == lineEdit_ChatInput && lineEdit_ChatInput->text() != "" && */event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Tab)
{
myChat->nickAutoCompletition();
return true;
}
else if (event->type() == QEvent::Close)
{
event->ignore();
quitPokerTH();
return true;
}
else {
// pass the event on to the parent class
return QMainWindow::eventFilter(obj, event);
}
}
2007-03-30 12:44:16 +00:00
void mainWindowImpl::switchChatWindow() {
2007-01-20 17:49:33 +00:00
int tab = 1;
if (groupBox_LeftToolBox->isHidden()) {
tabWidget_Left->setCurrentIndex(tab);
groupBox_LeftToolBox->show();
} else {
if (tabWidget_Left->currentIndex() == tab) {
groupBox_LeftToolBox->hide();
} else {
tabWidget_Left->setCurrentIndex(tab);
}
}
2007-02-20 00:05:09 +00:00
}
void mainWindowImpl::switchHelpWindow() {
2007-02-20 00:05:09 +00:00
int tab = 0;
if (groupBox_LeftToolBox->isHidden()) {
tabWidget_Left->setCurrentIndex(tab);
groupBox_LeftToolBox->show();
} else {
if (tabWidget_Left->currentIndex() == tab) {
groupBox_LeftToolBox->hide();
} else {
tabWidget_Left->setCurrentIndex(tab);
}
}
}
void mainWindowImpl::switchLogWindow() {
if (groupBox_RightToolBox->isHidden()) {
groupBox_RightToolBox->show();
} else {
groupBox_RightToolBox->hide();
}
2007-01-20 17:49:33 +00:00
}
2007-02-18 22:44:41 +00:00
2007-02-27 19:44:03 +00:00
void mainWindowImpl::switchFullscreen() {
if (this->isFullScreen()) {
this->showNormal();
}
else {
this->showFullScreen();
}
}
2007-05-01 21:14:46 +00:00
void mainWindowImpl::blinkingStartButtonAnimationAction() {
2007-09-03 00:26:38 +00:00
QString style = pushButton_break->styleSheet();
2007-05-01 22:51:10 +00:00
2007-09-03 00:26:38 +00:00
if(style.contains("QPushButton { background-color: #145300;")) {
pushButton_break->setStyleSheet("QPushButton { background-color: #6E9E00; color: black;}");
2007-05-01 22:51:10 +00:00
}
else {
2007-09-03 00:26:38 +00:00
pushButton_break->setStyleSheet("QPushButton { background-color: #145300; color: white;}");
2007-05-01 22:51:10 +00:00
}
}
2007-05-14 13:01:16 +00:00
2007-05-25 00:09:51 +00:00
void mainWindowImpl::sendChatMessage() { myChat->sendMessage(); }
2007-05-25 17:57:03 +00:00
void mainWindowImpl::checkChatInputLength(QString string) { myChat->checkInputLength(string); }
2007-05-25 00:09:51 +00:00
void mainWindowImpl::tabSwitchAction() {
2007-05-25 00:09:51 +00:00
2007-05-28 13:13:48 +00:00
switch(tabWidget_Left->currentIndex()) {
2007-05-25 00:09:51 +00:00
case 1: { lineEdit_ChatInput->setFocus();
myChat->checkInvisible();
}
break;
default: { lineEdit_ChatInput->clearFocus(); }
}
2007-05-25 00:09:51 +00:00
}
2007-05-28 18:48:12 +00:00
void mainWindowImpl::localGameModification() {
tabWidget_Left->setCurrentIndex(0);
tabWidget_Left->removeTab(1);
2007-06-09 09:45:04 +00:00
int i;
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++ ) {
setLabelArray[i]->stopTimeOutAnimation();
}
2007-09-18 21:31:39 +00:00
//Set the playing mode to "manual"
radioButton_manualAction->click();
2007-09-18 21:31:39 +00:00
2007-05-28 18:48:12 +00:00
}
void mainWindowImpl::networkGameModification() {
if(tabWidget_Left->widget(1) != tab_Chat)
tabWidget_Left->insertTab(1, tab_Chat, QString(tr("Chat")));
2007-05-28 18:48:12 +00:00
tabWidget_Left->setCurrentIndex(1);
2007-05-28 19:56:57 +00:00
myChat->clearNewGame();
2007-05-28 18:48:12 +00:00
2007-09-18 21:31:39 +00:00
//Set the playing mode to "manual"
radioButton_manualAction->click();
2007-09-18 21:31:39 +00:00
2007-05-28 18:48:12 +00:00
}
2007-08-19 12:33:24 +00:00
void mainWindowImpl::mouseOverFlipCards(bool front) {
2007-08-19 23:19:30 +00:00
if(mySession->getCurrentGameID()) {
if(myConfig->readConfigInt("AntiPeekMode") && mySession->getCurrentGame()->getCurrentHand()->getSeatsList()->front()->getMyActiveStatus() && mySession->getCurrentGame()->getSeatsList()->front()->getMyAction() != PLAYER_ACTION_FOLD) {
2007-08-19 23:19:30 +00:00
holeCardsArray[0][0]->signalFastFlipCards(front);
holeCardsArray[0][1]->signalFastFlipCards(front);
}
}
2007-08-19 12:33:24 +00:00
}
void mainWindowImpl::myButtonsCheckable(bool state) {
if(state) {
//checkable
pushButton_BetRaise->setCheckable(TRUE);
pushButton_CallCheckSet->setCheckable(TRUE);
pushButton_FoldAllin->setCheckable(TRUE);
//design
pushButton_BetRaise->setStyleSheet("QPushButton { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playeraction_03_0.6.png); "+ font2String +" font-size: 11px; font-weight: bold; color: #28E74B; }");
pushButton_CallCheckSet->setStyleSheet("QPushButton { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playeraction_05_0.6.png); "+ font2String +" font-size: 11px; font-weight: bold; color: #009DFF; }");
pushButton_FoldAllin->setStyleSheet("QPushButton { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playeraction_07_0.6.png); "+ font2String +" font-size: 11px; font-weight: bold; color: #FF1E1E; }");
}
else {
//not checkable
pushButton_BetRaise->setCheckable(FALSE);
pushButton_CallCheckSet->setCheckable(FALSE);
pushButton_FoldAllin->setCheckable(FALSE);
//design
pushButton_BetRaise->setStyleSheet("QPushButton { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playeraction_03_0.6.png); "+ font2String +" font-size: 11px; font-weight: bold; color: #F0F0F0; QPushButton }");
pushButton_CallCheckSet->setStyleSheet("QPushButton { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playeraction_05_0.6.png); "+ font2String +" font-size: 11px; font-weight: bold; color: #F0F0F0; }");
pushButton_FoldAllin->setStyleSheet("QPushButton { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playeraction_07_0.6.png); "+ font2String +" font-size: 11px; font-weight: bold; color: #F0F0F0; }");
}
}
void mainWindowImpl::closeEvent(QCloseEvent* /*event*/) { quitPokerTH(); }
2007-05-30 22:03:40 +00:00
void mainWindowImpl::quitPokerTH() {
if (myServerGuiInterface.get() && myServerGuiInterface->getSession().isNetworkServerRunning()) {
QMessageBox msgBox(QMessageBox::Warning, tr("Closing PokerTH during network game"),
tr("You are the hosting server. Do you want to close PokerTH anyway?"), QMessageBox::Yes | QMessageBox::No, this);
if (msgBox.exec() == QMessageBox::Yes ) {
mySession->terminateNetworkClient();
if (myServerGuiInterface.get()) myServerGuiInterface->getSession().terminateNetworkServer();
qApp->quit();
}
}
else { qApp->quit();}
2007-05-30 22:03:40 +00:00
}
2007-05-29 12:22:05 +00:00