display nicks on the table including links to their poker-heroes.com

profile page
This commit is contained in:
doitux
2010-09-13 23:10:10 +00:00
parent 9e2a3e40ae
commit 3a9db4957b
15 changed files with 251 additions and 103 deletions
+28 -13
View File
@@ -234,6 +234,9 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
playerNameLabelArray[7] = label_PlayerName7;
playerNameLabelArray[8] = label_PlayerName8;
playerNameLabelArray[9] = label_PlayerName9;
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
playerNameLabelArray[i]->setMyW(this);
}
// playerAvatarLabelArray init
playerAvatarLabelArray[0] = label_Avatar0;
@@ -781,12 +784,24 @@ void gameTableImpl::refreshPlayerName() {
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
if((*it_c)->getMyActiveStatus()) {
playerNameLabelArray[(*it_c)->getMyID()]->setText(QString::fromUtf8((*it_c)->getMyName().c_str()));
} else {
bool guest = myStartWindow->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).isGuest;
bool computerPlayer = false;
if((*it_c)->getMyType() == PLAYER_TYPE_COMPUTER) { computerPlayer = true; }
playerNameLabelArray[(*it_c)->getMyID()]->setText(QString::fromUtf8((*it_c)->getMyName().c_str()), FALSE, guest, computerPlayer );
}
else {
if((myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK)) {
if((*it_c)->getMyStayOnTableStatus() == TRUE && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER) {
playerNameLabelArray[(*it_c)->getMyID()]->setText(QString::fromUtf8((*it_c)->getMyName().c_str()), TRUE);
bool guest = myStartWindow->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).isGuest;
bool computerPlayer = false;
if((*it_c)->getMyType() == PLAYER_TYPE_COMPUTER) { computerPlayer = true; }
playerNameLabelArray[(*it_c)->getMyID()]->setText(QString::fromUtf8((*it_c)->getMyName().c_str()), TRUE, guest, computerPlayer);
}
else {
playerNameLabelArray[(*it_c)->getMyID()]->setText("");
@@ -2218,7 +2233,7 @@ void gameTableImpl::postRiverRunAnimation5() {
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() == currentHand->getCurrentBeRo()->getHighestCardsValue() ) {
playerNameLabelArray[(*it_c)->getMyID()]->setText("");
playerNameLabelArray[(*it_c)->getMyID()]->hide();
}
}
}
@@ -2228,7 +2243,7 @@ void gameTableImpl::postRiverRunAnimation5() {
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() == currentHand->getCurrentBeRo()->getHighestCardsValue() ) {
playerNameLabelArray[(*it_c)->getMyID()]->setText(QString::fromUtf8((*it_c)->getMyName().c_str()));
playerNameLabelArray[(*it_c)->getMyID()]->show();
}
}
}
@@ -2581,9 +2596,9 @@ void gameTableImpl::keyPressEvent ( QKeyEvent * event ) {
ctrlPressed = TRUE;
}
}
if (event->key() == Qt::Key_Escape && (myActionIsBet || myActionIsRaise)) {
meInAction();
}
// if (event->key() == Qt::Key_Escape && (myActionIsBet || myActionIsRaise)) {
// meInAction();
// }
if (event->key() == Qt::Key_Up && lineEdit_ChatInput->hasFocus()) {
if((keyUpDownChatCounter + 1) <= myChat->getChatLinesHistorySize()) { keyUpDownChatCounter++; }
// std::cout << "Up keyUpDownChatCounter: " << keyUpDownChatCounter << "\n";
@@ -2597,7 +2612,7 @@ void gameTableImpl::keyPressEvent ( QKeyEvent * event ) {
else { keyUpDownChatCounter = 0; }
//TESTING UNIT
if (event->key() == Qt::Key_M) { showShowMyCardsButton(); }
// if (event->key() == Qt::Key_M) { showShowMyCardsButton(); }
}
void gameTableImpl::changePlayingMode() {
@@ -3391,9 +3406,9 @@ void gameTableImpl::sendShowMyCardsSignal()
void gameTableImpl::showWarningAutoFoldInRankingGame(unsigned remainingAutoFolds)
{
QMessageBox::warning(this, tr("PokerTH - Warning"),
tr("You have triggered a warning level of timeouts in a ranking game.\n"
"After %1 additional timeouts the server needs to kick you to provide a better game flow!\n\n"
"If you are temporarily away, you can use the \"away\" tools in the tool box on the right.").arg(remainingAutoFolds),
QMessageBox::Ok);
tr("You have triggered a warning level of timeouts in a ranking game.\n"
"After %1 additional timeouts the server needs to kick you to provide a better game flow!\n\n"
"If you are temporarily away, you can use the \"away\" tools in the tool box on the right.").arg(remainingAutoFolds),
QMessageBox::Ok);
tabWidget_Right->setCurrentIndex(1);
}
+42 -17
View File
@@ -10,9 +10,12 @@
//
//
#include "mynamelabel.h"
#include "gametableimpl.h"
#include "session.h"
#include "gametablestylereader.h"
MyNameLabel::MyNameLabel(QGroupBox* parent)
: QLabel(parent), transparent(FALSE)
: QLabel(parent)
{
}
@@ -21,22 +24,44 @@ MyNameLabel::~MyNameLabel()
{
}
void MyNameLabel::setText ( const QString &text, const bool trans) {
void MyNameLabel::setText ( const QString &t, bool trans, bool guest, bool computerplayer) {
myText = text;
transparent = trans;
update();
QString text;
QColor transColor;
transColor.setNamedColor("#"+myW->getMyGameTableStyle()->getPlayerNickTextColor());
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()->getPlayerNameLabelFontSize()+"px; font-weight: bold; color: rgba("+red+", "+green+", "+blue+", 80); }");
}
else {
this->setStyleSheet("QLabel { "+ myW->getMyGameTableStyle()->getFont2String() +" font-size: "+myW->getMyGameTableStyle()->getPlayerNameLabelFontSize()+"px; font-weight: bold; color: #"+myW->getMyGameTableStyle()->getPlayerNickTextColor()+"; }");
}
if(myW->getSession()) {
if(myW->getSession()->getGameType() == Session::GAME_TYPE_INTERNET && !guest && !computerplayer ) {
//for internetgame show players name with links to their profile included
this->setTextFormat(Qt::RichText);
QUrl link(QString("http://pokerth.net/redirect_user_profile.php?nick=%1").arg(t));
if(trans) {
text = "<a style='color: rgba("+red+", "+green+", "+blue+", 80);' href='"+link.toEncoded()+"'>"+t+"</a>";
}
else {
text = "<a style='color: #"+myW->getMyGameTableStyle()->getPlayerNickTextColor()+";' href='"+link.toEncoded()+"'>"+t+"</a>";
}
}
else {
this->setTextFormat(Qt::PlainText);
text = t;
}
}
else { text = t; }
QLabel::setText(text);
}
void MyNameLabel::paintEvent(QPaintEvent*) {
QPainter painter(this);
if(transparent)
painter.setOpacity(0.4);
else
painter.setOpacity(1.0);
painter.drawText(0,11,myText);
}
+7 -4
View File
@@ -17,6 +17,8 @@
#include <QtGui>
#include <QtCore>
class gameTableImpl;
class MyNameLabel : public QLabel
{
Q_OBJECT
@@ -24,15 +26,16 @@ public:
MyNameLabel(QGroupBox*);
~MyNameLabel();
void setMyW(gameTableImpl* theValue) { myW = theValue; }
public slots:
void setText ( const QString &, const bool = FALSE);
void paintEvent(QPaintEvent*);
void setText ( const QString &, bool = FALSE, bool = FALSE, bool = FALSE);
private:
QString myText;
bool transparent;
gameTableImpl *myW;
};
#endif