2009-04-22 22:32:45 +00:00
|
|
|
//
|
|
|
|
|
// C++ Implementation: mycardspixmaplabel
|
|
|
|
|
//
|
|
|
|
|
// Description:
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
|
|
|
|
|
//
|
|
|
|
|
// Copyright: See COPYING file that comes with this distribution
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
#include "mynamelabel.h"
|
2010-09-13 23:10:10 +00:00
|
|
|
#include "gametableimpl.h"
|
|
|
|
|
#include "session.h"
|
|
|
|
|
#include "gametablestylereader.h"
|
2009-04-22 22:32:45 +00:00
|
|
|
|
|
|
|
|
MyNameLabel::MyNameLabel(QGroupBox* parent)
|
2010-09-13 23:10:10 +00:00
|
|
|
: QLabel(parent)
|
2009-04-22 22:32:45 +00:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MyNameLabel::~MyNameLabel()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-13 23:10:10 +00:00
|
|
|
void MyNameLabel::setText ( const QString &t, bool trans, bool guest, bool computerplayer) {
|
2009-04-22 22:32:45 +00:00
|
|
|
|
2010-09-13 23:10:10 +00:00
|
|
|
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);
|
2009-04-22 22:32:45 +00:00
|
|
|
|
|
|
|
|
}
|