gui tweaks for autofold mode, new timeout message about autofold mode

This commit is contained in:
doitux
2011-12-20 22:11:23 +00:00
parent 6df1a9b93c
commit e3a30d571c
9 changed files with 148 additions and 31 deletions
+6 -2
View File
@@ -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 {
}
+2 -1
View File
@@ -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 {
+15 -10
View File
@@ -161,7 +161,7 @@
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
<widget class="QLabel" name="textLabel_Cash3">
<widget class="MyCashLabel" name="textLabel_Cash3">
<property name="geometry">
<rect>
<x>70</x>
@@ -464,7 +464,7 @@ p, li { white-space: pre-wrap; }
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
<widget class="QLabel" name="textLabel_Cash2">
<widget class="MyCashLabel" name="textLabel_Cash2">
<property name="geometry">
<rect>
<x>70</x>
@@ -777,7 +777,7 @@ p, li { white-space: pre-wrap; }
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
<widget class="QLabel" name="textLabel_Cash4">
<widget class="MyCashLabel" name="textLabel_Cash4">
<property name="geometry">
<rect>
<x>70</x>
@@ -1067,7 +1067,7 @@ p, li { white-space: pre-wrap; }
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
<widget class="QLabel" name="textLabel_Cash5">
<widget class="MyCashLabel" name="textLabel_Cash5">
<property name="geometry">
<rect>
<x>70</x>
@@ -1357,7 +1357,7 @@ p, li { white-space: pre-wrap; }
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
<widget class="QLabel" name="textLabel_Cash6">
<widget class="MyCashLabel" name="textLabel_Cash6">
<property name="geometry">
<rect>
<x>70</x>
@@ -1667,7 +1667,7 @@ p, li { white-space: pre-wrap; }
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
<widget class="QLabel" name="textLabel_Cash7">
<widget class="MyCashLabel" name="textLabel_Cash7">
<property name="geometry">
<rect>
<x>70</x>
@@ -1970,7 +1970,7 @@ p, li { white-space: pre-wrap; }
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
<widget class="QLabel" name="textLabel_Cash8">
<widget class="MyCashLabel" name="textLabel_Cash8">
<property name="geometry">
<rect>
<x>70</x>
@@ -2735,7 +2735,7 @@ p, li { white-space: pre-wrap; }
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
<widget class="QLabel" name="textLabel_Cash1">
<widget class="MyCashLabel" name="textLabel_Cash1">
<property name="geometry">
<rect>
<x>70</x>
@@ -3025,7 +3025,7 @@ p, li { white-space: pre-wrap; }
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
<widget class="QLabel" name="textLabel_Cash0">
<widget class="MyCashLabel" name="textLabel_Cash0">
<property name="geometry">
<rect>
<x>70</x>
@@ -3328,7 +3328,7 @@ p, li { white-space: pre-wrap; }
<set>Qt::AlignBottom|Qt::AlignHCenter</set>
</property>
</widget>
<widget class="QLabel" name="textLabel_Cash9">
<widget class="MyCashLabel" name="textLabel_Cash9">
<property name="geometry">
<rect>
<x>70</x>
@@ -4677,6 +4677,11 @@ p, li { white-space: pre-wrap; }
<extends>QSlider</extends>
<header>myslider.h</header>
</customwidget>
<customwidget>
<class>MyCashLabel</class>
<extends>QLabel</extends>
<header>mycashlabel.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="resources/pokerth.qrc"/>
+12 -17
View File
@@ -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; i<MAX_NUMBER_OF_PLAYERS; i++) {
cashLabelArray[i]->setMyW(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<Game> 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: {
+3 -1
View File
@@ -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];
+48
View File
@@ -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 <http://www.gnu.org/licenses/>. *
*****************************************************************************/
#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);
}
+49
View File
@@ -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 <http://www.gnu.org/licenses/>. *
*****************************************************************************/
#ifndef MYCASHLABEL_H
#define MYCASHLABEL_H
#include <iostream>
#include <QtGui>
#include <QtCore>
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
+10
View File
@@ -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;
}
@@ -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;