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-02-17 20:01:20 +00:00
#include "joinnetworkgamedialogimpl.h"
#include "connecttoserverdialogimpl.h"
2007-02-22 00:48:18 +00:00
#include "createnetworkgamedialogimpl.h"
#include "startnetworkgamedialogimpl.h"
2007-03-20 02:20:50 +00:00
#include "waitforservertostartgamedialogimpl.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"
2007-01-13 22:29:17 +00:00
#include "playerinterface.h"
#include "boardinterface.h"
2007-05-12 22:00:59 +00:00
#include "handinterface.h"
#include "game.h"
2007-01-13 02:40:33 +00:00
#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-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-03-20 14:05:16 +00:00
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 )
: QMainWindow ( parent ), myConfig ( c ), gameSpeed ( 0 ), debugMode ( 0 ), breakAfterActualHand ( FALSE )
2007-05-11 12:01:13 +00:00
{
2007-01-28 23:33:48 +00:00
int i ;
2007-04-30 23:14:30 +00:00
this -> setStyle ( new QPlastiqueStyle );
2007-04-03 10:55:16 +00:00
//for statistic development
for ( i = 0 ; i < 15 ; i ++ ) {
statisticArray [ i ] = 0 ;
}
////////////////////////////
2007-05-13 12:35:27 +00:00
2007-03-03 00:11:26 +00:00
// Resourcen abladen
QFile preflopValuesFile ( ":data/resources/data/preflopValues" );
2007-04-03 10:55:16 +00:00
QFile preflopValuesFileDest ( QString :: fromUtf8 ( myConfig -> readConfigString ( "DataDir" ). c_str ()) + QString ( "preflopValues" ));
2007-03-23 21:45:30 +00:00
// if(!preflopValuesFileDest.exists()) {
2007-04-03 10:55:16 +00:00
preflopValuesFile . copy ( QString :: fromUtf8 ( myConfig -> readConfigString ( "DataDir" ). c_str ()) + QString ( "preflopValues" ));
2007-03-23 21:45:30 +00:00
// }
QFile flopValuesFile ( ":data/resources/data/flopValues" );
2007-04-03 10:55:16 +00:00
QFile flopValuesFileDest ( QString :: fromUtf8 ( myConfig -> readConfigString ( "DataDir" ). c_str ()) + QString ( "flopValues" ));
2007-03-23 21:45:30 +00:00
// if(!flopValuesFileDest.exists()) {
2007-04-03 10:55:16 +00:00
flopValuesFile . copy ( QString :: fromUtf8 ( myConfig -> readConfigString ( "DataDir" ). c_str ()) + QString ( "flopValues" ));
2007-03-23 21:45:30 +00:00
// }
2007-03-03 00:11:26 +00:00
2007-03-27 16:02:23 +00:00
// Schriftart laden und für Dialoge setzen
2007-02-02 01:34:09 +00:00
#ifdef _WIN32
2007-03-27 16:02:23 +00:00
QFont tmpFont1 ;
tmpFont1 . setFamily ( "Arial" );
tmpFont1 . setPixelSize ( 12 );
2007-02-08 01:28:58 +00:00
// if(this->logicalDpiX() > 105) { tmpFont.setFont("Arial",8); }
// else { QFont tmpFont("Arial",9); }
2007-02-02 01:34:09 +00:00
#else
2007-03-03 00:11:26 +00:00
QFontDatabase :: addApplicationFont ( ":fonts/resources/fonts/n019003l.pfb" );
2007-03-27 16:02:23 +00:00
QFontDatabase :: addApplicationFont ( ":fonts/resources/fonts/VeraBd.ttf" );
2007-02-08 01:28:58 +00:00
// QFont tmpFont("Nimbus Sans L",9);
2007-03-27 16:02:23 +00:00
QFont tmpFont1 ;
tmpFont1 . setFamily ( "Nimbus Sans L" );
tmpFont1 . setPixelSize ( 12 );
2007-02-02 01:34:09 +00:00
#endif
2007-03-27 16:02:23 +00:00
QApplication :: setFont ( tmpFont1 );
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-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;
2007-03-03 00:11:26 +00:00
flipside = new QPixmap ( ":/cards/resources/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" ) != "" ) {
2007-04-03 10:55:16 +00:00
QPixmap tmpFlipside ( QString :: fromUtf8 ( myConfig -> readConfigString ( "FlipsideOwnFile" ). c_str ()));
2007-01-28 23:33:48 +00:00
flipside = new QPixmap ( tmpFlipside . scaled ( QSize ( 57 , 80 )));
}
2007-03-03 00:11:26 +00:00
else { flipside -> load ( ":/cards/resources/graphics/cards/flipside.png" ); }
2007-01-28 01:28:19 +00:00
2007-01-31 01:17:13 +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 ;
2007-01-13 02:40:33 +00:00
2007-03-28 10:21:51 +00:00
//hide userWidgets
for ( i = 0 ; i < 4 ; i ++ ) {
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 );
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 );
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-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
// 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-03-27 16:02:23 +00:00
//Schriftart und Schriftgrößen für Widgets festlegen
#ifdef _WIN32
tmpFont1 . setPixelSize ( 11 );
textBrowser_Log -> setFont ( tmpFont1 );
#else
tmpFont1 . setPixelSize ( 10 );
textBrowser_Log -> setFont ( tmpFont1 );
#endif
QFont tmpFont2 ;
tmpFont2 . setFamily ( "Bitstream Vera Sans" );
tmpFont2 . setPixelSize ( 18 );
label_Pot -> setFont ( tmpFont2 );
tmpFont2 . setPixelSize ( 10 );
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-03-27 16:02:23 +00:00
cashTopLabelArray [ i ] -> setFont ( tmpFont2 );
cashLabelArray [ i ] -> setFont ( tmpFont2 );
}
2007-03-28 10:21:51 +00:00
spinBox_set -> setFont ( tmpFont2 );
2007-03-27 21:36:56 +00:00
tmpFont2 . setPixelSize ( 12 );
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-03-27 16:02:23 +00:00
setLabelArray [ i ] -> setFont ( tmpFont2 );
}
tmpFont2 . setPixelSize ( 13 );
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-03-27 16:02:23 +00:00
playerNameLabelArray [ i ] -> setFont ( tmpFont2 );
}
label_Sets -> setFont ( tmpFont2 );
label_Total -> setFont ( tmpFont2 );
textLabel_Sets -> setFont ( tmpFont2 );
textLabel_Pot -> setFont ( tmpFont2 );
label_handNumber -> setFont ( tmpFont2 );
label_gameNumber -> setFont ( tmpFont2 );
textLabel_handNumber -> setFont ( tmpFont2 );
textLabel_gameNumber -> setFont ( tmpFont2 );
// tmpFont2.setPixelSize(15);
tmpFont2 . setPixelSize ( 17 );
tmpFont2 . setBold ( TRUE );
textLabel_handLabel -> setFont ( tmpFont2 );
//Widgets Grafiken per Stylesheets setzen
2007-03-28 10:21:51 +00:00
//Groupbox Background
2007-04-17 07:28:32 +00:00
for ( i = 1 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-03-27 16:02:23 +00:00
groupBoxArray [ i ] -> setStyleSheet ( "QGroupBox { background-image: url(:/guiv2/resources/guiv2/opponentBoxInactiveGlow.png) }" );
}
2007-03-28 10:21:51 +00:00
groupBoxArray [ 0 ] -> setStyleSheet ( "QGroupBox { background-image: url(:/guiv2/resources/guiv2/playerBoxInactiveGlow.png) }" );
//Human player button
pushButton_BetRaise -> setStyleSheet ( "QPushButton { background-image: url(:/guiv2/resources/guiv2/playeraction_03.png); font-family: \" Bitstream Vera Sans \" ; font-size: 11px }" );
pushButton_CallCheckSet -> setStyleSheet ( "QPushButton { background-image: url(:/guiv2/resources/guiv2/playeraction_05.png); font-family: \" Bitstream Vera Sans \" ; font-size: 11px }" );
pushButton_FoldAllin -> setStyleSheet ( "QPushButton { background-image: url(:/guiv2/resources/guiv2/playeraction_07.png); font-family: \" Bitstream Vera Sans \" ; font-size: 11px }" );
2007-03-27 16:02:23 +00:00
2007-03-27 21:36:56 +00:00
//raise actionLable above just inserted mypixmaplabel
2007-04-17 07:28:32 +00:00
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
//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-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
this -> setWindowIcon ( QIcon ( QString :: fromUtf8 ( ":/graphics/resources/graphics/windowicon.png" )));
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-13 13:32:06 +00:00
mySettingsDialog = new settingsDialogImpl ( this , myConfig );
myJoinNetworkGameDialog = new joinNetworkGameDialogImpl ( this , myConfig );
2007-02-27 19:44:03 +00:00
myConnectToServerDialog = new connectToServerDialogImpl ( this );
myStartNetworkGameDialog = new startNetworkGameDialogImpl ( this );
2007-05-13 13:32:06 +00:00
myCreateNetworkGameDialog = new createNetworkGameDialogImpl ( this , myConfig );
2007-03-20 02:20:50 +00:00
myWaitingForServerGameDialog = new waitForServerToStartGameDialogImpl ( this );
2007-05-13 12:35:27 +00:00
myAboutPokerthDialog = new aboutPokerthImpl ( this );
2007-02-18 21:06:21 +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-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 () ) );
2007-02-22 00:48:18 +00:00
connect ( actionCreate_network_Game , SIGNAL ( triggered () ), this , SLOT ( callCreateNetworkGameDialog () ) );
2007-02-01 19:04:18 +00:00
connect ( actionQuit , SIGNAL ( triggered () ), qApp , SLOT ( quit () ) );
2007-02-27 19:44:03 +00:00
connect ( actionFullScreen , SIGNAL ( triggered () ), this , SLOT ( switchFullscreen () ) );
2007-02-15 00:57:04 +00:00
2007-03-28 10:21:51 +00:00
connect ( pushButton_BetRaise , SIGNAL ( clicked () ), this , SLOT ( myBetRaise () ) );
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-02-18 21:06:21 +00:00
//Nachrichten Thread-Save
2007-03-20 02:20:50 +00:00
connect ( this , SIGNAL ( SignalNetClientConnect ( int )), myConnectToServerDialog , SLOT ( refresh ( int )));
connect ( this , SIGNAL ( SignalNetClientGameInfo ( int )), myWaitingForServerGameDialog , SLOT ( refresh ( int )));
2007-05-06 21:15:43 +00:00
connect ( this , SIGNAL ( SignalNetClientPlayerJoined ( QString )), myWaitingForServerGameDialog , SLOT ( addConnectedPlayer ( QString )));
connect ( this , SIGNAL ( SignalNetClientPlayerLeft ( QString )), myWaitingForServerGameDialog , SLOT ( removePlayer ( QString )));
2007-03-20 14:05:16 +00:00
// Errors are handled globally, not within one dialog.
connect ( this , SIGNAL ( SignalNetClientError ( int , int )), this , SLOT ( networkError ( int , int )));
2007-04-27 22:55:19 +00:00
connect ( this , SIGNAL ( SignalNetClientGameStart ( int , int , int , int )), this , SLOT ( networkStart ( int , int , int , int )));
2007-01-24 19:48:52 +00:00
2007-04-08 20:35:42 +00:00
connect ( this , SIGNAL ( SignalNetServerPlayerJoined ( QString )), myStartNetworkGameDialog , SLOT ( addConnectedPlayer ( QString )));
2007-05-02 22:46:29 +00:00
connect ( this , SIGNAL ( SignalNetServerPlayerLeft ( QString )), myStartNetworkGameDialog , SLOT ( removePlayer ( QString )));
2007-04-08 20:35:42 +00:00
2007-03-01 21:30:40 +00:00
// textBrowser_Log->append(QString::number(this->pos().x(),10)+" "+QString::number(this->pos().y(),10));
// textBrowser_Log->append(QString::number(this->x(),10)+" "+QString::number(this->y(),10));
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-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-23 00:49:45 +00:00
}
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-20 14:05:16 +00:00
2007-03-21 00:41:29 +00:00
void mainWindowImpl :: startNewLocalGame ( newGameDialogImpl * v ) {
2007-03-20 14:05:16 +00:00
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
2007-04-26 23:07:08 +00:00
GameData gameData ;
2007-03-21 00:41:29 +00:00
if ( v ) {
2007-04-26 23:07:08 +00:00
// Set Game Data
gameData . numberOfPlayers = v -> spinBox_quantityPlayers -> value ();
gameData . startCash = v -> spinBox_startCash -> value ();
gameData . smallBlind = v -> spinBox_smallBlind -> value ();
gameData . handsBeforeRaise = v -> spinBox_handsBeforeRaiseSmallBlind -> value ();
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 {
2007-04-26 23:07:08 +00:00
// Set Game Data
gameData . numberOfPlayers = myConfig -> readConfigInt ( "NumberOfPlayers" );
gameData . startCash = myConfig -> readConfigInt ( "StartCash" );
gameData . smallBlind = myConfig -> readConfigInt ( "SmallBlind" );
gameData . handsBeforeRaise = myConfig -> readConfigInt ( "HandsBeforeRaiseSmallBlind" );
2007-05-02 21:20:54 +00:00
//Speeds
gameData . guiSpeed = myConfig -> readConfigInt ( "GameSpeed" );
2007-01-22 22:25:58 +00:00
}
2007-04-26 23:07:08 +00:00
//Start Game!!!
mySession -> startGame ( gameData );
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
2007-02-22 00:48:18 +00:00
void mainWindowImpl :: callCreateNetworkGameDialog () {
2007-03-20 02:20:50 +00:00
myCreateNetworkGameDialog -> exec ();
2007-02-22 00:48:18 +00:00
//
if ( myCreateNetworkGameDialog -> result () == QDialog :: Accepted ) {
2007-03-20 02:20:50 +00:00
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 ()));
{
boost :: shared_ptr < Session > session ( new Session ( myServerGuiInterface . get (), myConfig ));
myServerGuiInterface -> setSession ( session );
}
}
// Terminate existing network games.
2007-03-20 14:05:16 +00:00
mySession -> terminateNetworkClient ();
2007-05-14 12:40:42 +00:00
myServerGuiInterface -> getSession (). terminateNetworkServer ();
2007-03-20 14:05:16 +00:00
2007-04-26 23:07:08 +00:00
GameData gameData ;
gameData . numberOfPlayers = myCreateNetworkGameDialog -> spinBox_quantityPlayers -> value ();
gameData . startCash = myCreateNetworkGameDialog -> spinBox_startCash -> value ();
gameData . smallBlind = myCreateNetworkGameDialog -> spinBox_smallBlind -> value ();
gameData . handsBeforeRaise = myCreateNetworkGameDialog -> spinBox_handsBeforeRaiseSmallBlind -> value ();
2007-05-02 21:20:54 +00:00
gameData . guiSpeed = myCreateNetworkGameDialog -> spinBox_gameSpeed -> value ();
2007-04-26 23:07:08 +00:00
2007-05-02 21:51:02 +00:00
myStartNetworkGameDialog -> treeWidget -> clear ();
2007-05-14 12:40:42 +00:00
myServerGuiInterface -> getSession (). startNetworkServer ( gameData );
2007-03-20 14:05:16 +00:00
mySession -> startNetworkClientForLocalServer ();
2007-03-20 02:20:50 +00:00
myStartNetworkGameDialog -> exec ();
2007-05-02 21:51:02 +00:00
2007-03-20 02:20:50 +00:00
if ( myStartNetworkGameDialog -> result () == QDialog :: Accepted ) {
2007-05-14 12:40:42 +00:00
myServerGuiInterface -> getSession (). initiateNetworkServerGame ();
2007-03-20 02:20:50 +00:00
}
2007-03-20 14:05:16 +00:00
else {
mySession -> terminateNetworkClient ();
2007-05-14 12:40:42 +00:00
myServerGuiInterface -> getSession (). terminateNetworkServer ();
2007-03-20 14:05:16 +00:00
}
2007-02-22 00:48:18 +00:00
}
}
2007-02-15 00:57:04 +00:00
void mainWindowImpl :: callJoinNetworkGameDialog () {
2007-02-18 21:06:21 +00:00
myJoinNetworkGameDialog -> exec ();
2007-02-15 00:57:04 +00:00
2007-02-19 00:39:44 +00:00
if ( myJoinNetworkGameDialog -> result () == QDialog :: Accepted ) {
mySession -> terminateNetworkClient ();
2007-05-14 12:40:42 +00:00
if ( myServerGuiInterface . get ())
myServerGuiInterface -> getSession (). terminateNetworkServer ();
2007-02-19 00:39:44 +00:00
2007-05-06 23:27:08 +00:00
myWaitingForServerGameDialog -> treeWidget -> clear ();
2007-02-19 00:39:44 +00:00
// Maybe use QUrl::toPunycode.
mySession -> startNetworkClient (
myJoinNetworkGameDialog -> lineEdit_ipAddress -> text (). toUtf8 (). constData (),
myJoinNetworkGameDialog -> spinBox_port -> value (),
myJoinNetworkGameDialog -> checkBox_ipv6 -> 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 ) {
2007-02-19 00:39:44 +00:00
mySession -> terminateNetworkClient ();
actionJoin_network_Game -> trigger (); // re-trigger
2007-02-17 23:18:34 +00:00
}
2007-03-20 02:20:50 +00:00
else {
myWaitingForServerGameDialog -> exec ();
2007-03-20 14:05:16 +00:00
if ( myWaitingForServerGameDialog -> result () == QDialog :: Rejected ) {
mySession -> terminateNetworkClient ();
}
2007-03-20 02:20:50 +00:00
}
2007-02-17 19:36:32 +00:00
}
2007-02-15 00:57:04 +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-05-13 12:35:27 +00:00
if ( 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 (); }
2007-01-28 14:48:18 +00:00
//Falls Spielernamen geändert wurden --> neu zeichnen --> erst beim nächsten Neustart neu ausgelesen
2007-05-13 12:35:27 +00:00
if ( mySettingsDialog -> getPlayerNickIsChanged () && mySession -> getCurrentGame ()) {
2007-01-28 21:19:00 +00:00
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
2007-05-13 12:35:27 +00:00
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 );
2007-01-28 14:48:18 +00:00
refreshPlayerName ();
}
2007-03-29 22:58:04 +00:00
2007-05-11 12:01:13 +00:00
if ( mySession -> getCurrentGame ()) {
2007-03-29 22:58:04 +00:00
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
2007-05-13 12:35:27 +00:00
currentHand -> getPlayerArray ()[ 0 ] -> setMyAvatar ( mySettingsDialog -> lineEdit_humanPlayerAvatar -> text (). toUtf8 (). constData ());
currentHand -> getPlayerArray ()[ 1 ] -> setMyAvatar ( mySettingsDialog -> lineEdit_Opponent1Avatar -> text (). toUtf8 (). constData ());
currentHand -> getPlayerArray ()[ 2 ] -> setMyAvatar ( mySettingsDialog -> lineEdit_Opponent2Avatar -> text (). toUtf8 (). constData ());
currentHand -> getPlayerArray ()[ 3 ] -> setMyAvatar ( mySettingsDialog -> lineEdit_Opponent3Avatar -> text (). toUtf8 (). constData ());
currentHand -> getPlayerArray ()[ 4 ] -> setMyAvatar ( mySettingsDialog -> lineEdit_Opponent4Avatar -> text (). toUtf8 (). constData ());
currentHand -> getPlayerArray ()[ 5 ] -> setMyAvatar ( mySettingsDialog -> lineEdit_Opponent5Avatar -> text (). toUtf8 (). constData ());
currentHand -> getPlayerArray ()[ 6 ] -> setMyAvatar ( mySettingsDialog -> lineEdit_Opponent6Avatar -> text (). toUtf8 (). constData ());
2007-03-29 22:58:04 +00:00
//avatar refresh
refreshPlayerAvatar ();
}
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
}
2007-03-03 00:11:26 +00:00
else { flipside -> load ( ":/cards/resources/graphics/cards/flipside.png" ); }
2007-01-28 23:33:48 +00:00
2007-01-29 00:53:20 +00:00
int i , j ;
2007-04-17 07:28:32 +00:00
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 );
}
}
}
2007-03-28 17:44:22 +00:00
2007-03-29 22:58:04 +00:00
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 ();
label_Pot -> setText ( "<span style='font-weight:bold'>Pot</span>" );
label_Total -> setText ( "<span style='font-weight:bold'>Total:</span>" );
label_Sets -> setText ( "<span style='font-weight:bold'>Sets:</span>" );
label_handNumber -> setText ( "<span style='font-weight:bold'>Hand:</span>" );
label_gameNumber -> setText ( "<span style='font-weight:bold'>Game:</span>" );
//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 < 3 ; i ++ ) {
userWidgetsArray [ i ] -> show ();
}
guiGameSpeed = speed ;
//positioning Slider
horizontalSlider_speed -> setValue ( guiGameSpeed );
setSpeeds ();
}
2007-05-11 12:01:13 +00:00
Session & mainWindowImpl :: getSession () { assert ( mySession . get ()); return * mySession ; }
2007-01-13 02:40:33 +00:00
2007-05-11 12:01:13 +00:00
void mainWindowImpl :: setSession ( boost :: shared_ptr < Session > session )
{
mySession = session ;
}
2007-01-13 02:40:33 +00:00
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 ;
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-05-11 12:01:13 +00:00
if ( mySession -> getCurrentGame () -> getCurrentHand () -> getPlayerArray ()[ i ] -> getMySet () == 0 ) setLabelArray [ i ] -> setText ( "" );
else setLabelArray [ i ] -> setText ( "<p align='center'><b>Set:</b> " + QString :: number ( mySession -> getCurrentGame () -> getCurrentHand () -> getPlayerArray ()[ i ] -> getMySet (), 10 ) + " $</p>" );
2007-01-13 02:40:33 +00:00
}
}
void mainWindowImpl :: refreshButton () {
2007-03-27 16:02:23 +00:00
QPixmap dealerButton ( ":/guiv2/resources/guiv2/dealerPuck.png" );
2007-03-03 00:11:26 +00:00
QPixmap onePix ( ":/graphics/resources/graphics/1px.png" );
2007-01-13 02:40:33 +00:00
int i ;
2007-02-10 22:35:35 +00:00
int k ;
//Aktive Spieler zählen
int activePlayersCounter = 0 ;
2007-04-17 07:28:32 +00:00
for ( k = 0 ; k < MAX_NUMBER_OF_PLAYERS ; k ++ ) {
2007-05-11 12:01:13 +00:00
if ( mySession -> getCurrentGame () -> getCurrentHand () -> getPlayerArray ()[ k ] -> getMyActiveStatus () == 1 ) activePlayersCounter ++ ;
2007-02-10 22:35:35 +00:00
}
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ i ] -> getMyActiveStatus ()) {
2007-03-28 10:21:51 +00:00
if ( activePlayersCounter > 2 ) {
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ i ] -> getMyButton () == 1 ) {
2007-03-28 10:21:51 +00:00
buttonLabelArray [ i ] -> setPixmap ( dealerButton );
}
else {
buttonLabelArray [ i ] -> setPixmap ( onePix );
}
2007-02-10 22:35:35 +00:00
}
2007-03-28 10:21:51 +00:00
else {
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ i ] -> getMyButton () == 3 ) {
2007-03-28 10:21:51 +00:00
buttonLabelArray [ i ] -> setPixmap ( dealerButton );
}
else {
buttonLabelArray [ i ] -> setPixmap ( onePix );
}
}
2007-01-16 21:23:39 +00:00
}
2007-03-28 10:21:51 +00:00
else { buttonLabelArray [ i ] -> setPixmap ( onePix ); }
2007-01-16 21:23:39 +00:00
}
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl :: refreshPlayerName () {
int i ;
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-05-11 12:01:13 +00:00
if ( mySession -> getCurrentGame () -> getCurrentHand () -> getPlayerArray ()[ i ] -> getMyActiveStatus ()) {
playerNameLabelArray [ i ] -> setText ( QString :: fromUtf8 ( mySession -> getCurrentGame () -> getCurrentHand () -> getPlayerArray ()[ i ] -> getMyName (). c_str ()));
2007-03-27 16:02:23 +00:00
} else {
playerNameLabelArray [ i ] -> setText ( "" );
}
}
}
void mainWindowImpl :: refreshPlayerAvatar () {
QPixmap onePix ( ":/graphics/resources/graphics/1px.png" );
int i ;
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ i ] -> getMyActiveStatus ()) {
2007-03-28 17:44:22 +00:00
if ( ! i ) {
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ 0 ] -> getMyAvatar () == "" ) {
2007-03-28 17:44:22 +00:00
playerAvatarLabelArray [ 0 ] -> setPixmap ( QPixmap ( ":/guiv2/resources/guiv2/genereticAvatar.png" ));
}
else {
2007-05-11 12:01:13 +00:00
playerAvatarLabelArray [ 0 ] -> setPixmap ( QString :: fromUtf8 ( currentHand -> getPlayerArray ()[ 0 ] -> getMyAvatar (). c_str ()));
2007-03-28 17:44:22 +00:00
}
}
2007-03-29 00:15:43 +00:00
else {
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ i ] -> getMyAvatar () == "" ) {
2007-03-28 17:44:22 +00:00
playerAvatarLabelArray [ i ] -> setPixmap ( QPixmap ( ":/guiv2/resources/guiv2/genereticAvatar.png" ));
}
else {
2007-05-11 12:01:13 +00:00
playerAvatarLabelArray [ i ] -> setPixmap ( QString :: fromUtf8 ( currentHand -> getPlayerArray ()[ i ] -> getMyAvatar (). c_str ()));
2007-03-28 17:44:22 +00:00
}
}
2007-03-27 16:02:23 +00:00
}
else {
playerAvatarLabelArray [ i ] -> setPixmap ( onePix );
}
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
2007-03-27 21:36:56 +00:00
QPixmap onePix ( ":/graphics/resources/graphics/1px.png" );
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
2007-05-11 12:01:13 +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
2007-03-29 22:58:04 +00:00
int i ;
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-03-29 22:58:04 +00:00
//if no action --> clear Pixmap
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ i ] -> getMyAction () == 0 ) {
2007-03-29 22:58:04 +00:00
actionLabelArray [ i ] -> setPixmap ( onePix );
}
else {
2007-05-11 12:01:13 +00:00
if ( i != 0 || ( i == 0 && currentHand -> getPlayerArray ()[ 0 ] -> getMyAction () != 1 ) ) {
2007-03-29 22:58:04 +00:00
//paint action pixmap
2007-05-11 12:01:13 +00:00
actionLabelArray [ i ] -> setPixmap ( QPixmap ( ":/actions/resources/graphics/actions/action_" + actionArray [ currentHand -> getPlayerArray ()[ i ] -> getMyAction ()] + ".png" ));
2007-03-29 22:58:04 +00:00
}
2007-05-11 12:01:13 +00:00
// actionLabelArray[i]->setStyleSheet("QLabel { background-image: url(:/actions/resources/graphics/actions/action_"+actionArray[currentHand->getPlayerArray()[i]->getMyAction()]+".png");
2007-03-29 22:58:04 +00:00
}
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ i ] -> getMyAction () == 1 ) {
2007-03-29 22:58:04 +00:00
// groupBoxArray[i]->setDisabled(TRUE);
if ( i != 0 ) {
holeCardsArray [ i ][ 0 ] -> setPixmap ( onePix , FALSE );
holeCardsArray [ i ][ 1 ] -> setPixmap ( onePix , FALSE );
}
}
}
}
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 ( ":/actions/resources/graphics/actions/action_" + actionArray [ playerAction ] + ".png" ));
2007-03-27 21:36:56 +00:00
}
2007-03-29 22:58:04 +00:00
if ( playerAction == 1 ) {
// groupBoxArray[i]->setDisabled(TRUE);
2007-03-27 21:36:56 +00:00
2007-03-29 22:58:04 +00:00
if ( playerID != 0 ) {
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 ;
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
2007-01-13 02:40:33 +00:00
2007-05-11 12:01:13 +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 ) + " $" );
2007-03-27 16:02:23 +00:00
cashTopLabelArray [ i ] -> setText ( "<b>Cash:</b>" );
2007-01-13 02:40:33 +00:00
} else {
cashLabelArray [ i ] -> setText ( "" );
cashTopLabelArray [ i ] -> setText ( "" );
}
}
}
2007-03-29 22:58:04 +00:00
void mainWindowImpl :: refreshGroupbox ( int playerID , int status ) {
2007-01-13 02:40:33 +00:00
2007-03-29 22:58:04 +00:00
if ( playerID == - 1 || status == - 1 ) {
2007-01-13 02:40:33 +00:00
2007-03-29 22:58:04 +00:00
int i , j ;
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-03-29 22:58:04 +00:00
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ i ] -> getMyTurn ()) {
2007-03-29 22:58:04 +00:00
//Groupbox glow wenn der Spiele dran ist.
2007-03-28 10:21:51 +00:00
if ( i == 0 ) {
2007-03-29 22:58:04 +00:00
groupBoxArray [ 0 ] -> setStyleSheet ( "QGroupBox { background-image: url(:/guiv2/resources/guiv2/playerBoxActiveGlow.png) }" );
2007-03-28 10:21:51 +00:00
}
else {
2007-03-29 22:58:04 +00:00
groupBoxArray [ i ] -> setStyleSheet ( "QGroupBox { background-image: url(:/guiv2/resources/guiv2/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.
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ i ] -> getMyActiveStatus ()) {
2007-03-29 22:58:04 +00:00
if ( i == 0 ) {
groupBoxArray [ 0 ] -> setStyleSheet ( "QGroupBox { background-image: url(:/guiv2/resources/guiv2/playerBoxInactiveGlow.png) }" );
//show buttons
for ( j = 0 ; j < 3 ; j ++ ) {
userWidgetsArray [ j ] -> show ();
}
}
else {
groupBoxArray [ i ] -> setStyleSheet ( "QGroupBox { background-image: url(:/guiv2/resources/guiv2/opponentBoxInactiveGlow.png) }" );
}
}
//Groupbox verdunkeln wenn der Spiele inactive ist.
2007-03-28 10:21:51 +00:00
else {
2007-03-29 22:58:04 +00:00
if ( i == 0 ) {
groupBoxArray [ 0 ] -> setStyleSheet ( "QGroupBox { background-image: url(:/guiv2/resources/guiv2/playerBoxInactiveGlow.png) }" );
//hide buttons
for ( j = 0 ; j < 4 ; j ++ ) {
userWidgetsArray [ j ] -> hide ();
}
}
else {
groupBoxArray [ i ] -> setStyleSheet ( "QGroupBox { background-image: url(:/guiv2/resources/guiv2/opponentBoxInactiveGlow.png) }" );
}
2007-03-28 10:21:51 +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 { background-image: url(:/guiv2/resources/guiv2/playerBoxInactiveGlow.png) }" );
}
else {
groupBoxArray [ playerID ] -> setStyleSheet ( "QGroupBox { background-image: url(:/guiv2/resources/guiv2/opponentBoxInactiveGlow.png) }" );
}
}
break ;
//active but fold
case 1 : {
if ( ! playerID ) {
groupBoxArray [ playerID ] -> setStyleSheet ( "QGroupBox { background-image: url(:/guiv2/resources/guiv2/playerBoxInactiveGlow.png) }" );
}
else {
groupBoxArray [ playerID ] -> setStyleSheet ( "QGroupBox { background-image: url(:/guiv2/resources/guiv2/opponentBoxInactiveGlow.png) }" );
}
}
break ;
//active in action
case 2 : {
if ( ! playerID ) {
groupBoxArray [ playerID ] -> setStyleSheet ( "QGroupBox { background-image: url(:/guiv2/resources/guiv2/playerBoxActiveGlow.png) }" );
}
else {
groupBoxArray [ playerID ] -> setStyleSheet ( "QGroupBox { background-image: url(:/guiv2/resources/guiv2/opponentBoxActiveGlow.png) }" );
}
}
break ;
default : {}
}
}
2007-01-13 02:40:33 +00:00
}
2007-01-13 14:27:56 +00:00
void mainWindowImpl :: highlightRoundLabel ( string tempround ) {
2007-04-03 10:55:16 +00:00
QString round ( QString :: fromUtf8 ( tempround . c_str ()));
2007-01-13 02:40:33 +00:00
// für PostRiverRun (alte Runden stehen lassen)
if ( round != "" ) {
2007-03-26 00:12:35 +00:00
// QPalette tempPalette = frame_handLabel->palette();
// tempPalette.setColor(QPalette::Window, highlight);
// frame_handLabel->setPalette(tempPalette);
2007-01-13 02:40:33 +00:00
2007-01-17 00:39:20 +00:00
textLabel_handLabel -> setText ( round );
2007-05-11 12:01:13 +00:00
textLabel_handNumber -> setText ( QString :: number ( mySession -> getCurrentGame () -> getCurrentHand () -> getMyID (), 10 ));
textLabel_gameNumber -> setText ( QString :: number ( mySession -> getCurrentGame () -> getMyGameID (), 10 ));
2007-01-13 02:40:33 +00:00
}
}
void mainWindowImpl :: refreshAll () {
refreshSet ();
refreshButton ();
refreshAction ();
refreshCash ();
refreshGroupbox ();
2007-03-27 16:02:23 +00:00
refreshPlayerName ();
refreshPlayerAvatar ();
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl :: refreshChangePlayer () {
2007-03-29 22:58:04 +00:00
refreshSet ();
refreshAction ();
refreshCash ();
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl :: refreshPot () {
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
2007-01-13 02:40:33 +00:00
2007-05-11 12:01:13 +00:00
textLabel_Sets -> setText ( "<span style='font-weight:bold'>" + QString :: number ( currentHand -> getBoard () -> getSets (), 10 ) + " $</span>" );
textLabel_Pot -> setText ( "<span style='font-weight:bold'>" + QString :: number ( currentHand -> getBoard () -> getPot (), 10 ) + " $</span>" );
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl :: dealHoleCards () {
2007-03-03 00:11:26 +00:00
QPixmap onePix ( ":/graphics/resources/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 ;
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
2007-04-17 07:28:32 +00:00
for ( i = 1 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ i ] -> getMyCards ( tempCardsIntArray );
2007-01-13 02:40:33 +00:00
for ( j = 0 ; j < 2 ; j ++ ) {
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ i ] -> getMyActiveStatus ()) {
2007-01-13 02:40:33 +00:00
if ( debugMode ) {
2007-03-03 00:11:26 +00:00
tempCardsPixmapArray [ j ]. load ( ":/cards/resources/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
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ 0 ] -> getMyCards ( tempCardsIntArray );
2007-01-13 02:40:33 +00:00
for ( i = 0 ; i < 2 ; i ++ ) {
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ 0 ] -> getMyActiveStatus ()) {
2007-01-13 02:40:33 +00:00
2007-03-03 00:11:26 +00:00
tempCardsPixmapArray [ i ]. load ( ":/cards/resources/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?;
2007-03-29 22:58:04 +00:00
// refreshGroupbox();
2007-01-13 02:40:33 +00:00
}
2007-01-31 01:17:13 +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 ;
2007-05-11 12:01:13 +00:00
mySession -> getCurrentGame () -> getCurrentHand () -> getBoard () -> getMyCards ( tempBoardCardsArray );
2007-03-03 00:11:26 +00:00
tempCardsPixmap . load ( ":/cards/resources/graphics/cards/" + QString :: number ( tempBoardCardsArray [ 0 ], 10 ) + ".png" );
2007-01-13 02:40:33 +00:00
QPixmap card ( tempCardsPixmap );
2007-01-31 01:17:13 +00:00
//Config? mit oder ohne Eye-Candy?
2007-02-03 22:47:16 +00:00
if ( myConfig -> readConfigInt ( "ShowFlipCardsAnimation" )) {
2007-01-31 01:17:13 +00:00
//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 ;
2007-05-11 12:01:13 +00:00
mySession -> getCurrentGame () -> getCurrentHand () -> getBoard () -> getMyCards ( tempBoardCardsArray );
2007-03-03 00:11:26 +00:00
tempCardsPixmap . load ( ":/cards/resources/graphics/cards/" + QString :: number ( tempBoardCardsArray [ 1 ], 10 ) + ".png" );
2007-01-13 02:40:33 +00:00
QPixmap card ( tempCardsPixmap );
2007-01-31 01:17:13 +00:00
//Config? mit oder ohne Eye-Candy?
2007-02-03 22:47:16 +00:00
if ( myConfig -> readConfigInt ( "ShowFlipCardsAnimation" )) {
2007-01-31 01:17:13 +00:00
//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 ;
2007-05-11 12:01:13 +00:00
mySession -> getCurrentGame () -> getCurrentHand () -> getBoard () -> getMyCards ( tempBoardCardsArray );
2007-03-03 00:11:26 +00:00
tempCardsPixmap . load ( ":/cards/resources/graphics/cards/" + QString :: number ( tempBoardCardsArray [ 2 ], 10 ) + ".png" );
2007-01-13 02:40:33 +00:00
QPixmap card ( tempCardsPixmap );
2007-01-31 01:17:13 +00:00
//Config? mit oder ohne Eye-Candy?
2007-02-03 22:47:16 +00:00
if ( myConfig -> readConfigInt ( "ShowFlipCardsAnimation" )) {
2007-01-31 01:17:13 +00:00
//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
myLog -> logDealBoardCardsMsg ( 1 , tempBoardCardsArray [ 0 ], tempBoardCardsArray [ 1 ], tempBoardCardsArray [ 2 ]);
2007-01-13 02:40:33 +00:00
// stable
// wenn alle All In
2007-05-11 12:01:13 +00:00
if ( mySession -> getCurrentGame () -> getCurrentHand () -> getAllInCondition ()) { dealFlopCards6Timer -> start ( AllInDealCardsSpeed ); }
2007-01-13 02:40:33 +00:00
// sonst normale Variante
2007-01-31 01:17:13 +00:00
else { dealFlopCards6Timer -> start ( postDealCardsSpeed );}
2007-01-13 02:40:33 +00:00
}
2007-01-31 01:17:13 +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 ;
2007-05-11 12:01:13 +00:00
mySession -> getCurrentGame () -> getCurrentHand () -> getBoard () -> getMyCards ( tempBoardCardsArray );
2007-03-03 00:11:26 +00:00
tempCardsPixmap . load ( ":/cards/resources/graphics/cards/" + QString :: number ( tempBoardCardsArray [ 3 ], 10 ) + ".png" );
2007-01-13 02:40:33 +00:00
QPixmap card ( tempCardsPixmap );
2007-01-31 01:17:13 +00:00
//Config? mit oder ohne Eye-Candy?
2007-02-03 22:47:16 +00:00
if ( myConfig -> readConfigInt ( "ShowFlipCardsAnimation" )) {
2007-01-31 01:17:13 +00:00
//mit Eye-Candy
boardCardsArray [ 3 ] -> startFlipCards ( guiGameSpeed , card , flipside );
}
else {
//ohne Eye-Candy
boardCardsArray [ 3 ] -> setPixmap ( card , FALSE );
}
2007-02-13 02:00:11 +00:00
myLog -> logDealBoardCardsMsg ( 2 , tempBoardCardsArray [ 0 ], tempBoardCardsArray [ 1 ], tempBoardCardsArray [ 2 ], tempBoardCardsArray [ 3 ]);
2007-01-13 02:40:33 +00:00
// stable
// wenn alle All In
2007-05-11 12:01:13 +00:00
if ( mySession -> getCurrentGame () -> getCurrentHand () -> getAllInCondition ()) { dealTurnCards2Timer -> start ( AllInDealCardsSpeed );
2007-01-13 02:40:33 +00:00
}
// sonst normale Variante
2007-01-31 01:17:13 +00:00
else { dealTurnCards2Timer -> start ( postDealCardsSpeed ); }
2007-01-13 02:40:33 +00:00
}
2007-01-31 01:17:13 +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 ;
2007-05-11 12:01:13 +00:00
mySession -> getCurrentGame () -> getCurrentHand () -> getBoard () -> getMyCards ( tempBoardCardsArray );
2007-03-03 00:11:26 +00:00
tempCardsPixmap . load ( ":/cards/resources/graphics/cards/" + QString :: number ( tempBoardCardsArray [ 4 ], 10 ) + ".png" );
2007-01-13 02:40:33 +00:00
QPixmap card ( tempCardsPixmap );
2007-01-31 01:17:13 +00:00
//Config? mit oder ohne Eye-Candy?
2007-02-03 22:47:16 +00:00
if ( myConfig -> readConfigInt ( "ShowFlipCardsAnimation" )) {
2007-01-31 01:17:13 +00:00
//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
2007-02-13 02:00:11 +00:00
myLog -> logDealBoardCardsMsg ( 3 , tempBoardCardsArray [ 0 ], tempBoardCardsArray [ 1 ], tempBoardCardsArray [ 2 ], tempBoardCardsArray [ 3 ], tempBoardCardsArray [ 4 ]);
2007-01-13 02:40:33 +00:00
// stable
// wenn alle All In
2007-05-11 12:01:13 +00:00
if ( mySession -> getCurrentGame () -> getCurrentHand () -> getAllInCondition ()) { dealRiverCards2Timer -> start ( AllInDealCardsSpeed ); }
2007-01-13 02:40:33 +00:00
// sonst normale Variante
else {
2007-01-31 01:17:13 +00:00
dealRiverCards2Timer -> start ( postDealCardsSpeed );
2007-01-13 02:40:33 +00:00
}
}
void mainWindowImpl :: meInAction () {
2007-03-31 00:04:36 +00:00
if ( myConfig -> readConfigInt ( "ShowStatusbarMessages" )) {
statusBar () -> showMessage ( tr ( "F1 - Fold/All-In | F2 - Check/Call | F3 - Bet/Raise" ), 15000 );
}
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
2007-03-31 00:04:36 +00:00
2007-05-11 12:01:13 +00:00
switch ( currentHand -> getActualRound ()) {
2007-01-13 02:40:33 +00:00
case 0 : {
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ 0 ] -> getMyCash () + currentHand -> getPlayerArray ()[ 0 ] -> getMySet () > currentHand -> getPreflop () -> getHighestSet ()) { pushButton_BetRaise -> setText ( "Raise" ); }
2007-01-13 02:40:33 +00:00
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ 0 ] -> getMySet () == currentHand -> getPreflop () -> getHighestSet () && currentHand -> getPlayerArray ()[ 0 ] -> getMyButton () == 3 ) { pushButton_CallCheckSet -> setText ( "Check" ); }
2007-03-28 10:21:51 +00:00
else { pushButton_CallCheckSet -> setText ( "Call" ); }
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-05-11 12:01:13 +00:00
// cout << "highestSet in meInAction " << currentHand->getFlop()->getHighestSet() << endl;
if ( currentHand -> getFlop () -> 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
}
2007-05-11 12:01:13 +00:00
if ( currentHand -> getFlop () -> getHighestSet () > 0 && currentHand -> getFlop () -> getHighestSet () > currentHand -> getPlayerArray ()[ 0 ] -> getMySet ()) {
2007-03-28 10:21:51 +00:00
pushButton_CallCheckSet -> setText ( "Call" );
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ 0 ] -> getMyCash () + currentHand -> getPlayerArray ()[ 0 ] -> getMySet () > currentHand -> getPreflop () -> 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-05-11 12:01:13 +00:00
// cout << "highestSet in meInAction " << currentHand->getFlop()->getHighestSet() << endl;
if ( currentHand -> getTurn () -> 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
}
2007-05-11 12:01:13 +00:00
if ( currentHand -> getTurn () -> getHighestSet () > 0 && currentHand -> getTurn () -> getHighestSet () > currentHand -> getPlayerArray ()[ 0 ] -> getMySet ()) {
2007-03-28 10:21:51 +00:00
pushButton_CallCheckSet -> setText ( "Call" );
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ 0 ] -> getMyCash () + currentHand -> getPlayerArray ()[ 0 ] -> getMySet () > currentHand -> getPreflop () -> 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-05-11 12:01:13 +00:00
// cout << "highestSet in meInAction " << currentHand->getFlop()->getHighestSet() << endl;
if ( currentHand -> getRiver () -> 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
}
2007-05-11 12:01:13 +00:00
if ( currentHand -> getRiver () -> getHighestSet () > 0 && currentHand -> getRiver () -> getHighestSet () > currentHand -> getPlayerArray ()[ 0 ] -> getMySet ()) {
2007-03-28 10:21:51 +00:00
pushButton_CallCheckSet -> setText ( "Call" );
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ 0 ] -> getMyCash () + currentHand -> getPlayerArray ()[ 0 ] -> getMySet () > currentHand -> getPreflop () -> getHighestSet ()) { pushButton_BetRaise -> setText ( "Raise" ); }
2007-01-13 02:40:33 +00:00
}
}
break ;
default : {}
}
}
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 );
spinBox_set -> setValue ( 0 );
spinBox_set -> hide ();
2007-03-28 10:21:51 +00:00
pushButton_BetRaise -> show ();
pushButton_BetRaise -> setText ( "" );
pushButton_CallCheckSet -> setText ( "" );
pushButton_FoldAllin -> setText ( "" );
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 (); }
2007-03-29 22:58:04 +00:00
if ( pushButton_BetRaise -> text () == "Bet" ) { myBet (); }
2007-03-28 10:21:51 +00:00
}
void mainWindowImpl :: myFoldAllin () {
if ( pushButton_FoldAllin -> text () == "Fold" ) { myFold (); }
2007-03-29 22:58:04 +00:00
if ( pushButton_FoldAllin -> text () == "All-In" ) { myAllIn (); }
2007-03-28 10:21:51 +00:00
}
void mainWindowImpl :: myCallCheckSet () {
if ( pushButton_CallCheckSet -> text () == "Call" ) { myCall (); }
if ( pushButton_CallCheckSet -> text () == "Check" ) { myCheck (); }
if ( pushButton_CallCheckSet -> text () == "Set" ) { mySet (); }
}
2007-01-13 02:40:33 +00:00
void mainWindowImpl :: myFold (){
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
currentHand -> getPlayerArray ()[ 0 ] -> setMyAction ( 1 );
currentHand -> getPlayerArray ()[ 0 ] -> setMyTurn ( 0 );
2007-01-13 02:40:33 +00:00
2007-01-14 19:58:40 +00:00
//Action in LogWindow
2007-05-11 12:01:13 +00:00
myLog -> logPlayerActionMsg ( currentHand -> getPlayerArray ()[ 0 ] -> getMyName (), currentHand -> getPlayerArray ()[ 0 ] -> getMyAction (), currentHand -> getPlayerArray ()[ 0 ] -> getMySet ());
2007-01-14 19:58:40 +00:00
2007-03-29 22:58:04 +00:00
holeCardsArray [ 0 ][ 0 ] -> startFadeOut ( 10 );
holeCardsArray [ 0 ][ 1 ] -> startFadeOut ( 10 );
2007-01-13 02:40:33 +00:00
disableMyButtons ();
2007-03-29 22:58:04 +00:00
//set that i was the last active player. need this for unhighlighting groupbox
2007-05-11 12:01:13 +00:00
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
nextPlayerAnimation ();
}
void mainWindowImpl :: myCheck () {
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
currentHand -> getPlayerArray ()[ 0 ] -> setMyAction ( 2 );
currentHand -> getPlayerArray ()[ 0 ] -> setMyTurn ( 0 );
2007-01-13 02:40:33 +00:00
2007-01-14 19:58:40 +00:00
//Action in LogWindow
2007-05-11 12:01:13 +00:00
myLog -> logPlayerActionMsg ( currentHand -> getPlayerArray ()[ 0 ] -> getMyName (), currentHand -> getPlayerArray ()[ 0 ] -> getMyAction (), currentHand -> 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-03-29 22:58:04 +00:00
//set that i was the last active player. need this for unhighlighting groupbox
2007-05-11 12:01:13 +00:00
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
nextPlayerAnimation ();
}
2007-01-28 14:48:18 +00:00
2007-01-13 02:40:33 +00:00
void mainWindowImpl :: myCall (){
int tempHighestSet = 0 ;
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
switch ( currentHand -> getActualRound ()) {
2007-01-13 02:40:33 +00:00
2007-05-11 12:01:13 +00:00
case 0 : { tempHighestSet = currentHand -> getPreflop () -> getHighestSet ();}
2007-01-13 02:40:33 +00:00
break ;
2007-05-11 12:01:13 +00:00
case 1 : { tempHighestSet = currentHand -> getFlop () -> getHighestSet ();}
2007-01-13 02:40:33 +00:00
break ;
2007-05-11 12:01:13 +00:00
case 2 : { tempHighestSet = currentHand -> getTurn () -> getHighestSet ();}
2007-01-13 02:40:33 +00:00
break ;
2007-05-11 12:01:13 +00:00
case 3 : { tempHighestSet = currentHand -> getRiver () -> getHighestSet ();}
2007-01-13 02:40:33 +00:00
break ;
default : {}
}
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ 0 ] -> getMyCash () + currentHand -> getPlayerArray ()[ 0 ] -> getMySet () <= tempHighestSet ) {
2007-01-13 02:40:33 +00:00
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ 0 ] -> setMyAction ( 6 );
currentHand -> getPlayerArray ()[ 0 ] -> setMySet ( currentHand -> getPlayerArray ()[ 0 ] -> getMyCash ());
currentHand -> getPlayerArray ()[ 0 ] -> setMyCash ( 0 );
2007-01-13 02:40:33 +00:00
}
else {
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ 0 ] -> setMySet ( tempHighestSet - currentHand -> getPlayerArray ()[ 0 ] -> getMySet ());
currentHand -> getPlayerArray ()[ 0 ] -> setMyAction ( 3 );
2007-01-13 02:40:33 +00:00
}
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ 0 ] -> setMyTurn ( 0 );
2007-01-13 02:40:33 +00:00
2007-05-11 12:01:13 +00:00
currentHand -> getBoard () -> collectSets ();
2007-01-13 02:40:33 +00:00
refreshPot ();
2007-01-14 19:58:40 +00:00
//Action in LogWindow
2007-05-11 12:01:13 +00:00
myLog -> logPlayerActionMsg ( currentHand -> getPlayerArray ()[ 0 ] -> getMyName (), currentHand -> getPlayerArray ()[ 0 ] -> getMyAction (), currentHand -> getPlayerArray ()[ 0 ] -> getMySet ());
2007-01-14 19:58:40 +00:00
2007-01-13 02:40:33 +00:00
disableMyButtons ();
2007-03-29 22:58:04 +00:00
//set that i was the last active player. need this for unhighlighting groupbox
2007-05-11 12:01:13 +00:00
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
nextPlayerAnimation ();
}
void mainWindowImpl :: myBet (){
2007-03-28 10:21:51 +00:00
pushButton_BetRaise -> hide ();
pushButton_CallCheckSet -> setText ( "Set" );
pushButton_FoldAllin -> setText ( "All-In" );
spinBox_set -> show ();
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
if ( currentHand -> getActualRound () <= 2 ) { spinBox_set -> setMinimum ( currentHand -> getSmallBlind () * 2 ); }
else { spinBox_set -> setMinimum ( currentHand -> getSmallBlind () * 4 ); }
2007-01-13 02:40:33 +00:00
2007-05-11 12:01:13 +00:00
spinBox_set -> setMaximum ( currentHand -> getPlayerArray ()[ 0 ] -> getMyCash ());
2007-01-13 02:40:33 +00:00
spinBox_set -> setValue ( spinBox_set -> minimum ());
spinBox_set -> setFocus ();
spinBox_set -> selectAll ();
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ 0 ] -> setMyAction ( 4 );
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl :: myRaise (){
2007-03-28 10:21:51 +00:00
pushButton_BetRaise -> hide ();
pushButton_CallCheckSet -> setText ( "Set" );
pushButton_FoldAllin -> setText ( "All-In" );
spinBox_set -> show ();
2007-01-13 02:40:33 +00:00
int tempHighestSet = 0 ;
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
switch ( currentHand -> getActualRound ()) {
2007-01-13 02:40:33 +00:00
2007-05-11 12:01:13 +00:00
case 0 : { tempHighestSet = currentHand -> getPreflop () -> getHighestSet ();}
2007-01-13 02:40:33 +00:00
break ;
2007-05-11 12:01:13 +00:00
case 1 : { tempHighestSet = currentHand -> getFlop () -> getHighestSet ();}
2007-01-13 02:40:33 +00:00
break ;
2007-05-11 12:01:13 +00:00
case 2 : { tempHighestSet = currentHand -> getTurn () -> getHighestSet ();}
2007-01-13 02:40:33 +00:00
break ;
2007-05-11 12:01:13 +00:00
case 3 : { tempHighestSet = currentHand -> getRiver () -> getHighestSet ();}
2007-01-13 02:40:33 +00:00
break ;
default : {}
}
2007-05-11 12:01:13 +00:00
spinBox_set -> setMinimum ( tempHighestSet * 2 - currentHand -> getPlayerArray ()[ 0 ] -> getMySet ());
spinBox_set -> setMaximum ( currentHand -> getPlayerArray ()[ 0 ] -> getMyCash ());
2007-01-13 02:40:33 +00:00
spinBox_set -> setValue ( spinBox_set -> minimum ());
spinBox_set -> setFocus ();
spinBox_set -> selectAll ();
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ 0 ] -> setMyAction ( 5 );
2007-01-13 02:40:33 +00:00
}
void mainWindowImpl :: mySet (){
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
int tempCash = currentHand -> getPlayerArray ()[ 0 ] -> getMyCash ();
2007-01-13 02:40:33 +00:00
// cout << "Set-Value " << spinBox_set->value() << endl;
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ 0 ] -> setMySet ( spinBox_set -> value ());
// cout << "MySET " << currentHand->getPlayerArray()[0]->getMySet() << endl;
2007-01-13 02:40:33 +00:00
if ( spinBox_set -> value () >= tempCash ) {
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ 0 ] -> setMyAction ( 6 );
currentHand -> getPlayerArray ()[ 0 ] -> setMySet ( currentHand -> getPlayerArray ()[ 0 ] -> getMyCash ());
currentHand -> getPlayerArray ()[ 0 ] -> setMyCash ( 0 );
2007-01-13 02:40:33 +00:00
}
2007-05-11 12:01:13 +00:00
switch ( currentHand -> getActualRound ()) {
2007-01-13 02:40:33 +00:00
2007-05-11 12:01:13 +00:00
case 0 : { currentHand -> getPreflop () -> setHighestSet ( currentHand -> getPlayerArray ()[ 0 ] -> getMySet ());}
2007-01-13 02:40:33 +00:00
break ;
2007-05-11 12:01:13 +00:00
case 1 : { currentHand -> getFlop () -> setHighestSet ( currentHand -> getPlayerArray ()[ 0 ] -> getMySet ());}
2007-01-13 02:40:33 +00:00
break ;
2007-05-11 12:01:13 +00:00
case 2 : { currentHand -> getTurn () -> setHighestSet ( currentHand -> getPlayerArray ()[ 0 ] -> getMySet ());}
2007-01-13 02:40:33 +00:00
break ;
2007-05-11 12:01:13 +00:00
case 3 : { currentHand -> getRiver () -> setHighestSet ( currentHand -> getPlayerArray ()[ 0 ] -> getMySet ());}
2007-01-13 02:40:33 +00:00
break ;
default : {}
}
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ 0 ] -> setMyTurn ( 0 );
2007-01-13 02:40:33 +00:00
2007-05-11 12:01:13 +00:00
currentHand -> getBoard () -> collectSets ();
2007-01-13 02:40:33 +00:00
refreshPot ();
2007-01-14 19:58:40 +00:00
//Action in LogWindow
2007-05-11 12:01:13 +00:00
myLog -> logPlayerActionMsg ( currentHand -> getPlayerArray ()[ 0 ] -> getMyName (), currentHand -> getPlayerArray ()[ 0 ] -> getMyAction (), currentHand -> getPlayerArray ()[ 0 ] -> getMySet ());
2007-01-14 19:58:40 +00:00
2007-01-13 02:40:33 +00:00
disableMyButtons ();
2007-03-31 00:04:36 +00:00
statusBar () -> clearMessage ();
2007-03-29 22:58:04 +00:00
//set that i was the last active player. need this for unhighlighting groupbox
2007-05-11 12:01:13 +00:00
currentHand -> setLastPlayersTurn ( 0 );
2007-03-29 22:58:04 +00:00
2007-01-13 02:40:33 +00:00
//Spiel läuft weiter
nextPlayerAnimation ();
}
void mainWindowImpl :: myAllIn (){
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
currentHand -> getPlayerArray ()[ 0 ] -> setMyAction ( 6 );
currentHand -> getPlayerArray ()[ 0 ] -> setMySet ( currentHand -> getPlayerArray ()[ 0 ] -> getMyCash ());
currentHand -> getPlayerArray ()[ 0 ] -> setMyCash ( 0 );
2007-01-13 02:40:33 +00:00
2007-05-11 12:01:13 +00:00
switch ( currentHand -> getActualRound ()) {
2007-01-13 02:40:33 +00:00
2007-05-11 12:01:13 +00:00
case 0 : { if ( currentHand -> getPlayerArray ()[ 0 ] -> getMySet () > currentHand -> getPreflop () -> getHighestSet ()) currentHand -> getPreflop () -> setHighestSet ( currentHand -> getPlayerArray ()[ 0 ] -> getMySet ());}
2007-01-13 02:40:33 +00:00
break ;
2007-05-11 12:01:13 +00:00
case 1 : { if ( currentHand -> getPlayerArray ()[ 0 ] -> getMySet () > currentHand -> getFlop () -> getHighestSet ()) currentHand -> getFlop () -> setHighestSet ( currentHand -> getPlayerArray ()[ 0 ] -> getMySet ());}
2007-01-13 02:40:33 +00:00
break ;
2007-05-11 12:01:13 +00:00
case 2 : { if ( currentHand -> getPlayerArray ()[ 0 ] -> getMySet () > currentHand -> getTurn () -> getHighestSet ()) currentHand -> getTurn () -> setHighestSet ( currentHand -> getPlayerArray ()[ 0 ] -> getMySet ());}
2007-01-13 02:40:33 +00:00
break ;
2007-05-11 12:01:13 +00:00
case 3 : { if ( currentHand -> getPlayerArray ()[ 0 ] -> getMySet () > currentHand -> getRiver () -> getHighestSet ()) currentHand -> getRiver () -> setHighestSet ( currentHand -> getPlayerArray ()[ 0 ] -> getMySet ());}
2007-01-13 02:40:33 +00:00
break ;
default : {}
}
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ 0 ] -> setMyTurn ( 0 );
2007-01-13 02:40:33 +00:00
2007-05-11 12:01:13 +00:00
currentHand -> getBoard () -> collectSets ();
2007-01-13 02:40:33 +00:00
refreshPot ();
2007-01-14 19:58:40 +00:00
//Action in LogWindow
2007-05-11 12:01:13 +00:00
myLog -> logPlayerActionMsg ( currentHand -> getPlayerArray ()[ 0 ] -> getMyName (), currentHand -> getPlayerArray ()[ 0 ] -> getMyAction (), currentHand -> getPlayerArray ()[ 0 ] -> getMySet ());
2007-01-13 02:40:33 +00:00
2007-01-14 19:58:40 +00:00
disableMyButtons ();
2007-03-31 00:04:36 +00:00
statusBar () -> clearMessage ();
2007-03-29 22:58:04 +00:00
//set that i was the last active player. need this for unhighlighting groupbox
2007-05-11 12:01:13 +00:00
currentHand -> setLastPlayersTurn ( 0 );
2007-03-29 22:58:04 +00:00
2007-01-13 02:40:33 +00:00
//Spiel läuft weiter
nextPlayerAnimation ();
}
void mainWindowImpl :: nextPlayerAnimation () {
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
2007-03-29 22:58:04 +00:00
//refresh Change Player
refreshSet ();
2007-05-11 12:01:13 +00:00
refreshAction ( currentHand -> getLastPlayersTurn (), currentHand -> getPlayerArray ()[ currentHand -> getLastPlayersTurn ()] -> getMyAction ());
2007-03-29 22:58:04 +00:00
refreshCash ();
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-05-11 12:01:13 +00:00
void mainWindowImpl :: preflopAnimation1Action () { mySession -> getCurrentGame () -> getCurrentHand () -> getPreflop () -> preflopRun (); }
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
void mainWindowImpl :: preflopAnimation2 () { preflopAnimation2Timer -> start ( preflopNextPlayerSpeed ); }
2007-05-11 12:01:13 +00:00
void mainWindowImpl :: preflopAnimation2Action () { mySession -> getCurrentGame () -> getCurrentHand () -> getPreflop () -> nextPlayer2 (); }
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
void mainWindowImpl :: flopAnimation1 () { flopAnimation1Timer -> start ( nextPlayerSpeed2 ); }
2007-05-11 12:01:13 +00:00
void mainWindowImpl :: flopAnimation1Action () { mySession -> getCurrentGame () -> getCurrentHand () -> getFlop () -> flopRun (); }
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
void mainWindowImpl :: flopAnimation2 () { flopAnimation2Timer -> start ( nextPlayerSpeed3 ); }
2007-05-11 12:01:13 +00:00
void mainWindowImpl :: flopAnimation2Action () { mySession -> getCurrentGame () -> getCurrentHand () -> getFlop () -> nextPlayer2 (); }
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
void mainWindowImpl :: turnAnimation1 () { turnAnimation1Timer -> start ( nextPlayerSpeed2 ); }
2007-05-11 12:01:13 +00:00
void mainWindowImpl :: turnAnimation1Action () { mySession -> getCurrentGame () -> getCurrentHand () -> getTurn () -> turnRun (); }
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
void mainWindowImpl :: turnAnimation2 () { turnAnimation2Timer -> start ( nextPlayerSpeed3 ); }
2007-05-11 12:01:13 +00:00
void mainWindowImpl :: turnAnimation2Action () { mySession -> getCurrentGame () -> getCurrentHand () -> getTurn () -> nextPlayer2 (); }
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
void mainWindowImpl :: riverAnimation1 () { riverAnimation1Timer -> start ( nextPlayerSpeed2 ); }
2007-05-11 12:01:13 +00:00
void mainWindowImpl :: riverAnimation1Action () { mySession -> getCurrentGame () -> getCurrentHand () -> getRiver () -> riverRun (); }
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
void mainWindowImpl :: riverAnimation2 () { riverAnimation2Timer -> start ( nextPlayerSpeed3 ); }
2007-05-11 12:01:13 +00:00
void mainWindowImpl :: riverAnimation2Action () { mySession -> getCurrentGame () -> getCurrentHand () -> getRiver () -> nextPlayer2 (); }
2007-01-13 02:40:33 +00:00
2007-01-23 19:20:18 +00:00
void mainWindowImpl :: postRiverAnimation1 () { postRiverAnimation1Timer -> start ( nextPlayerSpeed2 ); }
2007-05-11 12:01:13 +00:00
void mainWindowImpl :: postRiverAnimation1Action () { mySession -> getCurrentGame () -> getCurrentHand () -> getRiver () -> postRiverRun (); }
2007-01-13 02:40:33 +00:00
void mainWindowImpl :: postRiverRunAnimation1 () {
//RoundsLabel mit "River" dunkel machen
2007-03-26 00:12:35 +00:00
// QPalette tempPalette = frame_handLabel->palette();
// tempPalette.setColor(QPalette::Window, active);
// frame_handLabel->setPalette(tempPalette);
2007-01-13 02:40:33 +00:00
//PotLabel aufhellen!
2007-03-26 00:12:35 +00:00
// // tempPalette = frame_Pot->palette();
// tempPalette.setColor(QPalette::Window, highlight);
// frame_Pot->setPalette(tempPalette);
2007-01-13 02:40:33 +00:00
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-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
2007-01-31 01:17:13 +00:00
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 ;
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ i ] -> getMyAction () != 1 && currentHand -> getPlayerArray ()[ i ] -> getMyActiveStatus () == 1 ) activePlayersCounter ++ ;
2007-01-13 02:40:33 +00:00
}
if ( activePlayersCounter != 1 ) {
2007-01-31 01:17:13 +00:00
if ( ! flipHolecardsAllInAlreadyDone ) {
//Config? mit oder ohne Eye-Candy?
2007-02-03 22:47:16 +00:00
if ( myConfig -> readConfigInt ( "ShowFlipCardsAnimation" )) {
2007-01-31 01:17:13 +00:00
// mit Eye-Candy
//TempArrays
int tempCardsIntArray [ 2 ];
int i , j ;
2007-02-13 02:00:11 +00:00
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ i ] -> getMyCards ( tempCardsIntArray );
if ( currentHand -> getPlayerArray ()[ i ] -> getMyActiveStatus () && currentHand -> getPlayerArray ()[ i ] -> getMyAction () != 1 ) {
2007-02-22 21:35:44 +00:00
if ( i ) {
for ( j = 0 ; j < 2 ; j ++ ) {
2007-03-03 00:11:26 +00:00
holeCardsArray [ i ][ j ] -> startFlipCards ( guiGameSpeed , QPixmap ( ":/cards/resources/graphics/cards/" + QString :: number ( tempCardsIntArray [ j ], 10 ) + ".png" ), flipside );
2007-02-22 21:35:44 +00:00
}
}
2007-02-13 02:00:11 +00:00
//Karten umdrehen Loggen
2007-05-11 12:01:13 +00:00
myLog -> logFlipHoleCardsMsg ( currentHand -> getPlayerArray ()[ i ] -> getMyName (), tempCardsIntArray [ 0 ], tempCardsIntArray [ 1 ], currentHand -> getPlayerArray ()[ i ] -> getMyCardsValueInt ());
2007-02-28 20:51:43 +00:00
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ i ] -> setMyCardsFlip ( 1 );
2007-01-31 01:17:13 +00:00
}
2007-02-22 21:35:44 +00:00
}
2007-01-13 02:40:33 +00:00
}
2007-01-31 01:17:13 +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 ;
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ i ] -> getMyCards ( tempCardsIntArray );
if ( currentHand -> getPlayerArray ()[ i ] -> getMyActiveStatus () && currentHand -> getPlayerArray ()[ i ] -> getMyAction () != 1 ) {
2007-02-22 21:35:44 +00:00
if ( i ) {
for ( j = 0 ; j < 2 ; j ++ ) {
2007-03-03 00:11:26 +00:00
tempCardsPixmapArray [ j ]. load ( ":/cards/resources/graphics/cards/" + QString :: number ( tempCardsIntArray [ j ], 10 ) + ".png" );
2007-02-22 21:35:44 +00:00
holeCardsArray [ i ][ j ] -> setPixmap ( tempCardsPixmapArray [ j ], FALSE );
}
}
2007-02-13 02:00:11 +00:00
//Karten umdrehen Loggen
2007-05-11 12:01:13 +00:00
myLog -> logFlipHoleCardsMsg ( currentHand -> getPlayerArray ()[ i ] -> getMyName (), tempCardsIntArray [ 0 ], tempCardsIntArray [ 1 ], currentHand -> getPlayerArray ()[ i ] -> getMyCardsValueInt () );
2007-02-28 20:51:43 +00:00
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ i ] -> setMyCardsFlip ( 1 );
2007-01-31 01:17:13 +00:00
}
}
}
//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 ;
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ i ] -> getMyCards ( tempCardsIntArray );
if ( currentHand -> getPlayerArray ()[ i ] -> getMyActiveStatus () && currentHand -> getPlayerArray ()[ i ] -> getMyAction () != 1 ) {
2007-03-17 14:58:12 +00:00
//Kartenwerte Loggen
2007-05-11 12:01:13 +00:00
myLog -> logFlipHoleCardsMsg ( currentHand -> getPlayerArray ()[ i ] -> getMyName (), tempCardsIntArray [ 0 ], tempCardsIntArray [ 1 ], currentHand -> getPlayerArray ()[ i ] -> getMyCardsValueInt (), "has" );
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 (); }
}
void mainWindowImpl :: postRiverRunAnimation3 () {
int i ;
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
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
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ i ] -> getMyActiveStatus () && currentHand -> getPlayerArray ()[ i ] -> getMyAction () != 1 && currentHand -> getPlayerArray ()[ i ] -> getMyCardsValueInt () == currentHand -> getRiver () -> 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);
2007-03-27 21:36:56 +00:00
actionLabelArray [ i ] -> setPixmap ( QPixmap ( ":/actions/resources/graphics/actions/action_winner.png" ));
2007-01-28 01:28:19 +00:00
//nicht gewonnene Karten ausblenden
2007-05-11 12:01:13 +00:00
if ( currentHand -> getActivePlayersCounter () != 1 && myConfig -> readConfigInt ( "ShowFadeOutCardsAnimation" )) {
2007-01-28 01:28:19 +00:00
2007-01-28 14:48:18 +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 ;
2007-04-30 11:56:31 +00:00
for ( j = 0 ; j < 5 ; j ++ ) {
2007-05-11 12:01:13 +00:00
// cout << (currentHand->getPlayerArray()[i]->getMyBestHandPosition())[j] << endl;
if (( currentHand -> getPlayerArray ()[ i ] -> getMyBestHandPosition ())[ j ] == 0 ) { index0 = FALSE ; }
2007-01-28 14:48:18 +00:00
}
if ( index0 ) { holeCardsArray [ i ][ 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 ++ ) {
2007-05-11 12:01:13 +00:00
if (( currentHand -> getPlayerArray ()[ i ] -> getMyBestHandPosition ())[ j ] == 1 ) { index1 = FALSE ; }
2007-01-28 14:48:18 +00:00
}
if ( index1 ) { holeCardsArray [ i ][ 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 ++ ) {
2007-05-11 12:01:13 +00:00
if (( currentHand -> getPlayerArray ()[ i ] -> getMyBestHandPosition ())[ j ] == 2 ) { index2 = FALSE ; }
2007-01-28 14:48:18 +00:00
}
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 ++ ) {
2007-05-11 12:01:13 +00:00
if (( currentHand -> getPlayerArray ()[ i ] -> getMyBestHandPosition ())[ j ] == 3 ) { index3 = FALSE ; }
2007-01-28 14:48:18 +00:00
}
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 ++ ) {
2007-05-11 12:01:13 +00:00
if (( currentHand -> getPlayerArray ()[ i ] -> getMyBestHandPosition ())[ j ] == 4 ) { index4 = FALSE ; }
2007-01-28 14:48:18 +00:00
}
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 ++ ) {
2007-05-11 12:01:13 +00:00
if (( currentHand -> getPlayerArray ()[ i ] -> getMyBestHandPosition ())[ j ] == 5 ) { index5 = FALSE ; }
2007-01-28 14:48:18 +00:00
}
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 ++ ) {
2007-05-11 12:01:13 +00:00
if (( currentHand -> getPlayerArray ()[ i ] -> getMyBestHandPosition ())[ j ] == 6 ) { index6 = FALSE ; }
2007-01-28 14:48:18 +00:00
}
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 ;
2007-05-11 12:01:13 +00:00
int pot = currentHand -> getPlayerArray ()[ i ] -> getMyCash () - cashLabelArray [ i ] -> 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") {
myLog -> logPlayerWinsMsg ( i , pot );
// }
// else {
// myLog->logPlayerWinsMsg(i, pot);
// }
2007-02-02 00:59:51 +00:00
}
else {
2007-05-11 12:01:13 +00:00
if ( currentHand -> getActivePlayersCounter () != 1 && currentHand -> getPlayerArray ()[ i ] -> getMyAction () != 1 && currentHand -> 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-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 ;
2007-05-11 12:01:13 +00:00
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 ) {
2007-03-27 16:02:23 +00:00
label_Pot -> setText ( "" );
2007-01-13 02:40:33 +00:00
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ i ] -> getMyActiveStatus () && currentHand -> getPlayerArray ()[ i ] -> getMyAction () != 1 && currentHand -> getPlayerArray ()[ i ] -> getMyCardsValueInt () == currentHand -> getRiver () -> getHighestCardsValue () ) {
2007-01-13 02:40:33 +00:00
2007-03-27 16:02:23 +00:00
cashTopLabelArray [ i ] -> setText ( "" );
2007-01-13 02:40:33 +00:00
}
}
}
else {
2007-03-27 16:02:23 +00:00
label_Pot -> setText ( "<span style='font-weight:bold'>Pot</span>" );
2007-01-13 02:40:33 +00:00
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ i ] -> getMyActiveStatus () && currentHand -> getPlayerArray ()[ i ] -> getMyAction () != 1 && currentHand -> getPlayerArray ()[ i ] -> getMyCardsValueInt () == currentHand -> getRiver () -> getHighestCardsValue () ) {
2007-01-13 02:40:33 +00:00
2007-03-27 16:02:23 +00:00
cashTopLabelArray [ i ] -> setText ( "<b>Cash:</b>" );
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
}
}
void mainWindowImpl :: postRiverRunAnimation6 () {
int i ;
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
2007-04-03 10:55:16 +00:00
2007-01-13 02:40:33 +00:00
refreshCash ();
refreshPot ();
// wenn nur noch ein Spieler aktive "neues Spiel"-Dialog anzeigen
int playersPositiveCashCounter = 0 ;
2007-05-11 12:01:13 +00:00
for ( i = 0 ; i < mySession -> getCurrentGame () -> getStartQuantityPlayers (); i ++ ) {
// cout << "player 0 cash: " << currentHand->getPlayerArray()[0]->getMyCash()
2007-01-13 02:40:33 +00:00
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ i ] -> getMyCash () > 0 )
2007-04-03 10:55:16 +00:00
playersPositiveCashCounter ++ ;
2007-01-13 02:40:33 +00:00
}
if ( playersPositiveCashCounter == 1 ) {
2007-04-03 10:55:16 +00:00
2007-05-11 12:01:13 +00:00
// for (i=0; i<mySession->getCurrentGame()->getStartQuantityPlayers(); i++) {
// // cout << "player 0 cash: " << currentHand->getPlayerArray()[0]->getMyCash()
// if (currentHand->getPlayerArray()[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
}
2007-01-29 09:11:44 +00:00
void mainWindowImpl :: flipHolecardsAllIn () {
2007-01-31 01:17:13 +00:00
int i ;
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
2007-01-31 01:17:13 +00:00
if ( ! flipHolecardsAllInAlreadyDone ) {
//Aktive Spieler zählen --> wenn nur noch einer nicht-folded dann keine Karten umdrehen
int activePlayersCounter = 0 ;
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-05-11 12:01:13 +00:00
if ( currentHand -> getPlayerArray ()[ i ] -> getMyAction () != 1 && currentHand -> getPlayerArray ()[ i ] -> getMyActiveStatus () == 1 ) activePlayersCounter ++ ;
2007-01-31 01:17:13 +00:00
}
if ( activePlayersCounter != 1 ) {
//Config? mit oder ohne Eye-Candy?
2007-02-03 22:47:16 +00:00
if ( myConfig -> readConfigInt ( "ShowFlipCardsAnimation" )) {
2007-01-31 01:17:13 +00:00
// mit Eye-Candy
//TempArrays
int tempCardsIntArray [ 2 ];
int i , j ;
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ i ] -> getMyCards ( tempCardsIntArray );
if ( currentHand -> getPlayerArray ()[ i ] -> getMyActiveStatus () && currentHand -> getPlayerArray ()[ i ] -> getMyAction () != 1 ) {
2007-02-22 21:35:44 +00:00
if ( i ) {
for ( j = 0 ; j < 2 ; j ++ ) {
2007-03-03 00:11:26 +00:00
holeCardsArray [ i ][ j ] -> startFlipCards ( guiGameSpeed , QPixmap ( ":/cards/resources/graphics/cards/" + QString :: number ( tempCardsIntArray [ j ], 10 ) + ".png" ), flipside );
2007-02-22 21:35:44 +00:00
}
2007-02-13 02:00:11 +00:00
}
//Karten umdrehen Loggen
2007-05-11 12:01:13 +00:00
myLog -> logFlipHoleCardsMsg ( currentHand -> getPlayerArray ()[ i ] -> getMyName (), tempCardsIntArray [ 0 ], tempCardsIntArray [ 1 ]);
2007-02-28 20:51:43 +00:00
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ i ] -> setMyCardsFlip ( 1 );
2007-02-13 02:00:11 +00:00
2007-01-31 01:17:13 +00:00
}
2007-02-22 21:35:44 +00:00
}
2007-01-31 01:17:13 +00:00
}
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 ;
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ i ] -> getMyCards ( temp2CardsIntArray );
if ( currentHand -> getPlayerArray ()[ i ] -> getMyActiveStatus () && currentHand -> getPlayerArray ()[ i ] -> getMyAction () != 1 ) {
2007-02-22 21:35:44 +00:00
if ( i ) {
for ( j = 0 ; j < 2 ; j ++ ) {
2007-03-03 00:11:26 +00:00
tempCardsPixmapArray [ j ]. load ( ":/cards/resources/graphics/cards/" + QString :: number ( temp2CardsIntArray [ j ], 10 ) + ".png" );
2007-02-22 21:35:44 +00:00
holeCardsArray [ i ][ j ] -> setPixmap ( tempCardsPixmapArray [ j ], FALSE );
}
}
2007-02-13 02:00:11 +00:00
//Karten umdrehen Loggen
2007-05-11 12:01:13 +00:00
myLog -> logFlipHoleCardsMsg ( currentHand -> getPlayerArray ()[ i ] -> getMyName (), temp2CardsIntArray [ 0 ], temp2CardsIntArray [ 1 ] );
2007-02-28 20:51:43 +00:00
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ i ] -> setMyCardsFlip ( 1 );
2007-01-31 01:17:13 +00:00
}
}
}
2007-02-13 02:00:11 +00:00
}
}
2007-01-31 01:17:13 +00:00
//Wenn einmal umgedreht dann fertig!!
flipHolecardsAllInAlreadyDone = TRUE ;
2007-01-29 09:11:44 +00:00
}
2007-02-28 20:51:43 +00:00
void mainWindowImpl :: showMyCards () {
//TempArrays
int tempCardsIntArray [ 2 ];
2007-05-11 12:01:13 +00:00
HandInterface * currentHand = mySession -> getCurrentGame () -> getCurrentHand ();
2007-02-28 20:51:43 +00:00
2007-05-11 12:01:13 +00:00
currentHand -> getPlayerArray ()[ 0 ] -> getMyCards ( tempCardsIntArray );
if ( currentHand -> getPlayerArray ()[ 0 ] -> getMyCardsFlip () == 0 && currentHand -> getActualRound () == 4 && currentHand -> getPlayerArray ()[ 0 ] -> getMyActiveStatus () && currentHand -> getPlayerArray ()[ 0 ] -> getMyAction () != 1 ) {
//Karten umdrehen Loggen
myLog -> logFlipHoleCardsMsg ( currentHand -> getPlayerArray ()[ 0 ] -> getMyName (), tempCardsIntArray [ 0 ], tempCardsIntArray [ 1 ], currentHand -> getPlayerArray ()[ 0 ] -> getMyCardsValueInt () );
currentHand -> getPlayerArray ()[ 0 ] -> setMyCardsFlip ( 1 );
2007-02-28 20:51:43 +00:00
}
}
2007-01-13 02:40:33 +00:00
void mainWindowImpl :: startNewHand () {
2007-05-12 22:00:59 +00:00
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
}
2007-05-11 12:01:13 +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 () {
2007-01-31 01:17:13 +00:00
int i , j ;
2007-01-13 02:40:33 +00:00
2007-01-31 01:17:13 +00:00
// GUI bereinigen - Bilder löschen, Animationen unterbrechen
2007-01-13 02:40:33 +00:00
QPixmap onePix ( ":/graphics/cards/1px.png" );
2007-01-31 01:17:13 +00:00
for ( i = 0 ; i < 5 ; i ++ ) {
boardCardsArray [ i ] -> setPixmap ( onePix , FALSE );
boardCardsArray [ i ] -> setFadeOutAction ( FALSE );
}
2007-04-17 07:28:32 +00:00
for ( i = 0 ; i < MAX_NUMBER_OF_PLAYERS ; i ++ ) {
2007-01-31 01:17:13 +00:00
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
2007-05-11 12:01:13 +00:00
if ( mySession -> getCurrentGame () -> getCurrentHand () -> getPlayerArray ()[ 0 ] -> 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 ();
2007-01-31 01:17:13 +00:00
flipHolecardsAllInAlreadyDone = FALSE ;
2007-01-28 14:48:18 +00:00
//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 ();
QPalette tempPalette = pushButton_break -> palette ();
tempPalette . setColor ( QPalette :: Button , QColor ( 40 , 82 , 0 ));
tempPalette . setColor ( QPalette :: ButtonText , QColor ( 240 , 240 , 240 ));
pushButton_break -> setPalette ( tempPalette );
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-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
2007-01-31 01:17:13 +00:00
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)
2007-01-31 01:17:13 +00:00
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
QPalette tempPalette = pushButton_break -> palette ();
tempPalette . setColor ( QPalette :: Button , QColor ( 40 , 82 , 0 ));
tempPalette . setColor ( QPalette :: ButtonText , QColor ( 240 , 240 , 240 ));
pushButton_break -> setPalette ( tempPalette );
2007-05-02 21:51:02 +00:00
QFontMetrics tempMetrics = this -> fontMetrics ();
int width = tempMetrics . width ( tr ( "Stop" ));
pushButton_break -> setMinimumSize ( width + 10 , 20 );
2007-05-02 10:32:19 +00:00
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-01-27 14:19:50 +00:00
StartSplash * mySplash = new StartSplash ( this );
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
2007-03-20 14:05:16 +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 ;
case ERR_SOCK_SELECT_FAILED :
{ QMessageBox :: warning ( this , tr ( "Network Error" ),
tr ( "Internal network error: \" select \" failed." ),
QMessageBox :: Close ); }
break ;
case ERR_SOCK_RECV_FAILED :
{ QMessageBox :: warning ( this , tr ( "Network Error" ),
tr ( "Internal network error: \" recv \" 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_CONN_RESET :
{ QMessageBox :: warning ( this , tr ( "Network Error" ),
tr ( "Connection was closed by server." ),
QMessageBox :: Close ); }
break ;
2007-04-29 18:48:20 +00:00
case ERR_SOCK_CONN_EXISTS :
2007-04-28 13:07:06 +00:00
{ 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 :
2007-04-28 13:07:06 +00:00
{ QMessageBox :: warning ( this , tr ( "Network Error" ),
tr ( "An invalid network packet was received. \n Please 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 :
2007-04-28 13:07:06 +00:00
{ QMessageBox :: warning ( this , tr ( "Network Error" ),
tr ( "Internal state error. \n Please 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 :
2007-04-28 13:07:06 +00:00
{ QMessageBox :: warning ( this , tr ( "Network Error" ),
tr ( "The PokerTH server does not support this version of the game. \n Please update PokerTH." ),
QMessageBox :: Close ); }
break ;
2007-04-29 18:48:20 +00:00
case ERR_NET_SERVER_FULL :
2007-04-28 13:07:06 +00:00
{ 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_GAME_ALREADY_RUNNING :
2007-04-28 13:07:06 +00:00
{ QMessageBox :: warning ( this , tr ( "Network Error" ),
tr ( "Unable to join - the server has already started the game." ),
QMessageBox :: Close ); }
break ;
2007-04-29 18:48:20 +00:00
case ERR_NET_INVALID_PASSWORD :
2007-04-28 13:07:06 +00:00
{ QMessageBox :: warning ( this , tr ( "Network Error" ),
tr ( "Invalid password when joining the game. \n Please reenter the password and try again." ),
QMessageBox :: Close ); }
2007-04-29 18:48:20 +00:00
break ;
case ERR_NET_INVALID_PASSWORD_STR :
2007-04-28 13:07:06 +00:00
{ 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-04-28 13:07:06 +00:00
{ QMessageBox :: warning ( this , tr ( "Network Error" ),
tr ( "Your player name is already used by another player. \n Please choose a different name." ),
QMessageBox :: Close ); }
2007-04-29 18:48:20 +00:00
break ;
case ERR_NET_INVALID_PLAYER_NAME :
2007-04-28 13:07:06 +00:00
{ QMessageBox :: warning ( this , tr ( "Network Error" ),
tr ( "The player name is either too short or too long. Please choose another one." ),
QMessageBox :: Close ); }
2007-04-29 18:48:20 +00:00
break ;
2007-03-21 00:41:29 +00:00
default : { QMessageBox :: warning ( this , tr ( "Network Error" ),
2007-04-28 13:07:06 +00:00
tr ( "An internal error occured." ),
2007-03-21 00:41:29 +00:00
QMessageBox :: Close ); }
}
// close dialogs
myConnectToServerDialog -> reject ();
myWaitingForServerGameDialog -> reject ();
2007-03-20 14:05:16 +00:00
}
2007-04-27 22:55:19 +00:00
void mainWindowImpl :: networkStart ( int numberOfPlayers , int startCash , int smallBlind , int handsBeforeRaise )
2007-04-27 21:35:18 +00:00
{
2007-04-27 22:55:19 +00:00
GameData gameData ;
gameData . numberOfPlayers = numberOfPlayers ;
gameData . startCash = startCash ;
gameData . smallBlind = smallBlind ;
gameData . handsBeforeRaise = handsBeforeRaise ;
mySession -> startGame ( gameData );
2007-04-27 21:35:18 +00:00
}
2007-01-20 01:38:40 +00:00
void mainWindowImpl :: keyPressEvent ( QKeyEvent * event ) {
2007-02-10 21:52:05 +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-03-28 10:21:51 +00:00
if ( event -> key () == 16777220 ) { if ( spinBox_set -> hasFocus ()) pushButton_CallCheckSet -> click (); } //ENTER
2007-03-31 00:04:36 +00:00
if ( event -> key () == Qt :: Key_F1 ) { pushButton_FoldAllin -> click (); }
if ( event -> key () == Qt :: Key_F2 ) { pushButton_CallCheckSet -> click (); }
if ( event -> key () == Qt :: Key_F3 ) { pushButton_BetRaise -> click (); }
if ( event -> key () == Qt :: Key_F10 ) { switchLeftToolBox (); }
if ( event -> key () == Qt :: Key_F11 ) { switchRightToolBox (); }
2007-02-27 19:44:03 +00:00
if ( event -> key () == Qt :: Key_F ) { switchFullscreen (); } //f
2007-03-31 00:04:36 +00:00
// if (event->key() == Qt::Key_S) { showMyCards(); } //f
2007-02-04 13:46:27 +00:00
if ( event -> key () == 16777249 ) {
pushButton_break -> click ();
ctrlPressed = TRUE ;
// QTimer::SingleShot
} //CTRL
2007-03-31 00:04:36 +00:00
// if (event->key() == 65) { pixmapLabel_card0a->setUpdatesEnabled(FALSE); }
2007-02-02 13:59:09 +00:00
// if (event->key() == 66) { label_logo->hide(); }
2007-01-20 01:38:40 +00:00
}
2007-01-20 17:49:33 +00:00
2007-03-30 12:44:16 +00:00
// bool mainWindowImpl::event ( QEvent * event ) {
// if(event->type() == QEvent::MouseMove) { event->setAccepted ( FALSE ); }
// }
2007-02-20 00:05:09 +00:00
void mainWindowImpl :: switchLeftToolBox () {
2007-01-20 17:49:33 +00:00
2007-03-29 22:58:04 +00:00
if ( groupBox_LeftToolBox -> isHidden ()) { groupBox_LeftToolBox -> show (); }
else { groupBox_LeftToolBox -> hide (); }
2007-02-20 00:05:09 +00:00
}
void mainWindowImpl :: switchRightToolBox () {
2007-03-29 22:58:04 +00:00
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-05-01 22:51:10 +00:00
QPalette tempPalette = pushButton_break -> palette ();
if ( tempPalette . color ( QPalette :: Button ). red () == 40 ) {
tempPalette . setColor ( QPalette :: Button , QColor ( 113 , 162 , 0 ));
tempPalette . setColor ( QPalette :: ButtonText , QColor ( 0 , 0 , 0 ));
}
else {
tempPalette . setColor ( QPalette :: Button , QColor ( 40 , 82 , 0 ));
tempPalette . setColor ( QPalette :: ButtonText , QColor ( 240 , 240 , 240 ));
}
pushButton_break -> setPalette ( tempPalette );
}