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
+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);
}