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

1784 lines
59 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-01-28 01:28:19 +00:00
2007-01-24 23:46:49 +00:00
#include "startsplash.h"
2007-01-28 01:28:19 +00:00
#include "mycardspixmaplabel.h"
2007-01-13 22:29:17 +00:00
2007-02-04 23:58:50 +00:00
2007-01-13 22:29:17 +00:00
#include "playerinterface.h"
#include "boardinterface.h"
2007-01-13 02:40:33 +00:00
#include "game.h"
#include "session.h"
2007-01-31 22:48:44 +00:00
#include "log.h"
2007-01-19 02:03:30 +00:00
#include "configfile.h"
2007-01-13 02:40:33 +00:00
#define FORMATLEFT(X) "<p align='center'>(X)"
#define FORMATRIGHT(X) "(X)</p>"
// muss mit GUI übereinstimmen
const int maxQuantityPlayersConst = 5;
// !!! in game.h ebenfalls bei playerArray[?] setzen !!!
// !!! in hand.h ebenfalls bei roundStartCashArray[?] setzen !!!
using namespace std;
2007-02-01 02:18:59 +00:00
mainWindowImpl::mainWindowImpl(QMainWindow *parent)
: QMainWindow(parent), actualGame(0), actualHand(0), mySession(0), maxQuantityPlayers(maxQuantityPlayersConst), gameSpeed(0), debugMode(0), breakAfterActualHand(FALSE)
2007-01-28 23:33:48 +00:00
{
int i;
2007-01-17 20:59:34 +00:00
// Schriftart laden
2007-02-02 01:34:09 +00:00
#ifdef _WIN32
QFont tmpFont("Arial",9);
#else
QFontDatabase::addApplicationFont (":fonts/fonts/n019003l.pfb");
2007-01-17 20:59:34 +00:00
QFont tmpFont("Nimbus Sans L",9);
2007-02-02 01:34:09 +00:00
#endif
2007-01-17 20:59:34 +00:00
QApplication::setFont(tmpFont);
2007-01-13 02:40:33 +00:00
2007-01-21 22:58:22 +00:00
myConfig = new ConfigFile;
2007-01-17 23:57:41 +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-01-28 23:33:48 +00:00
pixmapLabel_cardBoard0 = new MyCardsPixmapLabel(frame_5);
2007-01-28 01:28:19 +00:00
pixmapLabel_cardBoard0->setObjectName(QString::fromUtf8("pixmapLabel_cardBoard0"));
pixmapLabel_cardBoard0->setMinimumSize(QSize(57, 80));
pixmapLabel_cardBoard0->setMaximumSize(QSize(57, 80));
2007-02-01 23:46:34 +00:00
pixmapLabel_cardBoard0->setScaledContents(true);
gridLayout11->addWidget(pixmapLabel_cardBoard0, 0, 0, 1, 1);
2007-01-28 01:28:19 +00:00
2007-01-28 23:33:48 +00:00
pixmapLabel_cardBoard1 = new MyCardsPixmapLabel(frame_5);
2007-01-28 01:28:19 +00:00
pixmapLabel_cardBoard1->setObjectName(QString::fromUtf8("pixmapLabel_cardBoard1"));
pixmapLabel_cardBoard1->setMinimumSize(QSize(57, 80));
pixmapLabel_cardBoard1->setMaximumSize(QSize(57, 80));
2007-02-01 23:46:34 +00:00
pixmapLabel_cardBoard1->setScaledContents(true);
gridLayout11->addWidget(pixmapLabel_cardBoard1, 0, 1, 1, 1);
2007-01-28 01:28:19 +00:00
2007-01-28 23:33:48 +00:00
pixmapLabel_cardBoard2 = new MyCardsPixmapLabel(frame_5);
2007-01-28 01:28:19 +00:00
pixmapLabel_cardBoard2->setObjectName(QString::fromUtf8("pixmapLabel_cardBoard2"));
pixmapLabel_cardBoard2->setMinimumSize(QSize(57, 80));
pixmapLabel_cardBoard2->setMaximumSize(QSize(57, 80));
2007-02-01 23:46:34 +00:00
pixmapLabel_cardBoard2->setScaledContents(true);
gridLayout11->addWidget(pixmapLabel_cardBoard2, 0, 2, 1, 1);
2007-01-28 01:28:19 +00:00
2007-01-28 23:33:48 +00:00
pixmapLabel_cardBoard3 = new MyCardsPixmapLabel(frame_5);
2007-01-28 01:28:19 +00:00
pixmapLabel_cardBoard3->setObjectName(QString::fromUtf8("pixmapLabel_cardBoard3"));
pixmapLabel_cardBoard3->setMinimumSize(QSize(57, 80));
pixmapLabel_cardBoard3->setMaximumSize(QSize(57, 80));
2007-02-01 23:46:34 +00:00
pixmapLabel_cardBoard3->setScaledContents(true);
gridLayout11->addWidget(pixmapLabel_cardBoard3, 0, 3, 1, 1);
2007-01-28 01:28:19 +00:00
2007-01-28 23:33:48 +00:00
pixmapLabel_cardBoard4 = new MyCardsPixmapLabel(frame_5);
2007-01-28 01:28:19 +00:00
pixmapLabel_cardBoard4->setObjectName(QString::fromUtf8("pixmapLabel_cardBoard4"));
pixmapLabel_cardBoard4->setMinimumSize(QSize(57, 80));
pixmapLabel_cardBoard4->setMaximumSize(QSize(57, 80));
2007-02-01 23:46:34 +00:00
pixmapLabel_cardBoard4->setScaledContents(true);
gridLayout11->addWidget(pixmapLabel_cardBoard4, 0, 4, 1, 1);
2007-01-28 01:28:19 +00:00
2007-01-28 23:33:48 +00:00
pixmapLabel_card0a = new MyCardsPixmapLabel(frame5);
2007-01-28 01:28:19 +00:00
pixmapLabel_card0a->setObjectName(QString::fromUtf8("pixmapLabel_card0a"));
pixmapLabel_card0a->setMinimumSize(QSize(80, 112));
pixmapLabel_card0a->setMaximumSize(QSize(80, 112));
pixmapLabel_card0a->setScaledContents(true);
gridLayout2->addWidget(pixmapLabel_card0a, 0, 0, 1, 1);
2007-01-28 01:28:19 +00:00
2007-01-28 23:33:48 +00:00
pixmapLabel_card0b = new MyCardsPixmapLabel(frame5);
2007-01-28 01:28:19 +00:00
pixmapLabel_card0b->setObjectName(QString::fromUtf8("pixmapLabel_card0b"));
pixmapLabel_card0b->setMinimumSize(QSize(80, 112));
pixmapLabel_card0b->setMaximumSize(QSize(80, 112));
pixmapLabel_card0b->setScaledContents(true);
gridLayout2->addWidget(pixmapLabel_card0b, 0, 1, 1, 1);
2007-01-28 01:28:19 +00:00
2007-01-28 23:33:48 +00:00
pixmapLabel_card1a = new MyCardsPixmapLabel(frame8_2_2_2_5);
2007-01-28 01:28:19 +00:00
pixmapLabel_card1a->setObjectName(QString::fromUtf8("pixmapLabel_card1a"));
pixmapLabel_card1a->setMinimumSize(QSize(57, 80));
pixmapLabel_card1a->setMaximumSize(QSize(57, 80));
2007-02-01 22:45:32 +00:00
pixmapLabel_card1a->setScaledContents(true);
gridLayout18->addWidget(pixmapLabel_card1a, 0, 0, 1, 1);
2007-01-28 01:28:19 +00:00
2007-01-28 23:33:48 +00:00
pixmapLabel_card1b = new MyCardsPixmapLabel(frame8_2_2_2_5);
2007-01-28 01:28:19 +00:00
pixmapLabel_card1b->setObjectName(QString::fromUtf8("pixmapLabel_card1b"));
pixmapLabel_card1b->setMinimumSize(QSize(57, 80));
pixmapLabel_card1b->setMaximumSize(QSize(57, 80));
2007-02-01 22:45:32 +00:00
pixmapLabel_card1b->setScaledContents(true);
gridLayout18->addWidget(pixmapLabel_card1b, 0, 1, 1, 1);
2007-01-28 01:28:19 +00:00
2007-01-28 23:33:48 +00:00
pixmapLabel_card2a = new MyCardsPixmapLabel(frame8_2_2_2_4);
2007-01-28 01:28:19 +00:00
pixmapLabel_card2a->setObjectName(QString::fromUtf8("pixmapLabel_card2a"));
pixmapLabel_card2a->setMinimumSize(QSize(57, 80));
pixmapLabel_card2a->setMaximumSize(QSize(57, 80));
2007-02-01 23:46:34 +00:00
pixmapLabel_card2a->setScaledContents(true);
gridLayout24->addWidget(pixmapLabel_card2a, 0, 0, 1, 1);
2007-01-28 01:28:19 +00:00
2007-01-28 23:33:48 +00:00
pixmapLabel_card2b = new MyCardsPixmapLabel(frame8_2_2_2_4);
2007-01-28 01:28:19 +00:00
pixmapLabel_card2b->setObjectName(QString::fromUtf8("pixmapLabel_card2b"));
pixmapLabel_card2b->setMinimumSize(QSize(57, 80));
2007-02-01 23:46:34 +00:00
pixmapLabel_card2b->setMaximumSize(QSize(57, 80));
pixmapLabel_card2b->setScaledContents(true);
gridLayout24->addWidget(pixmapLabel_card2b, 0, 1, 1, 1);
2007-01-28 01:28:19 +00:00
2007-01-28 23:33:48 +00:00
pixmapLabel_card3a = new MyCardsPixmapLabel(frame8_2_2_2_6);
2007-01-28 01:28:19 +00:00
pixmapLabel_card3a->setObjectName(QString::fromUtf8("pixmapLabel_card3a"));
pixmapLabel_card3a->setMinimumSize(QSize(57, 80));
pixmapLabel_card3a->setMaximumSize(QSize(57, 80));
2007-02-01 23:46:34 +00:00
pixmapLabel_card3a->setScaledContents(true);
gridLayout30->addWidget(pixmapLabel_card3a, 0, 0, 1, 1);
2007-01-28 01:28:19 +00:00
2007-01-28 23:33:48 +00:00
pixmapLabel_card3b = new MyCardsPixmapLabel(frame8_2_2_2_6);
2007-01-28 01:28:19 +00:00
pixmapLabel_card3b->setObjectName(QString::fromUtf8("pixmapLabel_card3b"));
pixmapLabel_card3b->setMinimumSize(QSize(57, 80));
pixmapLabel_card3b->setMaximumSize(QSize(57, 80));
2007-02-01 23:46:34 +00:00
pixmapLabel_card3b->setScaledContents(true);
gridLayout30->addWidget(pixmapLabel_card3b, 0, 1, 1, 1);
2007-01-28 01:28:19 +00:00
2007-01-28 23:33:48 +00:00
pixmapLabel_card4a = new MyCardsPixmapLabel(frame8_2_2_2_7);
2007-01-28 01:28:19 +00:00
pixmapLabel_card4a->setObjectName(QString::fromUtf8("pixmapLabel_card4a"));
pixmapLabel_card4a->setMinimumSize(QSize(57, 80));
pixmapLabel_card4a->setMaximumSize(QSize(57, 80));
2007-02-01 23:46:34 +00:00
pixmapLabel_card4a->setScaledContents(true);
gridLayout36->addWidget(pixmapLabel_card4a, 0, 0, 1, 1);
2007-01-28 01:28:19 +00:00
2007-01-28 23:33:48 +00:00
pixmapLabel_card4b = new MyCardsPixmapLabel(frame8_2_2_2_7);
2007-01-28 01:28:19 +00:00
pixmapLabel_card4b->setObjectName(QString::fromUtf8("pixmapLabel_card4b"));
pixmapLabel_card4b->setMinimumSize(QSize(57, 80));
pixmapLabel_card4b->setMaximumSize(QSize(57, 80));
2007-02-01 23:46:34 +00:00
pixmapLabel_card4b->setScaledContents(true);
gridLayout36->addWidget(pixmapLabel_card4b, 0, 1, 1, 1);
2007-01-28 01:28:19 +00:00
2007-02-01 23:46:34 +00:00
// pixmapLabel_card4b->setPixmap(QPixmap(":/cards/graphics/cards/33.png"), FALSE);
2007-01-28 23:33:48 +00:00
//Flipside festlegen;
2007-02-01 23:46:34 +00:00
flipside = new QPixmap(":/cards/graphics/cards/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") != "") {
QPixmap tmpFlipside(QString::fromStdString(myConfig->readConfigString("FlipsideOwnFile")));
2007-01-28 23:33:48 +00:00
flipside = new QPixmap(tmpFlipside.scaled(QSize(57, 80)));
}
2007-02-01 23:46:34 +00:00
else { flipside->load(":/cards/graphics/cards/flipside.png"); }
2007-01-28 01:28:19 +00:00
//Flipside Animation noch nicht erledigt
flipHolecardsAllInAlreadyDone = FALSE;
2007-01-20 01:38:40 +00:00
//Toolbox verstecken?
2007-02-03 22:47:16 +00:00
if (!myConfig->readConfigInt("ShowToolBox")) { groupBox_tools->hide(); }
2007-02-01 02:18:59 +00:00
//Intro abspielen?
2007-02-03 22:47:16 +00:00
if (myConfig->readConfigInt("ShowIntro")) {
2007-01-27 14:19:50 +00:00
label_logo->hide();
QTimer::singleShot(100, this, SLOT( paintStartSplash() )); }
2007-01-20 01:38:40 +00:00
2007-01-13 02:40:33 +00:00
pushButton_raise->setDisabled(TRUE);
pushButton_call->setDisabled(TRUE);
pushButton_bet->setDisabled(TRUE);
pushButton_set->setDisabled(TRUE);
pushButton_fold->setDisabled(TRUE);
pushButton_allin->setDisabled(TRUE);
pushButton_check->setDisabled(TRUE);
spinBox_set->setDisabled(TRUE);
// userWidgetsArray init
userWidgetsArray[0] = pushButton_raise;
userWidgetsArray[1] = pushButton_call;
userWidgetsArray[2] = pushButton_bet;
userWidgetsArray[3] = pushButton_set;
userWidgetsArray[4] = pushButton_fold;
userWidgetsArray[5] = pushButton_allin;
userWidgetsArray[6] = pushButton_check;
userWidgetsArray[7] = spinBox_set;
//Hintergrundfarbe der userWidgets anpassen;
for(i=0; i<=7; i++) {
QPalette tempPalette = userWidgetsArray[i]->palette();
QColor tempColor = tempPalette.color(QPalette::Window);
tempPalette.setColor(QPalette::Button, tempColor);
userWidgetsArray[i]->setPalette(tempPalette);
}
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);
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);
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);
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;
// cashLabelArray init
cashLabelArray[0] = textLabel_Cash0;
cashLabelArray[1] = textLabel_Cash1;
cashLabelArray[2] = textLabel_Cash2;
cashLabelArray[3] = textLabel_Cash3;
cashLabelArray[4] = textLabel_Cash4;
// cashTopLabelArray init
cashTopLabelArray[0] = textLabel_TopCash0;
cashTopLabelArray[1] = textLabel_TopCash1;
cashTopLabelArray[2] = textLabel_TopCash2;
cashTopLabelArray[3] = textLabel_TopCash3;
cashTopLabelArray[4] = textLabel_TopCash4;
// setLabelArray init
setLabelArray[0] = textLabel_Set0;
setLabelArray[1] = textLabel_Set1;
setLabelArray[2] = textLabel_Set2;
setLabelArray[3] = textLabel_Set3;
setLabelArray[4] = textLabel_Set4;
// statusLabelArray init
actionLabelArray[0] = textLabel_Status0;
actionLabelArray[1] = textLabel_Status1;
actionLabelArray[2] = textLabel_Status2;
actionLabelArray[3] = textLabel_Status3;
actionLabelArray[4] = textLabel_Status4;
// GroupBoxArray init
groupBoxArray[0] = groupBox0;
groupBoxArray[1] = groupBox1;
groupBoxArray[2] = groupBox2;
groupBoxArray[3] = groupBox3;
groupBoxArray[4] = groupBox4;
// 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;
// Farben initalisieren
active.setRgb(86,170,86);
inactive.setRgb(83,141,107);
highlight.setRgb(151,214,109);
2007-02-04 13:46:27 +00:00
//ShortCuts
2007-02-04 14:41:53 +00:00
// QShortcut *startNewGameKeys = new QShortcut(QKeySequence(Qt::Key_Control + Qt::Key_N), this);
// connect( startNewGameKeys, SIGNAL(activated() ), actionNewGame, SLOT( trigger() ) );
2007-02-04 13:46:27 +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() ));
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-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() ) );
connect( actionQuit, SIGNAL( triggered() ), qApp, SLOT( quit() ) );
2007-01-13 02:40:33 +00:00
connect( pushButton_raise, SIGNAL( clicked() ), this, SLOT( myRaise() ) );
connect( pushButton_call, SIGNAL( clicked() ), this, SLOT( myCall() ) );
connect( pushButton_bet, SIGNAL( clicked() ), this, SLOT( myBet() ) );
connect( pushButton_set, SIGNAL( clicked() ), this, SLOT( mySet() ) );
connect( pushButton_fold, SIGNAL( clicked() ), this, SLOT( myFold() ) );
connect( pushButton_check, SIGNAL( clicked() ), this, SLOT( myCheck() ) );
connect( pushButton_allin, SIGNAL( clicked() ), this, SLOT( myAllIn() ) );
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-01-13 02:40:33 +00:00
}
2007-02-04 23:58:50 +00:00
mainWindowImpl::~mainWindowImpl() {}
2007-01-13 02:40:33 +00:00
void mainWindowImpl::callNewGameDialog() {
2007-01-20 01:38:40 +00:00
2007-01-13 02:40:33 +00:00
2007-01-19 02:03:30 +00:00
//wenn Dialogfenster gezeigt werden soll
2007-01-21 22:58:22 +00:00
2007-02-03 22:47:16 +00:00
if(myConfig->readConfigInt("ShowGameSettingsDialogOnNewGame")){
2007-01-13 02:40:33 +00:00
2007-01-19 02:03:30 +00:00
newGameDialogImpl *v = new newGameDialogImpl();
v->exec();
if (v->result() == QDialog::Accepted ) {
2007-01-20 01:38:40 +00:00
2007-01-19 02:03:30 +00:00
if(actualGame) {
mySession->deleteGame();
actualGame = 0;
}
guiGameSpeed = v->spinBox_gameSpeed->value();
// debugMode = v->checkBox_debugMode->isChecked();
//Speeds
setSpeeds();
2007-01-19 02:03:30 +00:00
2007-01-23 19:20:18 +00:00
//restliche Singleshots killen!!!
2007-01-23 23:53:12 +00:00
stopTimer();
2007-01-23 19:20:18 +00:00
2007-01-19 02:03:30 +00:00
label_Pot->setText("<p align='center'><span style='font-size:x-large; font-weight:bold'>Pot Total</span></p>");
label_Sets->setText("<p align='center'><span style='font-size:medium; font-weight:bold'>Sets:</span></p>");
//Tools und Board aufhellen und enablen
QPalette tempPalette = groupBox_board->palette();
tempPalette.setColor(QPalette::Window, active);
groupBox_board->setPalette(tempPalette);
groupBox_tools->setDisabled(FALSE);
//positioning Slider
horizontalSlider_speed->setValue(guiGameSpeed);
//Start Game!!!
mySession->startGame(v->spinBox_quantityPlayers->value(), v->spinBox_startCash->value(), v->spinBox_smallBlind->value());
}
}
2007-01-19 02:03:30 +00:00
// sonst mit gespeicherten Werten starten
else {
2007-01-19 02:03:30 +00:00
2007-01-13 02:40:33 +00:00
if(actualGame) {
mySession->deleteGame();
actualGame = 0;
}
2007-01-19 02:03:30 +00:00
2007-02-03 22:47:16 +00:00
guiGameSpeed = myConfig->readConfigInt("GameSpeed");
//Speeds
setSpeeds();
2007-01-23 19:20:18 +00:00
//restliche Singleshots killen!!!
2007-01-23 23:53:12 +00:00
stopTimer();
2007-01-19 02:03:30 +00:00
2007-01-13 02:40:33 +00:00
label_Pot->setText("<p align='center'><span style='font-size:x-large; font-weight:bold'>Pot Total</span></p>");
label_Sets->setText("<p align='center'><span style='font-size:medium; font-weight:bold'>Sets:</span></p>");
2007-01-19 02:03:30 +00:00
2007-01-19 02:03:30 +00:00
// debugMode = v->checkBox_debugMode->isChecked();
2007-01-14 19:58:40 +00:00
//Tools und Board aufhellen und enablen
QPalette tempPalette = groupBox_board->palette();
tempPalette.setColor(QPalette::Window, active);
groupBox_board->setPalette(tempPalette);
groupBox_tools->setDisabled(FALSE);
2007-01-19 02:03:30 +00:00
2007-01-14 14:14:41 +00:00
//positioning Slider
2007-01-15 09:07:34 +00:00
horizontalSlider_speed->setValue(guiGameSpeed);
2007-01-20 01:38:40 +00:00
2007-01-14 14:08:45 +00:00
//Start Game!!!
2007-02-03 22:47:16 +00:00
mySession->startGame(myConfig->readConfigInt("NumberOfPlayers"), myConfig->readConfigInt("StartCash"), myConfig->readConfigInt("SmallBlind"));
2007-01-13 02:40:33 +00:00
2007-01-21 14:20:15 +00:00
2007-01-22 22:25:58 +00:00
}
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::callAboutPokerthDialog() {
aboutPokerthImpl *v = new aboutPokerthImpl();
v->exec();
}
2007-01-17 01:22:55 +00:00
void mainWindowImpl::callSettingsDialog() {
settingsDialogImpl *v = new settingsDialogImpl();
v->exec();
2007-01-20 01:38:40 +00:00
2007-02-03 22:47:16 +00:00
if (v->getSettingsCorrect()) {
2007-01-20 01:38:40 +00:00
//Toolbox verstecken?
2007-02-03 22:47:16 +00:00
if (!myConfig->readConfigInt("ShowToolBox")) { groupBox_tools->hide(); }
2007-01-22 22:25:58 +00:00
else { groupBox_tools->show(); }
//Falls Spielernamen geändert wurden --> neu zeichnen --> erst beim nächsten Neustart neu ausgelesen
if (v->getPlayerNickIsChanged() && actualGame) {
actualHand->getPlayerArray()[0]->setMyName(v->lineEdit_humanPlayerName->text().toStdString());
actualHand->getPlayerArray()[1]->setMyName(v->lineEdit_Opponent1Name->text().toStdString());
actualHand->getPlayerArray()[2]->setMyName(v->lineEdit_Opponent2Name->text().toStdString());
actualHand->getPlayerArray()[3]->setMyName(v->lineEdit_Opponent3Name->text().toStdString());
actualHand->getPlayerArray()[4]->setMyName(v->lineEdit_Opponent4Name->text().toStdString());
v->setPlayerNickIsChanged(FALSE);
refreshPlayerName();
}
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") != "") {
QPixmap tmpFlipside(QString::fromStdString(myConfig->readConfigString("FlipsideOwnFile")));
flipside = new QPixmap(tmpFlipside.scaled(QSize(57, 80)));
2007-01-28 23:33:48 +00:00
}
2007-02-01 23:46:34 +00:00
else { flipside->load(":/cards/graphics/cards/flipside.png"); }
2007-01-28 23:33:48 +00:00
2007-01-29 00:53:20 +00:00
int i,j;
for (i=1; i<=4; i++ ) {
for ( j=0; j<=1; j++ ) {
if (holeCardsArray[i][j]->getIsFlipside()) {
holeCardsArray[i][j]->setPixmap(*flipside, TRUE);
}
}
}
2007-01-20 01:38:40 +00:00
}
2007-01-17 01:22:55 +00:00
}
2007-01-13 02:40:33 +00:00
void mainWindowImpl::setGame(Game *g) { actualGame = g; }
2007-01-13 22:29:17 +00:00
void mainWindowImpl::setHand(HandInterface* br) { actualHand = br; }
2007-01-13 02:40:33 +00:00
void mainWindowImpl::setSession(Session* s) { mySession = s; }
2007-01-31 22:48:44 +00:00
void mainWindowImpl::setLog(Log* l) { myLog = l; }
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
2007-01-13 02:40:33 +00:00
int i;
for (i=0; i<maxQuantityPlayers; i++) {
if(actualHand->getPlayerArray()[i]->getMySet() == 0) setLabelArray[i]->setText("");
else setLabelArray[i]->setText("<p align='center'><b>Set:</b> "+QString::number(actualHand->getPlayerArray()[i]->getMySet(),10)+" $</p>");
}
}
void mainWindowImpl::refreshButton() {
2007-02-04 13:46:27 +00:00
QPixmap dealerButton(":/graphics/graphics/dealerbutton.png");
QPixmap onePix(":/graphics/graphics/1px.png");
2007-01-13 02:40:33 +00:00
int i;
2007-01-16 21:23:39 +00:00
for (i=0; i<maxQuantityPlayers; i++) {
if (actualHand->getPlayerArray()[i]->getMyButton()==1) {
buttonLabelArray[i]->setPixmap(dealerButton);
}
else {
buttonLabelArray[i]->setPixmap(onePix);
}
}
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::refreshPlayerName() {
int i;
2007-01-28 01:28:19 +00:00
for (i=1; i<maxQuantityPlayers; i++) { groupBoxArray[i]->setTitle(QString::fromStdString(actualHand->getPlayerArray()[i]->getMyName())); }
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::refreshAction() {
QStringList actionArray;
actionArray << "" << "Fold" << "Check" << "Call" << "Bet" << "Raise" << "All-In";
int i;
for (i=0; i<maxQuantityPlayers; i++) {
actionLabelArray[i]->setText("<p align='center'>"+actionArray[actualHand->getPlayerArray()[i]->getMyAction()]+"</p>");
if (actualHand->getPlayerArray()[i]->getMyAction()==1) {
groupBoxArray[i]->setDisabled(TRUE);
2007-02-04 13:46:27 +00:00
QPixmap onePix(":/graphics/graphics/1px.png");
2007-01-13 02:40:33 +00:00
if(i != 0) {
2007-01-29 00:53:20 +00:00
holeCardsArray[i][0]->setPixmap(onePix, FALSE);
holeCardsArray[i][1]->setPixmap(onePix, FALSE);
2007-01-13 02:40:33 +00:00
}
QColor c(199,199,199);
QPalette labelPalette = cashTopLabelArray[i]->palette();
labelPalette.setColor(QPalette::WindowText, c);
cashTopLabelArray[i]->setPalette(labelPalette);
cashTopLabelArray[i]->setAutoFillBackground(FALSE);
}
// else {
// QColor c(0,0,0);
// QPalette labelPalette = cashTopLabelArray[i]->palette();
// labelPalette.setColor(QPalette::WindowText, c);
// cashTopLabelArray[i]->setPalette(labelPalette);
// cashTopLabelArray[i]->setAutoFillBackground(FALSE);
// }
}
}
void mainWindowImpl::refreshCash() {
int i;
for (i=0; i<maxQuantityPlayers; i++) {
if(actualHand->getPlayerArray()[i]->getMyActiveStatus()) {
if (i==0) {
cashLabelArray[0]->setText("<p align='center'><span style='font-size:14px'>"+QString::number(actualHand->getPlayerArray()[i]->getMyCash(),10)+" $</span></p>");
cashTopLabelArray[0]->setText("<p align='center'><span style='font-size:15px; font-weight:bold'>Cash:</span></p>");
}
else {
cashLabelArray[i]->setText("<p align='center'>"+QString::number(actualHand->getPlayerArray()[i]->getMyCash(),10)+" $</p>");
cashTopLabelArray[i]->setText("<p align='center'><b>Cash:</b></p>");
}
} else {
cashLabelArray[i]->setText("");
cashTopLabelArray[i]->setText("");
}
}
}
void mainWindowImpl::refreshGroupbox() {
int i;
for (i=0; i<maxQuantityPlayers; i++) {
groupBoxArray[i]->setEnabled(actualHand->getPlayerArray()[i]->getMyActiveStatus());
if (actualHand->getPlayerArray()[i]->getMyAction() == 1) groupBoxArray[i]->setDisabled(TRUE);
if(actualHand->getPlayerArray()[i]->getMyTurn()) {
//Groupbox aufhellen wenn der Spiele dran ist.
QPalette tempPalette = groupBoxArray[i]->palette();
tempPalette.setColor(QPalette::Window, highlight);
groupBoxArray[i]->setPalette(tempPalette);
} else {
//Groupbox auf Hintergrundfarbe setzen wenn der Spiele nicht dran aber aktiv ist.
if(actualHand->getPlayerArray()[i]->getMyActiveStatus()) {
QPalette tempPalette = groupBoxArray[i]->palette();
tempPalette.setColor(QPalette::Window, active);
groupBoxArray[i]->setPalette(tempPalette);
}
//Groupbox verdunkeln wenn der Spiele inactive ist.
else {
QPalette tempPalette = groupBoxArray[i]->palette();
tempPalette.setColor(QPalette::Window, inactive);
groupBoxArray[i]->setPalette(tempPalette);
}
}
}
userWidgetsBackgroudColor();
}
2007-01-13 14:27:56 +00:00
void mainWindowImpl::highlightRoundLabel(string tempround) {
QString round (QString::fromStdString(tempround));
2007-01-13 02:40:33 +00:00
// für PostRiverRun (alte Runden stehen lassen)
if(round != "") {
QPalette tempPalette = frame_handLabel->palette();
tempPalette.setColor(QPalette::Window, highlight);
frame_handLabel->setPalette(tempPalette);
2007-01-17 00:39:20 +00:00
textLabel_handLabel->setText(round);
2007-02-05 22:33:52 +00:00
textLabel_handNumber->setText("Hand: "+QString::number(actualHand->getMyID(),10));
textLabel_gameNumber->setText("Game: "+QString::number(actualGame->getMyGameID(),10));
2007-01-13 02:40:33 +00:00
}
}
void mainWindowImpl::refreshAll() {
refreshSet();
refreshButton();
refreshAction();
refreshCash();
refreshGroupbox();
}
void mainWindowImpl::refreshChangePlayer() {
refreshSet();
refreshButton();
refreshAction();
refreshCash();
}
void mainWindowImpl::refreshPot() {
textLabel_Sets->setText("<p align='left'>"+QString::number(actualHand->getBoard()->getSets(),10)+" $</p>");
textLabel_Pot->setText("<p align='center'><span style='font-size:large; font-weight:bold'>"+QString::number(actualHand->getBoard()->getPot(),10)+" $</p>");
}
void mainWindowImpl::dealHoleCards() {
2007-02-01 23:46:34 +00:00
QPixmap onePix(":/graphics/graphics/1px.png");
2007-01-13 02:40:33 +00:00
//TempArrays
QPixmap tempCardsPixmapArray[2];
int tempCardsIntArray[2];
// Karten der Gegner austeilen
int i, j;
for(i=1; i<maxQuantityPlayers; i++) {
actualHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
for(j=0; j<2; j++) {
if(actualHand->getPlayerArray()[i]->getMyActiveStatus()) {
if (debugMode) {
2007-02-01 23:46:34 +00:00
tempCardsPixmapArray[j].load(":/cards/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png");
2007-01-29 00:53:20 +00:00
holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j],FALSE);
2007-01-13 02:40:33 +00:00
}
2007-01-29 00:53:20 +00:00
else holeCardsArray[i][j]->setPixmap(*flipside, TRUE);
2007-01-13 02:40:33 +00:00
}
else {
2007-01-29 00:53:20 +00:00
holeCardsArray[i][j]->setPixmap(onePix, FALSE);
2007-01-13 02:40:33 +00:00
// holeCardsArray[i][j]->repaint();
}
}
}
// eigenen Karten austeilen
actualHand->getPlayerArray()[0]->getMyCards(tempCardsIntArray);
for(i=0; i<2; i++) {
if(actualHand->getPlayerArray()[0]->getMyActiveStatus()) {
2007-02-01 23:46:34 +00:00
tempCardsPixmapArray[i].load(":/cards/graphics/cards/"+QString::number(tempCardsIntArray[i], 10)+".png");
2007-01-29 00:53:20 +00:00
holeCardsArray[0][i]->setPixmap(tempCardsPixmapArray[i], FALSE);
2007-01-13 02:40:33 +00:00
}
else {
2007-01-29 00:53:20 +00:00
holeCardsArray[0][i]->setPixmap(onePix, FALSE);
2007-01-13 02:40:33 +00:00
// holeCardsArray[i][j]->repaint();
}
}
2007-01-28 01:28:19 +00:00
//Groupbox repaint() hline-bug?;
refreshGroupbox();
2007-01-13 02:40:33 +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-13 02:40:33 +00:00
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 23:53:12 +00:00
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 23:53:12 +00:00
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;
actualHand->getBoard()->getMyCards(tempBoardCardsArray);
2007-02-01 23:46:34 +00:00
tempCardsPixmap.load(":/cards/graphics/cards/"+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;
actualHand->getBoard()->getMyCards(tempBoardCardsArray);
2007-02-01 23:46:34 +00:00
tempCardsPixmap.load(":/cards/graphics/cards/"+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;
actualHand->getBoard()->getMyCards(tempBoardCardsArray);
2007-02-01 23:46:34 +00:00
tempCardsPixmap.load(":/cards/graphics/cards/"+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-01-13 02:40:33 +00:00
// stable
// wenn alle All In
if(actualHand->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;
actualHand->getBoard()->getMyCards(tempBoardCardsArray);
2007-02-01 23:46:34 +00:00
tempCardsPixmap.load(":/cards/graphics/cards/"+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(actualHand->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;
actualHand->getBoard()->getMyCards(tempBoardCardsArray);
2007-02-01 23:46:34 +00:00
tempCardsPixmap.load(":/cards/graphics/cards/"+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(actualHand->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::meInAction() {
switch (actualHand->getActualRound()) {
case 0: {
if (actualHand->getPlayerArray()[0]->getMyCash()+actualHand->getPlayerArray()[0]->getMySet() > actualHand->getPreflop()->getHighestSet()) { pushButton_raise->setEnabled(TRUE); }
if ( actualHand->getPlayerArray()[0]->getMySet()== actualHand->getPreflop()->getHighestSet() && actualHand->getPlayerArray()[0]->getMyButton() == 3) { pushButton_check->setEnabled(TRUE); }
else { pushButton_call->setEnabled(TRUE); }
pushButton_fold->setEnabled(TRUE);
}
break;
case 1: {
pushButton_fold->setEnabled(TRUE);
// cout << "highestSet in meInAction " << actualHand->getFlop()->getHighestSet() << endl;
if (actualHand->getFlop()->getHighestSet() == 0) {
pushButton_check->setEnabled(TRUE);
pushButton_bet->setEnabled(TRUE);
}
if (actualHand->getFlop()->getHighestSet() > 0 && actualHand->getFlop()->getHighestSet() > actualHand->getPlayerArray()[0]->getMySet()) {
pushButton_call->setEnabled(TRUE);
if (actualHand->getPlayerArray()[0]->getMyCash()+actualHand->getPlayerArray()[0]->getMySet() > actualHand->getPreflop()->getHighestSet()) { pushButton_raise->setEnabled(TRUE); }
}
}
break;
case 2: {
pushButton_fold->setEnabled(TRUE);
// cout << "highestSet in meInAction " << actualHand->getFlop()->getHighestSet() << endl;
if (actualHand->getTurn()->getHighestSet() == 0) {
pushButton_check->setEnabled(TRUE);
pushButton_bet->setEnabled(TRUE);
}
if (actualHand->getTurn()->getHighestSet() > 0 && actualHand->getTurn()->getHighestSet() > actualHand->getPlayerArray()[0]->getMySet()) {
pushButton_call->setEnabled(TRUE);
if (actualHand->getPlayerArray()[0]->getMyCash()+actualHand->getPlayerArray()[0]->getMySet() > actualHand->getPreflop()->getHighestSet()) { pushButton_raise->setEnabled(TRUE); }
}
}
break;
case 3: {
pushButton_fold->setEnabled(TRUE);
// cout << "highestSet in meInAction " << actualHand->getFlop()->getHighestSet() << endl;
if (actualHand->getRiver()->getHighestSet() == 0) {
pushButton_check->setEnabled(TRUE);
pushButton_bet->setEnabled(TRUE);
}
if (actualHand->getRiver()->getHighestSet() > 0 && actualHand->getRiver()->getHighestSet() > actualHand->getPlayerArray()[0]->getMySet()) {
pushButton_call->setEnabled(TRUE);
if (actualHand->getPlayerArray()[0]->getMyCash()+actualHand->getPlayerArray()[0]->getMySet() > actualHand->getPreflop()->getHighestSet()) { pushButton_raise->setEnabled(TRUE); }
}
}
break;
default: {}
}
//Hintergrundfarbe der userWidgets anpassen;
userWidgetsBackgroudColor();
}
void mainWindowImpl::disableMyButtons() {
pushButton_raise->setDisabled(TRUE);
pushButton_call->setDisabled(TRUE);
pushButton_bet->setDisabled(TRUE);
pushButton_set->setDisabled(TRUE);
pushButton_fold->setDisabled(TRUE);
pushButton_allin->setDisabled(TRUE);
pushButton_check->setDisabled(TRUE);
spinBox_set->setMinimum(0);
spinBox_set->setValue(0);
spinBox_set->setDisabled(TRUE);
userWidgetsBackgroudColor();
}
void mainWindowImpl::myFold(){
actualHand->getPlayerArray()[0]->setMyAction(1);
actualHand->getPlayerArray()[0]->setMyTurn(0);
2007-01-14 19:58:40 +00:00
//Action in LogWindow
2007-02-04 00:34:44 +00:00
myLog->logPlayerActionMsg(actualHand->getPlayerArray()[0]->getMyName(), actualHand->getPlayerArray()[0]->getMyAction(), actualHand->getPlayerArray()[0]->getMySet());
2007-01-14 19:58:40 +00:00
2007-01-13 02:40:33 +00:00
disableMyButtons();
//Spiel läuft weiter
nextPlayerAnimation();
}
void mainWindowImpl::myCheck() {
actualHand->getPlayerArray()[0]->setMyAction(2);
actualHand->getPlayerArray()[0]->setMyTurn(0);
2007-01-14 19:58:40 +00:00
//Action in LogWindow
2007-02-04 00:34:44 +00:00
myLog->logPlayerActionMsg(actualHand->getPlayerArray()[0]->getMyName(), actualHand->getPlayerArray()[0]->getMyAction(), actualHand->getPlayerArray()[0]->getMySet());
2007-01-14 19:58:40 +00:00
2007-01-13 02:40:33 +00:00
disableMyButtons();
2007-02-02 13:59:09 +00:00
2007-01-13 02:40:33 +00:00
//Spiel läuft weiter
nextPlayerAnimation();
}
2007-01-13 02:40:33 +00:00
void mainWindowImpl::myCall(){
int tempHighestSet = 0;
switch (actualHand->getActualRound()) {
case 0: {tempHighestSet = actualHand->getPreflop()->getHighestSet();}
break;
case 1: {tempHighestSet = actualHand->getFlop()->getHighestSet();}
break;
case 2: {tempHighestSet = actualHand->getTurn()->getHighestSet();}
break;
case 3: {tempHighestSet = actualHand->getRiver()->getHighestSet();}
break;
default: {}
}
if (actualHand->getPlayerArray()[0]->getMyCash()+actualHand->getPlayerArray()[0]->getMySet() <= tempHighestSet) {
actualHand->getPlayerArray()[0]->setMyAction(6);
actualHand->getPlayerArray()[0]->setMySet(actualHand->getPlayerArray()[0]->getMyCash());
actualHand->getPlayerArray()[0]->setMyCash(0);
}
else {
actualHand->getPlayerArray()[0]->setMySet(tempHighestSet - actualHand->getPlayerArray()[0]->getMySet());
actualHand->getPlayerArray()[0]->setMyAction(3);
}
actualHand->getPlayerArray()[0]->setMyTurn(0);
actualHand->getBoard()->collectSets();
refreshPot();
2007-01-14 19:58:40 +00:00
//Action in LogWindow
2007-02-04 00:34:44 +00:00
myLog->logPlayerActionMsg(actualHand->getPlayerArray()[0]->getMyName(), actualHand->getPlayerArray()[0]->getMyAction(), actualHand->getPlayerArray()[0]->getMySet());
2007-01-14 19:58:40 +00:00
2007-01-13 02:40:33 +00:00
disableMyButtons();
//Spiel läuft weiter
nextPlayerAnimation();
}
void mainWindowImpl::myBet(){
pushButton_bet->setDisabled(TRUE);
pushButton_set->setEnabled(TRUE);
pushButton_allin->setEnabled(TRUE);
spinBox_set->setEnabled(TRUE);
//Hintergrundfarbe anpassen;
userWidgetsBackgroudColor();
if (actualHand->getActualRound() <= 2 ) { spinBox_set->setMinimum(actualHand->getSmallBlind()*2); }
else { spinBox_set->setMinimum(actualHand->getSmallBlind()*4); }
spinBox_set->setMaximum(actualHand->getPlayerArray()[0]->getMyCash());
spinBox_set->setValue(spinBox_set->minimum());
spinBox_set->setFocus();
spinBox_set->selectAll();
actualHand->getPlayerArray()[0]->setMyAction(4);
}
void mainWindowImpl::myRaise(){
pushButton_raise->setDisabled(TRUE);
pushButton_set->setEnabled(TRUE);
pushButton_allin->setEnabled(TRUE);
spinBox_set->setEnabled(TRUE);
//Hintergrundfarbe der userWidgets anpassen;
userWidgetsBackgroudColor();
int tempHighestSet = 0;
switch (actualHand->getActualRound()) {
case 0: {tempHighestSet = actualHand->getPreflop()->getHighestSet();}
break;
case 1: {tempHighestSet = actualHand->getFlop()->getHighestSet();}
break;
case 2: {tempHighestSet = actualHand->getTurn()->getHighestSet();}
break;
case 3: {tempHighestSet = actualHand->getRiver()->getHighestSet();}
break;
default: {}
}
spinBox_set->setMinimum(tempHighestSet*2 - actualHand->getPlayerArray()[0]->getMySet());
spinBox_set->setMaximum(actualHand->getPlayerArray()[0]->getMyCash());
spinBox_set->setValue(spinBox_set->minimum());
spinBox_set->setFocus();
spinBox_set->selectAll();
actualHand->getPlayerArray()[0]->setMyAction(5);
}
void mainWindowImpl::mySet(){
int tempCash = actualHand->getPlayerArray()[0]->getMyCash();
// cout << "Set-Value " << spinBox_set->value() << endl;
actualHand->getPlayerArray()[0]->setMySet(spinBox_set->value());
// cout << "MySET " << actualHand->getPlayerArray()[0]->getMySet() << endl;
if (spinBox_set->value() >= tempCash ) {
actualHand->getPlayerArray()[0]->setMyAction(6);
actualHand->getPlayerArray()[0]->setMySet(actualHand->getPlayerArray()[0]->getMyCash());
actualHand->getPlayerArray()[0]->setMyCash(0);
}
switch (actualHand->getActualRound()) {
case 0: {actualHand->getPreflop()->setHighestSet(actualHand->getPlayerArray()[0]->getMySet());}
break;
case 1: {actualHand->getFlop()->setHighestSet( actualHand->getPlayerArray()[0]->getMySet());}
break;
case 2: {actualHand->getTurn()->setHighestSet( actualHand->getPlayerArray()[0]->getMySet());}
break;
case 3: {actualHand->getRiver()->setHighestSet( actualHand->getPlayerArray()[0]->getMySet());}
break;
default: {}
}
actualHand->getPlayerArray()[0]->setMyTurn(0);
actualHand->getBoard()->collectSets();
refreshPot();
2007-01-14 19:58:40 +00:00
//Action in LogWindow
2007-02-04 00:34:44 +00:00
myLog->logPlayerActionMsg(actualHand->getPlayerArray()[0]->getMyName(), actualHand->getPlayerArray()[0]->getMyAction(), actualHand->getPlayerArray()[0]->getMySet());
2007-01-14 19:58:40 +00:00
2007-01-13 02:40:33 +00:00
disableMyButtons();
//Spiel läuft weiter
nextPlayerAnimation();
}
void mainWindowImpl::myAllIn(){
actualHand->getPlayerArray()[0]->setMyAction(6);
actualHand->getPlayerArray()[0]->setMySet(actualHand->getPlayerArray()[0]->getMyCash());
actualHand->getPlayerArray()[0]->setMyCash(0);
switch (actualHand->getActualRound()) {
case 0: {if(actualHand->getPlayerArray()[0]->getMySet() > actualHand->getPreflop()->getHighestSet()) actualHand->getPreflop()->setHighestSet(actualHand->getPlayerArray()[0]->getMySet());}
break;
case 1: {if(actualHand->getPlayerArray()[0]->getMySet() > actualHand->getFlop()->getHighestSet()) actualHand->getFlop()->setHighestSet(actualHand->getPlayerArray()[0]->getMySet());}
break;
case 2: {if(actualHand->getPlayerArray()[0]->getMySet() > actualHand->getTurn()->getHighestSet()) actualHand->getTurn()->setHighestSet(actualHand->getPlayerArray()[0]->getMySet());}
break;
case 3: {if(actualHand->getPlayerArray()[0]->getMySet() > actualHand->getRiver()->getHighestSet()) actualHand->getRiver()->setHighestSet(actualHand->getPlayerArray()[0]->getMySet());}
break;
default: {}
}
actualHand->getPlayerArray()[0]->setMyTurn(0);
actualHand->getBoard()->collectSets();
refreshPot();
2007-01-14 19:58:40 +00:00
//Action in LogWindow
2007-02-04 00:34:44 +00:00
myLog->logPlayerActionMsg(actualHand->getPlayerArray()[0]->getMyName(), actualHand->getPlayerArray()[0]->getMyAction(), actualHand->getPlayerArray()[0]->getMySet());
2007-01-13 02:40:33 +00:00
2007-01-14 19:58:40 +00:00
disableMyButtons();
2007-01-13 02:40:33 +00:00
//Spiel läuft weiter
nextPlayerAnimation();
}
void mainWindowImpl::nextPlayerAnimation() {
refreshChangePlayer();
2007-01-23 19:20:18 +00:00
nextPlayerAnimationTimer->start(nextPlayerSpeed1);
2007-01-13 02:40:33 +00:00
}
2007-01-23 19:20:18 +00:00
void mainWindowImpl::preflopAnimation1() { preflopAnimation1Timer->start(nextPlayerSpeed2); }
2007-01-13 02:40:33 +00:00
void mainWindowImpl::preflopAnimation1Action() { actualHand->getPreflop()->preflopRun(); }
2007-01-23 19:20:18 +00:00
void mainWindowImpl::preflopAnimation2() { preflopAnimation2Timer->start(preflopNextPlayerSpeed); }
2007-01-13 02:40:33 +00:00
void mainWindowImpl::preflopAnimation2Action() { actualHand->getPreflop()->nextPlayer2(); }
2007-01-23 19:20:18 +00:00
void mainWindowImpl::flopAnimation1() { flopAnimation1Timer->start(nextPlayerSpeed2); }
2007-01-13 02:40:33 +00:00
void mainWindowImpl::flopAnimation1Action() { actualHand->getFlop()->flopRun(); }
2007-01-23 19:20:18 +00:00
void mainWindowImpl::flopAnimation2() { flopAnimation2Timer->start(nextPlayerSpeed3); }
2007-01-13 02:40:33 +00:00
void mainWindowImpl::flopAnimation2Action() { actualHand->getFlop()->nextPlayer2(); }
2007-01-23 19:20:18 +00:00
void mainWindowImpl::turnAnimation1() { turnAnimation1Timer->start(nextPlayerSpeed2); }
2007-01-13 02:40:33 +00:00
void mainWindowImpl::turnAnimation1Action() { actualHand->getTurn()->turnRun(); }
2007-01-23 19:20:18 +00:00
void mainWindowImpl::turnAnimation2() { turnAnimation2Timer->start(nextPlayerSpeed3); }
2007-01-13 02:40:33 +00:00
void mainWindowImpl::turnAnimation2Action() { actualHand->getTurn()->nextPlayer2(); }
2007-01-23 19:20:18 +00:00
void mainWindowImpl::riverAnimation1() { riverAnimation1Timer->start(nextPlayerSpeed2); }
2007-01-13 02:40:33 +00:00
void mainWindowImpl::riverAnimation1Action() { actualHand->getRiver()->riverRun(); }
2007-01-23 19:20:18 +00:00
void mainWindowImpl::riverAnimation2() { riverAnimation2Timer->start(nextPlayerSpeed3); }
2007-01-13 02:40:33 +00:00
void mainWindowImpl::riverAnimation2Action() { actualHand->getRiver()->nextPlayer2(); }
2007-01-23 19:20:18 +00:00
void mainWindowImpl::postRiverAnimation1() { postRiverAnimation1Timer->start(nextPlayerSpeed2); }
2007-01-13 02:40:33 +00:00
void mainWindowImpl::postRiverAnimation1Action() { actualHand->getRiver()->postRiverRun(); }
void mainWindowImpl::postRiverRunAnimation1() {
//RoundsLabel mit "River" dunkel machen
QPalette tempPalette = frame_handLabel->palette();
tempPalette.setColor(QPalette::Window, active);
frame_handLabel->setPalette(tempPalette);
//PotLabel aufhellen!
tempPalette = frame_Pot->palette();
tempPalette.setColor(QPalette::Window, highlight);
frame_Pot->setPalette(tempPalette);
2007-01-23 19:20:18 +00:00
postRiverRunAnimation1Timer->start(postRiverRunAnimationSpeed);
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl::postRiverRunAnimation2() {
int i;
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<maxQuantityPlayers; i++) {
if (actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyActiveStatus() == 1) activePlayersCounter++;
}
if(activePlayersCounter!=1) {
if(!flipHolecardsAllInAlreadyDone) {
//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 i, j;
for(i=1; i<maxQuantityPlayers; i++) {
actualHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
for(j=0; j<2; j++) {
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) {
2007-01-13 02:40:33 +00:00
2007-02-01 23:46:34 +00:00
holeCardsArray[i][j]->startFlipCards(guiGameSpeed, QPixmap(":/cards/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png"), flipside);
}
}
}
2007-01-13 02:40:33 +00:00
}
else {
//Ohne Eye-Candy
//Karten der aktiven Spieler umdrehen
QPixmap onePix(":/graphics/cards/1px.png");
//TempArrays
QPixmap tempCardsPixmapArray[2];
int tempCardsIntArray[2];
int i, j;
for(i=1; i<maxQuantityPlayers; i++) {
actualHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
for(j=0; j<2; j++) {
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) {
2007-02-01 23:46:34 +00:00
tempCardsPixmapArray[j].load(":/cards/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png");
holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j], FALSE);
}
}
}
}
//Wenn einmal umgedreht dann fertig!!
flipHolecardsAllInAlreadyDone = TRUE;
2007-01-13 02:40:33 +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
}
void mainWindowImpl::postRiverRunAnimation3() {
int i;
2007-01-28 02:24:46 +00:00
// cout << "Neue Runde" << endl;
2007-01-13 02:40:33 +00:00
//Alle Winner erhellen und "Winner" schreiben
for(i=0; i<maxQuantityPlayers; i++) {
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyCardsValueInt() == actualHand->getRiver()->getHighestCardsValue() ) {
2007-02-04 23:58:50 +00:00
2007-01-13 02:40:33 +00:00
QPalette tempPalette = groupBoxArray[i]->palette();
tempPalette.setColor(QPalette::Window, highlight);
groupBoxArray[i]->setPalette(tempPalette);
actionLabelArray[i]->setText("<p align='center'><b>- Winner -</b></p>");
2007-01-28 01:28:19 +00:00
2007-02-04 23:58:50 +00:00
myLog->logPlayerWinsMsg(i);
2007-01-28 01:28:19 +00:00
//nicht gewonnene Karten ausblenden
2007-02-03 22:47:16 +00:00
if ( actualHand->getActivePlayersCounter() != 1 && myConfig->readConfigInt("ShowFadeOutCardsAnimation")) {
2007-01-28 01:28:19 +00:00
int j;
//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<=4; j++) {
// cout << (actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] << endl;
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[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<=4; j++) {
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[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<=4; j++) {
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[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<=4; j++) {
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[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<=4; j++) {
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[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<=4; j++) {
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[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<=4; j++) {
if ((actualHand->getPlayerArray()[i]->getMyBestHandPosition())[j] == 6 ) { index6 = FALSE; }
}
if (index6) { boardCardsArray[4]->startFadeOut(guiGameSpeed); /*cout << "Fade Out index6" << endl;*/}
2007-02-02 00:59:51 +00:00
}
}
else {
2007-02-03 22:47:16 +00:00
if( actualHand->getActivePlayersCounter() != 1 && actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyActiveStatus() && myConfig->readConfigInt("ShowFadeOutCardsAnimation") ) {
2007-02-02 00:59:51 +00:00
//aufgedeckte Gegner auch ausblenden
holeCardsArray[i][0]->startFadeOut(guiGameSpeed);
holeCardsArray[i][1]->startFadeOut(guiGameSpeed);
}
2007-01-13 02:40:33 +00:00
}
}
2007-01-28 01:28:19 +00:00
2007-01-13 02:40:33 +00:00
//Hintergrundfarbe der userWidgets anpassen;
userWidgetsBackgroudColor();
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;
//CashTopLabel und PotLabel blinken lassen
if (distributePotAnimCounter<10) {
if (distributePotAnimCounter==0 || distributePotAnimCounter==2 || distributePotAnimCounter==4 || distributePotAnimCounter==6 || distributePotAnimCounter==8) {
QPalette labelPalette = label_Pot->palette();
labelPalette.setColor(QPalette::WindowText, highlight);
label_Pot->setPalette(labelPalette);
for(i=0; i<maxQuantityPlayers; i++) {
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyCardsValueInt() == actualHand->getRiver()->getHighestCardsValue() ) {
cashTopLabelArray[i]->setAutoFillBackground(TRUE);
QPalette labelPalette = cashTopLabelArray[i]->palette();
labelPalette.setColor(QPalette::WindowText, highlight);
cashTopLabelArray[i]->setPalette(labelPalette);
}
}
}
else {
QColor c(0,0,0);
QPalette labelPalette = label_Pot->palette();
labelPalette.setColor(QPalette::WindowText, c);
label_Pot->setPalette(labelPalette);
for(i=0; i<maxQuantityPlayers; i++) {
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyCardsValueInt() == actualHand->getRiver()->getHighestCardsValue() ) {
QPalette labelPalette = cashTopLabelArray[i]->palette();
labelPalette.setColor(QPalette::WindowText, c);
cashTopLabelArray[i]->setPalette(labelPalette);
cashTopLabelArray[i]->setAutoFillBackground(FALSE);
}
}
}
distributePotAnimCounter++;
}
else {
potDistributeTimer->stop();
2007-01-23 19:20:18 +00:00
postRiverRunAnimation5Timer->start(gameSpeed);
2007-01-13 02:40:33 +00:00
}
}
void mainWindowImpl::postRiverRunAnimation6() {
int i;
refreshCash();
refreshPot();
// wenn nur noch ein Spieler aktive "neues Spiel"-Dialog anzeigen
int playersPositiveCashCounter = 0;
for (i=0; i<actualGame->getStartQuantityPlayers(); i++) {
if (actualHand->getPlayerArray()[i]->getMyCash() > 0) playersPositiveCashCounter++;
}
if (playersPositiveCashCounter==1) {
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;
if(!flipHolecardsAllInAlreadyDone) {
//Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen
int activePlayersCounter = 0;
for (i=0; i<maxQuantityPlayers; i++) {
if (actualHand->getPlayerArray()[i]->getMyAction() != 1 && actualHand->getPlayerArray()[i]->getMyActiveStatus() == 1) activePlayersCounter++;
}
if(activePlayersCounter!=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 i, j;
for(i=1; i<maxQuantityPlayers; i++) {
actualHand->getPlayerArray()[i]->getMyCards(tempCardsIntArray);
for(j=0; j<2; j++) {
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) {
2007-02-01 23:46:34 +00:00
holeCardsArray[i][j]->startFlipCards(guiGameSpeed, QPixmap(":/cards/graphics/cards/"+QString::number(tempCardsIntArray[j], 10)+".png"), flipside);
}
}
}
}
else {
//Ohne Eye-Candy
//Karten der aktiven Spieler umdrehen
QPixmap onePix(":/graphics/cards/1px.png");
//TempArrays
QPixmap tempCardsPixmapArray[2];
int temp2CardsIntArray[2];
int i, j;
for(i=1; i<maxQuantityPlayers; i++) {
actualHand->getPlayerArray()[i]->getMyCards(temp2CardsIntArray);
for(j=0; j<2; j++) {
if(actualHand->getPlayerArray()[i]->getMyActiveStatus() && actualHand->getPlayerArray()[i]->getMyAction() != 1) {
2007-02-01 23:46:34 +00:00
tempCardsPixmapArray[j].load(":/cards/graphics/cards/"+QString::number(temp2CardsIntArray[j], 10)+".png");
holeCardsArray[i][j]->setPixmap(tempCardsPixmapArray[j], FALSE);
}
}
}
}
}
}
//Wenn einmal umgedreht dann fertig!!
flipHolecardsAllInAlreadyDone = TRUE;
}
2007-01-13 02:40:33 +00:00
void mainWindowImpl::startNewHand() {
2007-01-23 23:53:12 +00:00
if( !breakAfterActualHand){ actualGame->startHand();
2007-01-13 02:40:33 +00:00
}
2007-01-14 19:58:40 +00:00
else {
pushButton_break->setDisabled(FALSE);
2007-01-14 23:50:38 +00:00
pushButton_break->setText("Start");
2007-01-14 19:58:40 +00:00
breakAfterActualHand=FALSE;
}
2007-01-13 02:40:33 +00:00
}
2007-01-23 23:53:12 +00:00
void mainWindowImpl::handSwitchRounds() { actualHand->switchRounds(); }
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
2007-01-13 02:40:33 +00:00
QPixmap onePix(":/graphics/cards/1px.png");
for (i=0; i<5; i++ ) {
boardCardsArray[i]->setPixmap(onePix, FALSE);
boardCardsArray[i]->setFadeOutAction(FALSE);
}
for (i=1; i<=4; i++ ) {
for ( j=0; j<=1; j++ ) { holeCardsArray[i][j]->setFadeOutAction(FALSE);}
}
2007-01-13 02:40:33 +00:00
QColor c(0,0,0);
for(i=0; i<maxQuantityPlayers; i++) {
QPalette labelPalette = cashTopLabelArray[i]->palette();
labelPalette.setColor(QPalette::WindowText, c);
cashTopLabelArray[i]->setPalette(labelPalette);
}
QPalette labelPalette = label_Pot->palette();
labelPalette.setColor(QPalette::WindowText, c);
label_Pot->setPalette(labelPalette);
disableMyButtons();
QPalette tempPalette = frame_Pot->palette();
tempPalette.setColor(QPalette::Window, active);
frame_Pot->setPalette(tempPalette);
textLabel_handLabel->setText("<p align='center'><span style='font-size:14pt; font-weight:bold'> </span></p>");
tempPalette = frame_handLabel->palette();
tempPalette.setColor(QPalette::Window, active);
frame_handLabel->setPalette(tempPalette);
refreshAll();
flipHolecardsAllInAlreadyDone = FALSE;
//Wenn Pause zwischen den Hands in der Konfiguration steht den Stop Button drücken!
2007-02-03 22:47:16 +00:00
if (myConfig->readConfigInt("PauseBetweenHands")) { pushButton_break->click(); }
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-13 02:40:33 +00:00
void mainWindowImpl::userWidgetsBackgroudColor() {
int i;
for(i=0; i<=7; i++) {
QPalette tempPalette = userWidgetsArray[i]->palette();
if (actualHand->getPlayerArray()[0]->getMyTurn() && userWidgetsArray[i]->isEnabled()) {
//Farbe der Buttons wenn der Spieler dran ist.
QColor tempColor(203,237,180);
tempPalette.setColor(QPalette::Button, tempColor);
}
else {
QColor tempColor = tempPalette.color(QPalette::Window);
tempPalette.setColor(QPalette::Button, tempColor);
}
userWidgetsArray[i]->setPalette(tempPalette);
}
}
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)
postDealCardsSpeed = dealCardsSpeed*2; //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-01-15 08:35:26 +00:00
if (pushButton_break->text() == "Stop") {
pushButton_break->setDisabled(TRUE);
breakAfterActualHand=TRUE;
}
else {
pushButton_break->setText("Stop");
startNewHand();
}
2007-01-14 19:58:40 +00:00
}
2007-01-27 09:08:55 +00:00
void mainWindowImpl::paintStartSplash() {
2007-01-27 14:19:50 +00:00
StartSplash *mySplash = new StartSplash(this);
2007-01-27 09:08:55 +00:00
mySplash->setMaximumSize(400,250);
mySplash->setMinimumSize(400,250);
2007-02-01 22:09:09 +00:00
// mySplash->setWindowFlags(Qt::SplashScreen);
2007-01-27 09:08:55 +00:00
mySplash->show();
}
2007-01-24 23:46:49 +00:00
2007-01-20 01:38:40 +00:00
void mainWindowImpl::keyPressEvent ( QKeyEvent * event ) {
2007-02-04 14:41:53 +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;
if (event->key() == 16777220) { if(spinBox_set->hasFocus()) pushButton_set->click(); } //ENTER
if (event->key() == 16777265) { switchToolBox(); } //F2
2007-02-04 13:46:27 +00:00
if (event->key() == 16777249) {
pushButton_break->click();
ctrlPressed = TRUE;
// QTimer::SingleShot
} //CTRL
2007-02-02 13:59:09 +00:00
// if (event->key() == 65) { paintStartSplash();
2007-01-24 23:46:49 +00:00
2007-02-02 13:59:09 +00:00
// if (event->key() == 66) { label_logo->hide(); }
2007-01-23 19:20:18 +00:00
2007-01-20 01:38:40 +00:00
}
2007-01-20 17:49:33 +00:00
void mainWindowImpl::switchToolBox() {
if (groupBox_tools->isHidden()) { groupBox_tools->show(); }
else { groupBox_tools->hide(); }
}