starts human player input filed redesign - PART II (shows call-amount)

This commit is contained in:
doitux
2007-10-16 18:46:08 +00:00
parent d6267c9618
commit 979a726ec3
3 changed files with 165 additions and 103 deletions
+36 -6
View File
@@ -23,8 +23,8 @@
</property> </property>
<property name="maximumSize" > <property name="maximumSize" >
<size> <size>
<width>1980</width> <width>1000</width>
<height>1200</height> <height>680</height>
</size> </size>
</property> </property>
<property name="windowTitle" > <property name="windowTitle" >
@@ -1896,24 +1896,42 @@
<property name="enabled" > <property name="enabled" >
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>384</width>
<height>211</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>384</width>
<height>211</height>
</size>
</property>
<property name="title" > <property name="title" >
<string/> <string/>
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<property name="leftMargin" > <property name="leftMargin" >
<number>26</number> <number>28</number>
</property> </property>
<property name="topMargin" > <property name="topMargin" >
<number>26</number> <number>26</number>
</property> </property>
<property name="rightMargin" > <property name="rightMargin" >
<number>20</number> <number>15</number>
</property> </property>
<property name="bottomMargin" > <property name="bottomMargin" >
<number>26</number> <number>26</number>
</property> </property>
<property name="horizontalSpacing" > <property name="horizontalSpacing" >
<number>10</number> <number>14</number>
</property> </property>
<item rowspan="2" row="0" column="0" > <item rowspan="2" row="0" column="0" >
<widget class="QLabel" name="textLabel_Button0" > <widget class="QLabel" name="textLabel_Button0" >
@@ -1939,6 +1957,12 @@
</item> </item>
<item row="0" column="1" > <item row="0" column="1" >
<widget class="MySetLabel" name="textLabel_Set0" > <widget class="MySetLabel" name="textLabel_Set0" >
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="alignment" > <property name="alignment" >
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
@@ -2409,8 +2433,14 @@
</item> </item>
<item row="4" column="1" > <item row="4" column="1" >
<widget class="QLabel" name="label_PlayerName0" > <widget class="QLabel" name="label_PlayerName0" >
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>23</height>
</size>
</property>
<property name="alignment" > <property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property> </property>
</widget> </widget>
</item> </item>
+122 -91
View File
@@ -431,8 +431,6 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
cashLabelArray[i]->setStyleSheet("QLabel { "+ font2String +" font-size: 10px; font-weight: bold; color: #F0F0F0; }"); cashLabelArray[i]->setStyleSheet("QLabel { "+ font2String +" font-size: 10px; font-weight: bold; color: #F0F0F0; }");
} }
spinBox_set->setStyleSheet("QSpinBox { "+ font2String +" font-size: 10px; font-weight: bold; background-color: #1D3B00; color: #F0F0F0; }");
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) { for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
setLabelArray[i]->setStyleSheet("QLabel { "+ font2String +" font-size: 12px; font-weight: bold; color: #F0F0F0; }"); setLabelArray[i]->setStyleSheet("QLabel { "+ font2String +" font-size: 12px; font-weight: bold; color: #F0F0F0; }");
@@ -484,11 +482,14 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
} }
groupBoxArray[0]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxInactiveGlow_0.6.png) }"); groupBoxArray[0]->setStyleSheet("QGroupBox { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playerBoxInactiveGlow_0.6.png) }");
//Human player button //Human player button
pushButton_BetRaise->setStyleSheet("QPushButton { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playeraction_03_0.6.png); "+ font2String +" font-size: 11px; font-weight: bold; color: #F0F0F0; }"); pushButton_BetRaise->setStyleSheet("QPushButton { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playeraction_03_0.6.png); "+ font2String +" font-size: 11px; font-weight: bold; color: #F0F0F0; }");
pushButton_CallCheckSet->setStyleSheet("QPushButton { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playeraction_05_0.6.png); "+ font2String +" font-size: 11px; font-weight: bold; color: #F0F0F0; }"); pushButton_CallCheckSet->setStyleSheet("QPushButton { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playeraction_05_0.6.png); "+ font2String +" font-size: 11px; font-weight: bold; color: #F0F0F0; }");
pushButton_FoldAllin->setStyleSheet("QPushButton { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playeraction_07_0.6.png); "+ font2String +" font-size: 11px; font-weight: bold; color: #F0F0F0; }"); pushButton_FoldAllin->setStyleSheet("QPushButton { border:none; background-image: url(" + myAppDataPath +"gfx/gui/table/default/playeraction_07_0.6.png); "+ font2String +" font-size: 11px; font-weight: bold; color: #F0F0F0; }");
spinBox_set->setStyleSheet("QSpinBox { "+ font2String +" font-size: 10px; font-weight: bold; background-color: #1D3B00; color: #F0F0F0; } QSpinBox:disabled { background-color: #316300; color: #6d7b5f }");
// away radiobuttons // away radiobuttons
QString radioButtonString("QRadioButton { color: #F0F0F0; } QRadioButton::indicator { width: 13px; height: 13px; } QRadioButton::indicator::checked { image: url("+myAppDataPath+"gfx/gui/misc/radiobutton_checked.png); }"); QString radioButtonString("QRadioButton { color: #F0F0F0; } QRadioButton::indicator { width: 13px; height: 13px; } QRadioButton::indicator::checked { image: url("+myAppDataPath+"gfx/gui/misc/radiobutton_checked.png); }");
@@ -602,7 +603,7 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
connect( actionShowHideHelp, SIGNAL( triggered() ), this, SLOT( switchHelpWindow() ) ); connect( actionShowHideHelp, SIGNAL( triggered() ), this, SLOT( switchHelpWindow() ) );
connect( actionShowHideLog, SIGNAL( triggered() ), this, SLOT( switchLogWindow() ) ); connect( actionShowHideLog, SIGNAL( triggered() ), this, SLOT( switchLogWindow() ) );
connect( pushButton_BetRaise, SIGNAL( clicked() ), this, SLOT( myBetRaise() ) ); connect( pushButton_BetRaise, SIGNAL( clicked() ), this, SLOT( mySet() ) );
connect( pushButton_FoldAllin, SIGNAL( clicked() ), this, SLOT( myFoldAllin() ) ); connect( pushButton_FoldAllin, SIGNAL( clicked() ), this, SLOT( myFoldAllin() ) );
connect( pushButton_CallCheckSet, SIGNAL( clicked() ), this, SLOT( myCallCheckSet() ) ); connect( pushButton_CallCheckSet, SIGNAL( clicked() ), this, SLOT( myCallCheckSet() ) );
@@ -2118,10 +2119,12 @@ void mainWindowImpl::meInAction() {
switch (currentHand->getActualRound()) { switch (currentHand->getActualRound()) {
case 0: { case 0: {
if (currentGame->getSeatsList()->front()->getMyCash()+currentGame->getSeatsList()->front()->getMySet() > currentHand->getCurrentBeRo()->getHighestSet()) { pushButton_BetRaise->setText("Raise"); } if (currentGame->getSeatsList()->front()->getMyCash()+currentGame->getSeatsList()->front()->getMySet() > currentHand->getCurrentBeRo()->getHighestSet()) {
pushButton_BetRaise->setText("Raise");
}
if (currentGame->getSeatsList()->front()->getMySet()== currentHand->getCurrentBeRo()->getHighestSet() && currentGame->getSeatsList()->front()->getMyButton() == 3) { pushButton_CallCheckSet->setText("Check"); } if (currentGame->getSeatsList()->front()->getMySet()== currentHand->getCurrentBeRo()->getHighestSet() && currentGame->getSeatsList()->front()->getMyButton() == 3) { pushButton_CallCheckSet->setText("Check"); }
else { pushButton_CallCheckSet->setText("Call"); } else { pushButton_CallCheckSet->setText("Call "+QString::number(getMyCallAmount())+"$" ); }
pushButton_FoldAllin->setText("Fold"); pushButton_FoldAllin->setText("Fold");
} }
break; break;
@@ -2135,8 +2138,10 @@ void mainWindowImpl::meInAction() {
pushButton_BetRaise->setText("Bet"); pushButton_BetRaise->setText("Bet");
} }
if (currentHand->getCurrentBeRo()->getHighestSet() > 0 && currentHand->getCurrentBeRo()->getHighestSet() > currentGame->getSeatsList()->front()->getMySet()) { if (currentHand->getCurrentBeRo()->getHighestSet() > 0 && currentHand->getCurrentBeRo()->getHighestSet() > currentGame->getSeatsList()->front()->getMySet()) {
pushButton_CallCheckSet->setText("Call"); pushButton_CallCheckSet->setText("Call "+QString::number(getMyCallAmount())+"$" );
if (currentGame->getSeatsList()->front()->getMyCash()+currentGame->getSeatsList()->front()->getMySet() > currentHand->getCurrentBeRo()->getHighestSet()) { pushButton_BetRaise->setText("Raise"); } if (currentGame->getSeatsList()->front()->getMyCash()+currentGame->getSeatsList()->front()->getMySet() > currentHand->getCurrentBeRo()->getHighestSet()) {
pushButton_BetRaise->setText("Raise");
}
} }
} }
break; break;
@@ -2150,8 +2155,10 @@ void mainWindowImpl::meInAction() {
pushButton_BetRaise->setText("Bet"); pushButton_BetRaise->setText("Bet");
} }
if (currentHand->getCurrentBeRo()->getHighestSet() > 0 && currentHand->getCurrentBeRo()->getHighestSet() > currentGame->getSeatsList()->front()->getMySet()) { if (currentHand->getCurrentBeRo()->getHighestSet() > 0 && currentHand->getCurrentBeRo()->getHighestSet() > currentGame->getSeatsList()->front()->getMySet()) {
pushButton_CallCheckSet->setText("Call"); pushButton_CallCheckSet->setText("Call "+QString::number(getMyCallAmount())+"$" );
if (currentGame->getSeatsList()->front()->getMyCash()+currentGame->getSeatsList()->front()->getMySet() > currentHand->getCurrentBeRo()->getHighestSet()) { pushButton_BetRaise->setText("Raise"); } if (currentGame->getSeatsList()->front()->getMyCash()+currentGame->getSeatsList()->front()->getMySet() > currentHand->getCurrentBeRo()->getHighestSet()) {
pushButton_BetRaise->setText("Raise");
}
} }
} }
break; break;
@@ -2165,14 +2172,18 @@ void mainWindowImpl::meInAction() {
pushButton_BetRaise->setText("Bet"); pushButton_BetRaise->setText("Bet");
} }
if (currentHand->getCurrentBeRo()->getHighestSet() > 0 && currentHand->getCurrentBeRo()->getHighestSet() > currentGame->getSeatsList()->front()->getMySet()) { if (currentHand->getCurrentBeRo()->getHighestSet() > 0 && currentHand->getCurrentBeRo()->getHighestSet() > currentGame->getSeatsList()->front()->getMySet()) {
pushButton_CallCheckSet->setText("Call"); pushButton_CallCheckSet->setText("Call "+QString::number(getMyCallAmount())+"$" );
if (currentGame->getSeatsList()->front()->getMyCash()+currentGame->getSeatsList()->front()->getMySet() > currentHand->getCurrentBeRo()->getHighestSet()) { pushButton_BetRaise->setText("Raise"); } if (currentGame->getSeatsList()->front()->getMyCash()+currentGame->getSeatsList()->front()->getMySet() > currentHand->getCurrentBeRo()->getHighestSet()) {
pushButton_BetRaise->setText("Raise");
}
} }
} }
break; break;
default: {} default: {}
} }
myBetRaise();
switch (playingMode) { switch (playingMode) {
case 0: // Manual mode case 0: // Manual mode
break; break;
@@ -2220,19 +2231,29 @@ void mainWindowImpl::disableMyButtons() {
void mainWindowImpl::myBetRaise() { void mainWindowImpl::myBetRaise() {
if(pushButton_BetRaise->text() == "Raise") { myRaise(); } if(pushButton_BetRaise->text() == "Raise") {
if(pushButton_BetRaise->text() == "Bet") { myBet(); } myRaise();
}
else if(pushButton_BetRaise->text() == "Bet") {
myBet();
}
else {
spinBox_set->setMinimum(0);
horizontalSlider_bet->setMinimum(0);
spinBox_set->setValue(0);
horizontalSlider_bet->setValue(0);
spinBox_set->setDisabled(TRUE);
horizontalSlider_bet->setDisabled(TRUE);
}
} }
void mainWindowImpl::myFoldAllin() { void mainWindowImpl::myFoldAllin() {
if(pushButton_FoldAllin->text() == "Fold") { myFold(); } if(pushButton_FoldAllin->text() == "Fold") { myFold(); }
if(pushButton_FoldAllin->text() == "All-In") { myAllIn(); }
} }
void mainWindowImpl::myCallCheckSet() { void mainWindowImpl::myCallCheckSet() {
if(pushButton_CallCheckSet->text() == "Call") { myCall(); } if(pushButton_CallCheckSet->text().startsWith("Call")) { myCall(); }
if(pushButton_CallCheckSet->text() == "Check") { myCheck(); } if(pushButton_CallCheckSet->text() == "Check") { myCheck(); }
if(pushButton_CallCheckSet->text() == "Set") { mySet(); }
} }
@@ -2266,6 +2287,21 @@ void mainWindowImpl::myCheck() {
myActionDone(); myActionDone();
} }
int mainWindowImpl::getMyCallAmount() {
int tempHighestSet = 0;
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
tempHighestSet = currentHand->getCurrentBeRo()->getHighestSet();
if (currentHand->getPlayerArray()[0]->getMyCash()+currentHand->getPlayerArray()[0]->getMySet() <= tempHighestSet) {
return currentHand->getPlayerArray()[0]->getMyCash();
}
else {
return tempHighestSet - currentHand->getPlayerArray()[0]->getMySet();
}
}
void mainWindowImpl::myCall(){ void mainWindowImpl::myCall(){
int tempHighestSet = 0; int tempHighestSet = 0;
@@ -2299,12 +2335,6 @@ void mainWindowImpl::myCall(){
void mainWindowImpl::myBet(){ void mainWindowImpl::myBet(){
// pushButton_BetRaise->hide();
// spinBox_set->show();
pushButton_CallCheckSet->setText("Set");
pushButton_FoldAllin->setText("All-In");
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand(); HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
spinBox_set->setMinimum(currentHand->getSmallBlind()*2); spinBox_set->setMinimum(currentHand->getSmallBlind()*2);
@@ -2320,100 +2350,101 @@ void mainWindowImpl::myBet(){
void mainWindowImpl::myRaise(){ void mainWindowImpl::myRaise(){
// pushButton_BetRaise->hide();
// spinBox_set->show();
pushButton_CallCheckSet->setText("Set");
pushButton_FoldAllin->setText("All-In");
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand(); HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
spinBox_set->setMinimum(currentHand->getCurrentBeRo()->getHighestSet() - currentHand->getSeatsList()->front()->getMySet() + currentHand->getCurrentBeRo()->getMinimumRaise()); spinBox_set->setMinimum(currentHand->getCurrentBeRo()->getHighestSet() - currentHand->getSeatsList()->front()->getMySet() + currentHand->getCurrentBeRo()->getMinimumRaise());
horizontalSlider_bet->setMinimum(currentHand->getCurrentBeRo()->getHighestSet() - currentHand->getSeatsList()->front()->getMySet() + currentHand->getCurrentBeRo()->getMinimumRaise());
spinBox_set->setMaximum(currentHand->getSeatsList()->front()->getMyCash()); spinBox_set->setMaximum(currentHand->getSeatsList()->front()->getMyCash());
horizontalSlider_bet->setMaximum(currentHand->getSeatsList()->front()->getMyCash());
spinBox_set->setValue(spinBox_set->minimum()); spinBox_set->setValue(spinBox_set->minimum());
spinBox_set->setFocus(); spinBox_set->setFocus();
spinBox_set->selectAll(); spinBox_set->selectAll();
myActionIsRaise = 1; myActionIsRaise = 1;
} }
void mainWindowImpl::mySet(){ void mainWindowImpl::mySet(){
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand(); if(pushButton_BetRaise->text() != "") {
int tempCash = currentHand->getSeatsList()->front()->getMyCash();
// cout << "Set-Value " << spinBox_set->value() << endl; HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
currentHand->getSeatsList()->front()->setMySet(spinBox_set->value()); int tempCash = currentHand->getSeatsList()->front()->getMyCash();
// cout << "MySET " << currentHand->getPlayerArray()[0]->getMySet() << endl;
if (spinBox_set->value() >= tempCash ) {
currentHand->getSeatsList()->front()->setMySet(currentHand->getSeatsList()->front()->getMyCash()); // cout << "Set-Value " << spinBox_set->value() << endl;
currentHand->getSeatsList()->front()->setMyCash(0); currentHand->getSeatsList()->front()->setMySet(spinBox_set->value());
currentHand->getSeatsList()->front()->setMyAction(6); // cout << "MySET " << currentHand->getPlayerArray()[0]->getMySet() << endl;
} if (spinBox_set->value() >= tempCash ) {
if(myActionIsRaise) { currentHand->getSeatsList()->front()->setMySet(currentHand->getSeatsList()->front()->getMyCash());
//do not if allIn currentHand->getSeatsList()->front()->setMyCash(0);
if(currentHand->getSeatsList()->front()->getMyAction() != 6) { currentHand->getSeatsList()->front()->setMyAction(6);
currentHand->getSeatsList()->front()->setMyAction(5);
} }
myActionIsRaise = 0;
currentHand->getCurrentBeRo()->setMinimumRaise(currentHand->getSeatsList()->front()->getMySet() - currentHand->getCurrentBeRo()->getHighestSet()); if(myActionIsRaise) {
} //do not if allIn
if(currentHand->getSeatsList()->front()->getMyAction() != 6) {
currentHand->getSeatsList()->front()->setMyAction(5);
}
myActionIsRaise = 0;
if(myActionIsBet) { currentHand->getCurrentBeRo()->setMinimumRaise(currentHand->getSeatsList()->front()->getMySet() - currentHand->getCurrentBeRo()->getHighestSet());
//do not if allIn
if(currentHand->getSeatsList()->front()->getMyAction() != 6) {
currentHand->getSeatsList()->front()->setMyAction(4);
} }
myActionIsBet = 0;
currentHand->getCurrentBeRo()->setMinimumRaise(currentHand->getSeatsList()->front()->getMySet()); if(myActionIsBet) {
//do not if allIn
if(currentHand->getSeatsList()->front()->getMyAction() != 6) {
currentHand->getSeatsList()->front()->setMyAction(4);
}
myActionIsBet = 0;
currentHand->getCurrentBeRo()->setMinimumRaise(currentHand->getSeatsList()->front()->getMySet());
}
currentHand->getCurrentBeRo()->setHighestSet(currentHand->getSeatsList()->front()->getMySet());
currentHand->getSeatsList()->front()->setMyTurn(0);
currentHand->getBoard()->collectSets();
refreshPot();
statusBar()->clearMessage();
//set that i was the last active player. need this for unhighlighting groupbox
currentHand->setLastPlayersTurn(0);
//Spiel läuft weiter
myActionDone();
} }
currentHand->getCurrentBeRo()->setHighestSet(currentHand->getSeatsList()->front()->getMySet());
currentHand->getSeatsList()->front()->setMyTurn(0);
currentHand->getBoard()->collectSets();
refreshPot();
statusBar()->clearMessage();
//set that i was the last active player. need this for unhighlighting groupbox
currentHand->setLastPlayersTurn(0);
//Spiel läuft weiter
myActionDone();
} }
void mainWindowImpl::myAllIn(){ void mainWindowImpl::myAllIn(){
HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand(); // HandInterface *currentHand = mySession->getCurrentGame()->getCurrentHand();
//
currentHand->getSeatsList()->front()->setMySet(currentHand->getSeatsList()->front()->getMyCash()); // currentHand->getSeatsList()->front()->setMySet(currentHand->getSeatsList()->front()->getMyCash());
currentHand->getSeatsList()->front()->setMyCash(0); // currentHand->getSeatsList()->front()->setMyCash(0);
currentHand->getSeatsList()->front()->setMyAction(6); // currentHand->getSeatsList()->front()->setMyAction(6);
//
if(currentHand->getSeatsList()->front()->getMySet() > currentHand->getCurrentBeRo()->getHighestSet()) { // if(currentHand->getSeatsList()->front()->getMySet() > currentHand->getCurrentBeRo()->getHighestSet()) {
currentHand->getCurrentBeRo()->setMinimumRaise(currentHand->getSeatsList()->front()->getMySet() - currentHand->getCurrentBeRo()->getHighestSet()); // currentHand->getCurrentBeRo()->setMinimumRaise(currentHand->getSeatsList()->front()->getMySet() - currentHand->getCurrentBeRo()->getHighestSet());
//
currentHand->getCurrentBeRo()->setHighestSet(currentHand->getSeatsList()->front()->getMySet()); // currentHand->getCurrentBeRo()->setHighestSet(currentHand->getSeatsList()->front()->getMySet());
//
} // }
//
currentHand->getSeatsList()->front()->setMyTurn(0); // currentHand->getSeatsList()->front()->setMyTurn(0);
//
currentHand->getBoard()->collectSets(); // currentHand->getBoard()->collectSets();
refreshPot(); // refreshPot();
//
statusBar()->clearMessage(); // statusBar()->clearMessage();
//
//set that i was the last active player. need this for unhighlighting groupbox // //set that i was the last active player. need this for unhighlighting groupbox
currentHand->setLastPlayersTurn(0); // currentHand->setLastPlayersTurn(0);
//
//Spiel läuft weiter // //Spiel läuft weiter
myActionDone(); // myActionDone();
} }
void mainWindowImpl::myActionDone() { void mainWindowImpl::myActionDone() {
+1
View File
@@ -201,6 +201,7 @@ public slots:
void myFold(); void myFold();
void myCheck(); void myCheck();
int getMyCallAmount();
void myCall(); void myCall();
void myBet(); void myBet();
void mySet(); void mySet();