From c9615e264c7f69c002ff831c4398d953522ec281 Mon Sep 17 00:00:00 2001 From: doitux Date: Wed, 22 Apr 2009 22:32:45 +0000 Subject: [PATCH] Add stay on table animation for inactive network players which doent leave the table. some vote kick fixes. --- pokerth_game.pro | 6 +- src/engine/local_engine/localplayer.cpp | 2 +- src/engine/local_engine/localplayer.h | 4 + src/engine/network_engine/clientplayer.cpp | 16 +++- src/engine/network_engine/clientplayer.h | 4 + src/engine/playerinterface.h | 3 + src/game.cpp | 6 +- src/gui/guiinterface.h | 12 +-- src/gui/qt/gametable.ui | 25 +++--- src/gui/qt/gametable/gametableimpl.cpp | 99 ++++++++++++++++------ src/gui/qt/gametable/gametableimpl.h | 7 +- src/gui/qt/gametable/myavatarlabel.cpp | 69 ++++++++++----- src/gui/qt/gametable/myavatarlabel.h | 8 +- src/gui/qt/gametable/mynamelabel.cpp | 42 +++++++++ src/gui/qt/gametable/mynamelabel.h | 38 +++++++++ src/gui/qt/guiwrapper.cpp | 1 + 16 files changed, 262 insertions(+), 80 deletions(-) create mode 100644 src/gui/qt/gametable/mynamelabel.cpp create mode 100644 src/gui/qt/gametable/mynamelabel.h diff --git a/pokerth_game.pro b/pokerth_game.pro index 9f67e91e..be429049 100644 --- a/pokerth_game.pro +++ b/pokerth_game.pro @@ -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 \ diff --git a/src/engine/local_engine/localplayer.cpp b/src/engine/local_engine/localplayer.cpp index bf22781b..50786795 100755 --- a/src/engine/local_engine/localplayer.cpp +++ b/src/engine/local_engine/localplayer.cpp @@ -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 !!!!!!!!!!!!!!!!!!!!!!!! diff --git a/src/engine/local_engine/localplayer.h b/src/engine/local_engine/localplayer.h index f4c3bb50..1fc6f042 100755 --- a/src/engine/local_engine/localplayer.h +++ b/src/engine/local_engine/localplayer.h @@ -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; diff --git a/src/engine/network_engine/clientplayer.cpp b/src/engine/network_engine/clientplayer.cpp index a994fb00..6540d9d1 100644 --- a/src/engine/network_engine/clientplayer.cpp +++ b/src/engine/network_engine/clientplayer.cpp @@ -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) { diff --git a/src/engine/network_engine/clientplayer.h b/src/engine/network_engine/clientplayer.h index de8b2e67..887120d4 100644 --- a/src/engine/network_engine/clientplayer.h +++ b/src/engine/network_engine/clientplayer.h @@ -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; diff --git a/src/engine/playerinterface.h b/src/engine/playerinterface.h index 89223629..87cb9019 100644 --- a/src/engine/playerinterface.h +++ b/src/engine/playerinterface.h @@ -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; diff --git a/src/game.cpp b/src/game.cpp index e2c0f1cf..d61ec9ff 100755 --- a/src/game.cpp +++ b/src/game.cpp @@ -104,7 +104,6 @@ Game::Game(GuiInterface* gui, boost::shared_ptr 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() diff --git a/src/gui/guiinterface.h b/src/gui/guiinterface.h index 4e202afd..dab5aec2 100644 --- a/src/gui/guiinterface.h +++ b/src/gui/guiinterface.h @@ -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; diff --git a/src/gui/qt/gametable.ui b/src/gui/qt/gametable.ui index ba126460..da91290b 100644 --- a/src/gui/qt/gametable.ui +++ b/src/gui/qt/gametable.ui @@ -108,7 +108,7 @@ true - + 70 @@ -326,7 +326,7 @@ true - + 70 @@ -551,7 +551,7 @@ true - + 70 @@ -756,7 +756,7 @@ true - + 70 @@ -961,7 +961,7 @@ true - + 70 @@ -1186,7 +1186,7 @@ true - + 70 @@ -1404,7 +1404,7 @@ true - + 70 @@ -2061,7 +2061,7 @@ true - + 70 @@ -2266,7 +2266,7 @@ true - + 70 @@ -2471,7 +2471,7 @@ true - + 70 @@ -3742,6 +3742,11 @@ QLabel
mytimeoutlabel.h
+ + MyNameLabel + QLabel +
mynamelabel.h
+
diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index 70c1fb60..261312df 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -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 tmpPlayer = myStartWindow->getSession()->getCurrentGame()->getPlayerByUniqueId(playerId); + if (tmpPlayer.get()) { + tmpPlayer->setMyStayOnTableStatus(0); + refreshPlayerAvatar(); + refreshPlayerName(); + } + } +} diff --git a/src/gui/qt/gametable/gametableimpl.h b/src/gui/qt/gametable/gametableimpl.h index 47deefc7..63ea7f41 100755 --- a/src/gui/qt/gametable/gametableimpl.h +++ b/src/gui/qt/gametable/gametableimpl.h @@ -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 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; diff --git a/src/gui/qt/gametable/myavatarlabel.cpp b/src/gui/qt/gametable/myavatarlabel.cpp index 73ccff93..2a12b6f6 100644 --- a/src/gui/qt/gametable/myavatarlabel.cpp +++ b/src/gui/qt/gametable/myavatarlabel.cpp @@ -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); -} \ No newline at end of file +} + +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); +} + diff --git a/src/gui/qt/gametable/myavatarlabel.h b/src/gui/qt/gametable/myavatarlabel.h index b0ea468a..da3f17ce 100644 --- a/src/gui/qt/gametable/myavatarlabel.h +++ b/src/gui/qt/gametable/myavatarlabel.h @@ -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 diff --git a/src/gui/qt/gametable/mynamelabel.cpp b/src/gui/qt/gametable/mynamelabel.cpp new file mode 100644 index 00000000..4f26cd1a --- /dev/null +++ b/src/gui/qt/gametable/mynamelabel.cpp @@ -0,0 +1,42 @@ +// +// C++ Implementation: mycardspixmaplabel +// +// Description: +// +// +// Author: FThauer FHammer , (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); +} + diff --git a/src/gui/qt/gametable/mynamelabel.h b/src/gui/qt/gametable/mynamelabel.h new file mode 100644 index 00000000..b0d78aed --- /dev/null +++ b/src/gui/qt/gametable/mynamelabel.h @@ -0,0 +1,38 @@ +// +// C++ Interface: mycardspixmaplabel +// +// Description: +// +// +// Author: FThauer FHammer , (C) 2007 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef MYNAMELABEL_H +#define MYNAMELABEL_H + +#include + +#include +#include + +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 diff --git a/src/gui/qt/guiwrapper.cpp b/src/gui/qt/guiwrapper.cpp index b3ebb693..fe3e60fb 100644 --- a/src/gui/qt/guiwrapper.cpp +++ b/src/gui/qt/guiwrapper.cpp @@ -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); }