Add stay on table animation for inactive network players which doent leave the table. some vote kick fixes.

This commit is contained in:
doitux
2009-04-22 22:32:45 +00:00
parent a75abcbb6a
commit c9615e264c
16 changed files with 262 additions and 80 deletions
+4 -2
View File
@@ -193,7 +193,8 @@ HEADERS += src/game.h \
src/gui/qt/gametable/mychancelabel.h \
src/gui/qt/serverlistdialog/serverlistdialogimpl.h \
src/gui/qt/gametable/mymenubar.h \
src/gui/qt/gametable/mytimeoutlabel.h
src/gui/qt/gametable/mytimeoutlabel.h \
src/gui/qt/gametable/mynamelabel.h
FORMS += src/gui/qt/gametable.ui \
src/gui/qt/aboutpokerth.ui \
src/gui/qt/connecttoserverdialog.ui \
@@ -256,7 +257,8 @@ SOURCES += src/pokerth.cpp \
src/gui/qt/gametable/mychancelabel.cpp \
src/gui/qt/serverlistdialog/serverlistdialogimpl.cpp \
src/gui/qt/gametable/mymenubar.cpp \
src/gui/qt/gametable/mytimeoutlabel.cpp
src/gui/qt/gametable/mytimeoutlabel.cpp \
src/gui/qt/gametable/mynamelabel.cpp
TRANSLATIONS = ts/pokerth_bg.ts \
ts/pokerth_de.ts \
ts/pokerth_dk.ts \
+1 -1
View File
@@ -850,7 +850,7 @@ static const RoundData FlopValues[] =
#define NUM_FLOP_VALUES (sizeof(FlopValues)/sizeof(RoundData))
LocalPlayer::LocalPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB)
: PlayerInterface(), myConfig(c), currentHand(0), currentBoard(b), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(0), myButton(mB), myActiveStatus(aS), myTurn(0), myRoundStartCash(0), lastMoneyWon(0), sBluff(0), sBluffStatus(0)
: PlayerInterface(), myConfig(c), currentHand(0), currentBoard(b), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(0), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(1), myTurn(0), myRoundStartCash(0), lastMoneyWon(0), sBluff(0), sBluffStatus(0)
{
// !!!!!!!!!!!!!!!!!!!!!!!! testing !!!!!!!!!!!!!!!!!!!!!!!!
+4
View File
@@ -77,6 +77,9 @@ public:
void setMyActiveStatus(bool theValue) { myActiveStatus = theValue; }
bool getMyActiveStatus() const { return myActiveStatus; }
void setMyStayOnTableStatus(bool theValue) { myStayOnTableStatus = theValue; }
bool getMyStayOnTableStatus() const { return myStayOnTableStatus; }
void setMyCards(int* theValue) { int i; for(i=0; i<2; i++) myCards[i] = theValue[i]; }
void getMyCards(int* theValue) const { int i; for(i=0; i<2; i++) theValue[i] = myCards[i]; }
@@ -210,6 +213,7 @@ private:
int myAction; // 0 = none, 1 = fold, 2 = check, 3 = call, 4 = bet, 5 = raise, 6 = allin
int myButton; // 0 = none, 1 = dealer, 2 =small, 3 = big
bool myActiveStatus; // 0 = inactive, 1 = active
bool myStayOnTableStatus; // 0 = left, 1 = stay
bool myTurn; // 0 = no, 1 = yes
bool myCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
int myRoundStartCash;
+15 -1
View File
@@ -23,7 +23,7 @@ using namespace std;
ClientPlayer::ClientPlayer(ConfigFile *c, BoardInterface *b, int id, unsigned uniqueId, PlayerType type, std::string name, std::string avatar, int sC, bool aS, int mB)
: PlayerInterface(), myConfig(c), currentHand(0), currentBoard(b), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(0), myButton(mB), myActiveStatus(aS), myTurn(0), myRoundStartCash(0), sBluff(0), sBluffStatus(0)
: PlayerInterface(), myConfig(c), currentHand(0), currentBoard(b), myCardsValue(0), myID(id), myUniqueID(uniqueId), myType(type), myName(name), myAvatar(avatar), myDude(0), myDude4(0), myCardsValueInt(0), myOdds(-1.0), myCash(sC), mySet(0), myLastRelativeSet(0), myAction(0), myButton(mB), myActiveStatus(aS), myStayOnTableStatus(1), myTurn(0), myRoundStartCash(0), sBluff(0), sBluffStatus(0)
{
}
@@ -206,6 +206,20 @@ ClientPlayer::getMyActiveStatus() const
return myActiveStatus;
}
void
ClientPlayer::setMyStayOnTableStatus(bool theValue)
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
myStayOnTableStatus = theValue;
}
bool
ClientPlayer::getMyStayOnTableStatus() const
{
boost::recursive_mutex::scoped_lock lock(m_syncMutex);
return myStayOnTableStatus;
}
void
ClientPlayer::setMyCards(int* theValue)
{
+4
View File
@@ -71,6 +71,9 @@ public:
void setMyActiveStatus(bool theValue);
bool getMyActiveStatus() const;
void setMyStayOnTableStatus(bool theValue);
bool getMyStayOnTableStatus() const;
void setMyCards(int* theValue);
void getMyCards(int* theValue) const;
@@ -163,6 +166,7 @@ private:
int myAction; // 0 = none, 1 = fold, 2 = check, 3 = call, 4 = bet, 5 = raise, 6 = allin
int myButton; // 0 = none, 1 = dealer, 2 =small, 3 = big
bool myActiveStatus; // 0 = inactive, 1 = active
bool myStayOnTableStatus; // 0 = left, 1 = stay
bool myTurn; // 0 = no, 1 = yes
bool myCardsFlip; // 0 = cards are not fliped, 1 = cards are already flipped,
int myRoundStartCash;
+3
View File
@@ -68,6 +68,9 @@ public:
virtual void setMyActiveStatus(bool theValue) =0;
virtual bool getMyActiveStatus() const =0;
virtual void setMyStayOnTableStatus(bool theValue) =0;
virtual bool getMyStayOnTableStatus() const =0;
virtual void setMyCards(int* theValue) =0;
virtual void getMyCards(int* theValue) const =0;
+1 -5
View File
@@ -104,7 +104,6 @@ Game::Game(GuiInterface* gui, boost::shared_ptr<EngineFactory> factory,
}
(*runningPlayerList) = (*activePlayerList);
}
currentBoard->setPlayerLists(seatsList, activePlayerList, runningPlayerList);
@@ -154,7 +153,7 @@ void Game::initHand()
while( it!=activePlayerList->end() ) {
if((*it)->getMyCash() == 0) {
(*it)->setMyActiveStatus(false);
(*it)->setMyActiveStatus(false);
it = activePlayerList->erase(it);
} else {
it++;
@@ -191,13 +190,10 @@ void Game::initHand()
dealerPosition = (*it_c)->getMyUniqueID();
break;
}
}
if(!nextDealerFound) {
throw LocalException(__FILE__, __LINE__, ERR_NEXT_DEALER_NOT_FOUND);
}
}
void Game::startHand()
+3 -9
View File
@@ -55,11 +55,10 @@ public:
virtual void refreshGameLabels(GameState state) const=0;
virtual void setPlayerAvatar(int myUniqueID, const std::string &myAvatar) const=0;
virtual void waitForGuiUpdateDone() const=0;
virtual void waitForGuiUpdateDone() const=0;
// Karten-Funktionen
virtual void dealBeRoCards(int) =0;
// // Karten-Funktionen
virtual void dealHoleCards()=0;
virtual void dealFlopCards()=0;
virtual void dealTurnCard()=0;
@@ -82,15 +81,10 @@ public:
virtual void riverAnimation2()=0;
virtual void postRiverAnimation1()=0;
virtual void postRiverRunAnimation1()=0;
// virtual void postRiverAnimation2()=0;
virtual void postRiverRunAnimation1()=0;
virtual void flipHolecardsAllIn()=0;
// virtual void startNewHand() const=0;
virtual void nextRoundCleanGui()=0;
//
// virtual void userWidgetsBackgroudColor() const=0;
// virtual void timerBlockerFalse() const=0;
virtual void meInAction()=0;
virtual void updateMyButtonsState()=0;
virtual void disableMyButtons()=0;
+15 -10
View File
@@ -108,7 +108,7 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_PlayerName3">
<widget class="MyNameLabel" name="label_PlayerName3">
<property name="geometry">
<rect>
<x>70</x>
@@ -326,7 +326,7 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_PlayerName2">
<widget class="MyNameLabel" name="label_PlayerName2">
<property name="geometry">
<rect>
<x>70</x>
@@ -551,7 +551,7 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_PlayerName4">
<widget class="MyNameLabel" name="label_PlayerName4">
<property name="geometry">
<rect>
<x>70</x>
@@ -756,7 +756,7 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_PlayerName5">
<widget class="MyNameLabel" name="label_PlayerName5">
<property name="geometry">
<rect>
<x>70</x>
@@ -961,7 +961,7 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_PlayerName6">
<widget class="MyNameLabel" name="label_PlayerName6">
<property name="geometry">
<rect>
<x>70</x>
@@ -1186,7 +1186,7 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_PlayerName7">
<widget class="MyNameLabel" name="label_PlayerName7">
<property name="geometry">
<rect>
<x>70</x>
@@ -1404,7 +1404,7 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_PlayerName8">
<widget class="MyNameLabel" name="label_PlayerName8">
<property name="geometry">
<rect>
<x>70</x>
@@ -2061,7 +2061,7 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_PlayerName1">
<widget class="MyNameLabel" name="label_PlayerName1">
<property name="geometry">
<rect>
<x>70</x>
@@ -2266,7 +2266,7 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_PlayerName0">
<widget class="MyNameLabel" name="label_PlayerName0">
<property name="geometry">
<rect>
<x>70</x>
@@ -2471,7 +2471,7 @@
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_PlayerName9">
<widget class="MyNameLabel" name="label_PlayerName9">
<property name="geometry">
<rect>
<x>70</x>
@@ -3742,6 +3742,11 @@
<extends>QLabel</extends>
<header>mytimeoutlabel.h</header>
</customwidget>
<customwidget>
<class>MyNameLabel</class>
<extends>QLabel</extends>
<header>mynamelabel.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="resources/pokerth.qrc"/>
+72 -27
View File
@@ -508,6 +508,8 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
connect(this, SIGNAL(signalChangeVoteOnKickButtonsState(bool)), this, SLOT(changeVoteOnKickButtonsState(bool)));
connect(this, SIGNAL(signalEndVoteOnKick()), this, SLOT(endVoteOnKick()));
connect(this, SIGNAL(signalNetClientPlayerLeft(unsigned)), this, SLOT(netClientPlayerLeft(unsigned)));
}
gameTableImpl::~gameTableImpl() {
@@ -772,41 +774,70 @@ void gameTableImpl::refreshButton() {
void gameTableImpl::refreshPlayerName() {
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
if(myStartWindow->getSession()->getCurrentGame()) {
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
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 {
playerNameLabelArray[(*it_c)->getMyID()]->setText("");
}
}
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 {
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);
}
else {
playerNameLabelArray[(*it_c)->getMyID()]->setText("");
}
}
else {
playerNameLabelArray[(*it_c)->getMyID()]->setText("");
}
}
}
}
}
void gameTableImpl::refreshPlayerAvatar() {
QPixmap onePix = QPixmap::fromImage(QImage(myAppDataPath +"gfx/gui/misc/1px.png"));
if(myStartWindow->getSession()->getCurrentGame()) {
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
QPixmap onePix = QPixmap::fromImage(QImage(myAppDataPath +"gfx/gui/misc/1px.png"));
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
if((*it_c)->getMyActiveStatus()) {
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
if((*it_c)->getMyAvatar() == "" || !QFile::QFile(QString::fromUtf8((*it_c)->getMyAvatar().c_str())).exists()) {
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap::fromImage(QImage(myGameTableStyle->getDefaultAvatar())));
}
else {
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap::fromImage(QImage(QString::fromUtf8((*it_c)->getMyAvatar().c_str()))));
}
}
else {
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
}
}
PlayerListConstIterator it_c;
for (it_c=currentHand->getSeatsList()->begin(); it_c!=currentHand->getSeatsList()->end(); it_c++) {
if((*it_c)->getMyActiveStatus()) {
if((*it_c)->getMyAvatar() == "" || !QFile::QFile(QString::fromUtf8((*it_c)->getMyAvatar().c_str())).exists()) {
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap::fromImage(QImage(myGameTableStyle->getDefaultAvatar())));
}
else {
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap::fromImage(QImage(QString::fromUtf8((*it_c)->getMyAvatar().c_str()))));
}
}
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) {
if((*it_c)->getMyAvatar() == "" || !QFile::QFile(QString::fromUtf8((*it_c)->getMyAvatar().c_str())).exists()) {
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap::fromImage(QImage(myGameTableStyle->getDefaultAvatar())), TRUE);
}
else {
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap::fromImage(QImage(QString::fromUtf8((*it_c)->getMyAvatar().c_str()))), TRUE);
}
}
else {
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
}
}
else {
playerAvatarLabelArray[(*it_c)->getMyID()]->setPixmap(onePix);
}
}
}
}
}
void gameTableImpl::setPlayerAvatar(int myID, QString myAvatar) {
@@ -3323,3 +3354,17 @@ void gameTableImpl::restoreGameTableGeometry()
}
}
}
void gameTableImpl::netClientPlayerLeft(unsigned playerId) {
assert(myStartWindow->getSession()->getCurrentGame());
if (myStartWindow->getSession()->isNetworkClientRunning()) {
boost::shared_ptr<PlayerInterface> tmpPlayer = myStartWindow->getSession()->getCurrentGame()->getPlayerByUniqueId(playerId);
if (tmpPlayer.get()) {
tmpPlayer->setMyStayOnTableStatus(0);
refreshPlayerAvatar();
refreshPlayerName();
}
}
}
+4 -3
View File
@@ -87,7 +87,6 @@ signals:
void signalRefreshGameLabels(int);
void signalSetPlayerAvatar(int, QString);
void signalGuiUpdateDone();
void signalMeInAction();
@@ -126,6 +125,8 @@ signals:
void signalChangeVoteOnKickButtonsState(bool showHide);
void signalEndVoteOnKick();
void signalNetClientPlayerLeft(unsigned playerId);
public slots:
void initGui(int speed);
@@ -301,6 +302,7 @@ public slots:
void saveGameTableGeometry();
void restoreGameTableGeometry();
void netClientPlayerLeft(unsigned playerId);
private:
boost::shared_ptr<GuiInterface> myServerGuiInterface;
@@ -354,7 +356,7 @@ private:
QLabel *cashTopLabelArray[MAX_NUMBER_OF_PLAYERS];
MySetLabel *setLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *actionLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *playerNameLabelArray[MAX_NUMBER_OF_PLAYERS];
MyNameLabel *playerNameLabelArray[MAX_NUMBER_OF_PLAYERS];
MyAvatarLabel *playerAvatarLabelArray[MAX_NUMBER_OF_PLAYERS];
MyTimeoutLabel *timeoutLabelArray[MAX_NUMBER_OF_PLAYERS];
@@ -371,7 +373,6 @@ private:
SDLPlayer *mySDLPlayer;
QString myAppDataPath;
int distributePotAnimCounter;
int playingMode;
+49 -20
View File
@@ -9,7 +9,7 @@
// Copyright: See COPYING file that comes with this distribution
//
//
#include "mysetlabel.h"
#include "myavatarlabel.h"
#include "gametableimpl.h"
#include "session.h"
@@ -19,7 +19,7 @@
using namespace std;
MyAvatarLabel::MyAvatarLabel(QGroupBox* parent)
: QLabel(parent), voteRunning(FALSE)
: QLabel(parent), voteRunning(FALSE), transparent(FALSE)
{
myContextMenu = new QMenu;
@@ -36,25 +36,34 @@ MyAvatarLabel::~MyAvatarLabel()
void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) {
Game *currentGame = myW->getSession()->getCurrentGame();
PlayerListConstIterator it_c;
int activePlayerCounter=0;
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
if((*it_c)->getMyActiveStatus()) activePlayerCounter++;
}
if(activePlayerCounter > 2 && !voteRunning ) setVoteOnKickContextMenuEnabled(TRUE);
else setVoteOnKickContextMenuEnabled(FALSE);
assert(myW->getSession()->getCurrentGame());
if (myW->getSession()->isNetworkClientRunning()) {
int i=0;
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
if(myContextMenuEnabled && myId != 0 && myId == i && (*it_c)->getMyActiveStatus() )
showContextMenu(event->globalPos());
PlayerListIterator it = myW->getSession()->getCurrentGame()->getSeatsList()->begin();
//only active players are allowed to start a vote
if((*it)->getMyActiveStatus()) {
i++;
}
Game *currentGame = myW->getSession()->getCurrentGame();
PlayerListConstIterator it_c;
int activePlayerCounter=0;
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
if((*it_c)->getMyActiveStatus()) activePlayerCounter++;
}
if(activePlayerCounter > 2 && !voteRunning ) setVoteOnKickContextMenuEnabled(TRUE);
else setVoteOnKickContextMenuEnabled(FALSE);
int i=0;
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
//also inactive player which stays on table can be voted to kick
if(myContextMenuEnabled && myId != 0 && myId == i && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER && ( (*it_c)->getMyActiveStatus() || (*it_c)->getMyStayOnTableStatus() ) )
showContextMenu(event->globalPos());
i++;
}
}
}
}
void MyAvatarLabel::showContextMenu(const QPoint &pos) {
@@ -75,4 +84,24 @@ void MyAvatarLabel::setEnabledContextMenu(bool b)
void MyAvatarLabel::setVoteOnKickContextMenuEnabled(bool b)
{
action_VoteForKick->setEnabled(b);
}
}
void MyAvatarLabel::setPixmap ( const QPixmap &pix, const bool trans) {
myPixmap = pix.scaled(50,50, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
transparent = trans;
update();
}
void MyAvatarLabel::paintEvent(QPaintEvent*) {
QPainter painter(this);
if(transparent)
painter.setOpacity(0.4);
else
painter.setOpacity(1.0);
painter.drawPixmap(0,0,myPixmap);
}
+6 -2
View File
@@ -36,18 +36,22 @@ public slots:
void sendTriggerVoteOnKickSignal();
void setEnabledContextMenu(bool);
void setVoteOnKickContextMenuEnabled(bool);
void setVoteRunning ( bool theValue ) { voteRunning = theValue; }
void setPixmap ( const QPixmap &, const bool = FALSE);
void paintEvent(QPaintEvent*);
private:
gameTableImpl *myW;
QMenu *myContextMenu;
QAction *action_VoteForKick;
QPixmap myPixmap;
int myId;
bool myContextMenuEnabled;
bool voteRunning;
bool transparent;
};
#endif
+42
View File
@@ -0,0 +1,42 @@
//
// 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"
MyNameLabel::MyNameLabel(QGroupBox* parent)
: QLabel(parent), transparent(FALSE)
{
}
MyNameLabel::~MyNameLabel()
{
}
void MyNameLabel::setText ( const QString &text, const bool trans) {
myText = text;
transparent = trans;
update();
}
void MyNameLabel::paintEvent(QPaintEvent*) {
QPainter painter(this);
if(transparent)
painter.setOpacity(0.4);
else
painter.setOpacity(1.0);
painter.drawText(0,11,myText);
}
+38
View File
@@ -0,0 +1,38 @@
//
// C++ Interface: mycardspixmaplabel
//
// Description:
//
//
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef MYNAMELABEL_H
#define MYNAMELABEL_H
#include <iostream>
#include <QtGui>
#include <QtCore>
class MyNameLabel : public QLabel
{
Q_OBJECT
public:
MyNameLabel(QGroupBox*);
~MyNameLabel();
public slots:
void setText ( const QString &, const bool = FALSE);
void paintEvent(QPaintEvent*);
private:
QString myText;
bool transparent;
};
#endif
+1
View File
@@ -144,6 +144,7 @@ void GuiWrapper::SignalNetClientPlayerLeft(unsigned playerId, const string &play
{
QString tmpName(QString::fromUtf8(playerName.c_str()));
myStartWindow->signalNetClientPlayerLeft(playerId, tmpName);
myW->signalNetClientPlayerLeft(playerId);
if (!playerName.empty() && playerName[0] != '#')
myLog->signalLogPlayerLeftMsg(tmpName, removeReason == NTF_NET_REMOVED_KICKED);
}