From e3a30d571c56e00c4c08143aa8af6c4722f6bb33 Mon Sep 17 00:00:00 2001 From: doitux Date: Tue, 20 Dec 2011 22:11:23 +0000 Subject: [PATCH] gui tweaks for autofold mode, new timeout message about autofold mode --- pokerth_game.pro | 8 ++- src/game_defs.h | 3 +- src/gui/qt/gametable.ui | 25 ++++++---- src/gui/qt/gametable/gametableimpl.cpp | 29 +++++------ src/gui/qt/gametable/gametableimpl.h | 4 +- src/gui/qt/gametable/mycashlabel.cpp | 48 ++++++++++++++++++ src/gui/qt/gametable/mycashlabel.h | 49 +++++++++++++++++++ src/gui/qt/styles/gametablestylereader.h | 10 ++++ .../qt/timeoutmsgbox/timeoutmsgboximpl.cpp | 3 ++ 9 files changed, 148 insertions(+), 31 deletions(-) create mode 100644 src/gui/qt/gametable/mycashlabel.cpp create mode 100644 src/gui/qt/gametable/mycashlabel.h diff --git a/pokerth_game.pro b/pokerth_game.pro index 596658a3..12418b43 100644 --- a/pokerth_game.pro +++ b/pokerth_game.pro @@ -195,7 +195,8 @@ HEADERS += src/engine/game.h \ src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.h \ src/engine/local_engine/replay.h \ src/gui/qt/gamelobbydialog/mynicklistsortfilterproxymodel.h \ - src/gui/qt/gametable/myslider.h + src/gui/qt/gametable/myslider.h \ + src/gui/qt/gametable/mycashlabel.h !gui_800x480 { FORMS += src/gui/qt/gametable.ui \ @@ -268,7 +269,8 @@ SOURCES += src/pokerth.cpp \ src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp \ src/engine/local_engine/replay.cpp \ src/gui/qt/gamelobbydialog/mynicklistsortfilterproxymodel.cpp \ - src/net/common/servermanagerfactoryclient.cpp + src/net/common/servermanagerfactoryclient.cpp \ + src/gui/qt/gametable/mycashlabel.cpp TRANSLATIONS = ts/pokerth_af.ts \ ts/pokerth_bg.ts \ ts/pokerth_zhcn.ts \ @@ -587,3 +589,5 @@ gui_800x480 { } + + diff --git a/src/game_defs.h b/src/game_defs.h index 5a4f68c0..d9542d57 100644 --- a/src/game_defs.h +++ b/src/game_defs.h @@ -136,7 +136,8 @@ enum Button { enum NetTimeoutReason { NETWORK_TIMEOUT_GENERIC = 0, - NETWORK_TIMEOUT_GAME_ADMIN_IDLE + NETWORK_TIMEOUT_GAME_ADMIN_IDLE, + NETWORK_TIMEOUT_KICK_AFTER_AUTOFOLD }; struct ServerStats { diff --git a/src/gui/qt/gametable.ui b/src/gui/qt/gametable.ui index e3aa2822..3d0eecd1 100644 --- a/src/gui/qt/gametable.ui +++ b/src/gui/qt/gametable.ui @@ -161,7 +161,7 @@ Qt::AlignBottom|Qt::AlignHCenter - + 70 @@ -464,7 +464,7 @@ p, li { white-space: pre-wrap; } Qt::AlignBottom|Qt::AlignHCenter - + 70 @@ -777,7 +777,7 @@ p, li { white-space: pre-wrap; } Qt::AlignBottom|Qt::AlignHCenter - + 70 @@ -1067,7 +1067,7 @@ p, li { white-space: pre-wrap; } Qt::AlignBottom|Qt::AlignHCenter - + 70 @@ -1357,7 +1357,7 @@ p, li { white-space: pre-wrap; } Qt::AlignBottom|Qt::AlignHCenter - + 70 @@ -1667,7 +1667,7 @@ p, li { white-space: pre-wrap; } Qt::AlignBottom|Qt::AlignHCenter - + 70 @@ -1970,7 +1970,7 @@ p, li { white-space: pre-wrap; } Qt::AlignBottom|Qt::AlignHCenter - + 70 @@ -2735,7 +2735,7 @@ p, li { white-space: pre-wrap; } Qt::AlignBottom|Qt::AlignHCenter - + 70 @@ -3025,7 +3025,7 @@ p, li { white-space: pre-wrap; } Qt::AlignBottom|Qt::AlignHCenter - + 70 @@ -3328,7 +3328,7 @@ p, li { white-space: pre-wrap; } Qt::AlignBottom|Qt::AlignHCenter - + 70 @@ -4677,6 +4677,11 @@ p, li { white-space: pre-wrap; } QSlider
myslider.h
+ + MyCashLabel + QLabel +
mycashlabel.h
+
diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index 556db6df..3811261c 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -26,6 +26,8 @@ #include "mysetlabel.h" #include "myavatarlabel.h" #include "myactionbutton.h" +#include "mycashlabel.h" +#include "mynamelabel.h" #include "mychancelabel.h" #include "mytimeoutlabel.h" #include "mymenubar.h" @@ -248,16 +250,6 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) playerStarsArray[4][9]=label_Star49; playerStarsArray[5][9]=label_Star59; - - - - - - - - - - // buttonLabelArray init buttonLabelArray[0] = textLabel_Button0; buttonLabelArray[1] = textLabel_Button1; @@ -281,6 +273,9 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) cashLabelArray[7] = textLabel_Cash7; cashLabelArray[8] = textLabel_Cash8; cashLabelArray[9] = textLabel_Cash9; + for (i=0; isetMyW(this); + } playerTipLabelArray[0] = label_playerTip0; playerTipLabelArray[1] = label_playerTip1; @@ -964,16 +959,17 @@ void gameTableImpl::refreshPlayerAvatar() switch(getCurrentSeatState((*it_c))) { case SEAT_ACTIVE: { + qDebug() << seatPlace << "AVATAR ACTIVE"; playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(avatarPic, countryString, seatPlace); } break; case SEAT_AUTOFOLD: { - qDebug() << seatPlace << "AUTOFOLD"; + qDebug() << seatPlace << "AVATAR AUTOFOLD"; playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(avatarPic, countryString, seatPlace, TRUE); } break; case SEAT_STAYONTABLE: { - qDebug() << seatPlace << "STAYONTABLE"; + qDebug() << seatPlace << "AVATAR STAYONTABLE"; playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmapAndCountry(avatarPic, countryString, seatPlace, TRUE); } break; @@ -1074,23 +1070,22 @@ void gameTableImpl::refreshCash() boost::shared_ptr currentGame = myStartWindow->getSession()->getCurrentGame(); + bool transparent = true; PlayerListConstIterator it_c; PlayerList seatsList = currentGame->getSeatsList(); for (it_c=seatsList->begin(); it_c!=seatsList->end(); ++it_c) { - QGraphicsOpacityEffect opacity; - opacity.setOpacity(0.8); - //check SeatStates and refresh switch(getCurrentSeatState((*it_c))) { case SEAT_ACTIVE: { +// qDebug() << (*it_c)->getMyID() << "CASH ACTIVE"; cashLabelArray[(*it_c)->getMyID()]->setText("$"+QString("%L1").arg((*it_c)->getMyCash())); } break; case SEAT_AUTOFOLD: { - cashLabelArray[(*it_c)->getMyID()]->setGraphicsEffect(&opacity); - cashLabelArray[(*it_c)->getMyID()]->setText("$"+QString("%L1").arg((*it_c)->getMyCash())); +// qDebug() << (*it_c)->getMyID() << "CASH AUTOFOLD"; //TODO transparent + cashLabelArray[(*it_c)->getMyID()]->setText("$"+QString("%L1").arg((*it_c)->getMyCash()), transparent); } break; case SEAT_STAYONTABLE: { diff --git a/src/gui/qt/gametable/gametableimpl.h b/src/gui/qt/gametable/gametableimpl.h index 8c73667c..9977a1a3 100755 --- a/src/gui/qt/gametable/gametableimpl.h +++ b/src/gui/qt/gametable/gametableimpl.h @@ -39,6 +39,8 @@ class PlayerInterface; class MyCardsPixmapLabel; class MyAvatarLabel; class MyTimeoutLabel; +class MyCashLabel; +class MyNameLabel; class settingsDialogImpl; class startWindowImpl; @@ -381,7 +383,7 @@ private: QWidget *userWidgetsArray[6]; QLabel *buttonLabelArray[MAX_NUMBER_OF_PLAYERS]; - QLabel *cashLabelArray[MAX_NUMBER_OF_PLAYERS]; + MyCashLabel *cashLabelArray[MAX_NUMBER_OF_PLAYERS]; QLabel *cashTopLabelArray[MAX_NUMBER_OF_PLAYERS]; MySetLabel *setLabelArray[MAX_NUMBER_OF_PLAYERS]; QLabel *actionLabelArray[MAX_NUMBER_OF_PLAYERS]; diff --git a/src/gui/qt/gametable/mycashlabel.cpp b/src/gui/qt/gametable/mycashlabel.cpp new file mode 100644 index 00000000..8f1f658e --- /dev/null +++ b/src/gui/qt/gametable/mycashlabel.cpp @@ -0,0 +1,48 @@ +/***************************************************************************** + * PokerTH - The open source texas holdem engine * + * Copyright (C) 2006-2011 Felix Hammer, Florian Thauer, Lothar May * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + *****************************************************************************/ +#include "mycashlabel.h" +#include "gametableimpl.h" +#include "gametablestylereader.h" + +MyCashLabel::MyCashLabel(QGroupBox* parent) + : QLabel(parent), myW(0) +{ +} + + +MyCashLabel::~MyCashLabel() +{ +} + +void MyCashLabel::setText ( const QString &t, bool trans) +{ + QColor transColor; + transColor.setNamedColor("#"+myW->getMyGameTableStyle()->getPlayerCashTextColor()); + QString red = QString::number(transColor.red()); + QString green = QString::number(transColor.green()); + QString blue = QString::number(transColor.blue()); + + if(trans) { + this->setStyleSheet("QLabel { "+ myW->getMyGameTableStyle()->getFont2String() +" font-size: "+myW->getMyGameTableStyle()->getPlayerCashLabelFontSize()+"px; font-weight: bold; color: rgba("+red+", "+green+", "+blue+", 80); }"); + } else { + this->setStyleSheet("QLabel { "+ myW->getMyGameTableStyle()->getFont2String() +" font-size: "+myW->getMyGameTableStyle()->getPlayerCashLabelFontSize()+"px; font-weight: bold; color: #"+myW->getMyGameTableStyle()->getPlayerCashTextColor()+"; }"); + } + + QLabel::setText(t); + +} diff --git a/src/gui/qt/gametable/mycashlabel.h b/src/gui/qt/gametable/mycashlabel.h new file mode 100644 index 00000000..0cdccb8b --- /dev/null +++ b/src/gui/qt/gametable/mycashlabel.h @@ -0,0 +1,49 @@ +/***************************************************************************** + * PokerTH - The open source texas holdem engine * + * Copyright (C) 2006-2011 Felix Hammer, Florian Thauer, Lothar May * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Affero General Public License as * + * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details. * + * * + * You should have received a copy of the GNU Affero General Public License * + * along with this program. If not, see . * + *****************************************************************************/ +#ifndef MYCASHLABEL_H +#define MYCASHLABEL_H + +#include + +#include +#include + +class gameTableImpl; + +class MyCashLabel : public QLabel +{ + Q_OBJECT +public: + MyCashLabel(QGroupBox*); + ~MyCashLabel(); + + void setMyW(gameTableImpl* theValue) { + myW = theValue; + } + +public slots: + + void setText ( const QString &, bool = false ); +private: + + QString myText; + gameTableImpl *myW; + +}; + +#endif diff --git a/src/gui/qt/styles/gametablestylereader.h b/src/gui/qt/styles/gametablestylereader.h index 51793fb0..d013276f 100644 --- a/src/gui/qt/styles/gametablestylereader.h +++ b/src/gui/qt/styles/gametablestylereader.h @@ -129,9 +129,19 @@ public: QString getPlayerNickTextColor() const { return PlayerNickTextColor; } + + QString getPlayerCashTextColor() const { + return PlayerCashTextColor; + } + QString getPlayerNameLabelFontSize() const { return playerNameLabelFontSize; } + + QString getPlayerCashLabelFontSize() const { + return cashFontSize; + } + QString getFont2String() const { return font2String; } diff --git a/src/gui/qt/timeoutmsgbox/timeoutmsgboximpl.cpp b/src/gui/qt/timeoutmsgbox/timeoutmsgboximpl.cpp index ceb63d2a..47227b26 100644 --- a/src/gui/qt/timeoutmsgbox/timeoutmsgboximpl.cpp +++ b/src/gui/qt/timeoutmsgbox/timeoutmsgboximpl.cpp @@ -58,6 +58,9 @@ void timeoutMsgBoxImpl::timerRefresh() case NETWORK_TIMEOUT_GAME_ADMIN_IDLE: this->setText(tr("You are game-admin of an open game which will time out in %1 seconds.").arg(sec,0,10)); break; + case NETWORK_TIMEOUT_KICK_AFTER_AUTOFOLD: + this->setText(tr("You did not act in the game recently. You will be removed from the game in %1 seconds.").arg(sec,0,10)); + break; default: this->setText(tr("Your connection is about to time out due to inactivity in %1 seconds.").arg(sec,0,10)); break;