ingame chat is disbaled for guest, ignore context menu ingame

This commit is contained in:
doitux
2010-03-31 20:12:44 +00:00
parent 43f477e299
commit c673c885f3
5 changed files with 2995 additions and 2914 deletions
+1 -1
View File
@@ -3561,7 +3561,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1024</width> <width>1024</width>
<height>27</height> <height>26</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuView"> <widget class="QMenu" name="menuView">
File diff suppressed because it is too large Load Diff
+303 -299
View File
@@ -51,393 +51,397 @@ class CardDeckStyleReader;
class SDLPlayer; class SDLPlayer;
class gameTableImpl: public QMainWindow, public Ui::gameTable { class gameTableImpl: public QMainWindow, public Ui::gameTable {
Q_OBJECT Q_OBJECT
public: public:
gameTableImpl(ConfigFile *c = 0, QMainWindow *parent = 0); gameTableImpl(ConfigFile *c = 0, QMainWindow *parent = 0);
~gameTableImpl(); ~gameTableImpl();
boost::shared_ptr<Session> getSession(); boost::shared_ptr<Session> getSession();
void setStartWindow(startWindowImpl* s) { myStartWindow = s; } SDLPlayer* getMySDLPlayer() const { return mySDLPlayer; }
ChatTools* getMyChat() const { return myChat; }
ConfigFile* getMyConfig() const { return myConfig; }
GameTableStyleReader* getMyGameTableStyle() const { return myGameTableStyle; }
bool getGuestMode() const { return guestMode; }
void setLog(Log* l) { myLog = l; } void setStartWindow(startWindowImpl* s) { myStartWindow = s; }
void setLog(Log* l) { myLog = l; }
SDLPlayer* getMySDLPlayer() const { return mySDLPlayer; } void setSpeeds();
ChatTools* getMyChat() const { return myChat; }
GameTableStyleReader* getMyGameTableStyle() const { return myGameTableStyle; }
void setSpeeds();
signals: signals:
void signalInitGui(int speed); void signalInitGui(int speed);
void signalShowClientDialog(); void signalShowClientDialog();
void signalRefreshSet(); void signalRefreshSet();
void signalRefreshCash(); void signalRefreshCash();
void signalRefreshAction(int =-1, int=-1); void signalRefreshAction(int =-1, int=-1);
void signalRefreshChangePlayer(); void signalRefreshChangePlayer();
void signalRefreshPot(); void signalRefreshPot();
void signalRefreshGroupbox(int =-1, int =-1); void signalRefreshGroupbox(int =-1, int =-1);
void signalRefreshAll(); void signalRefreshAll();
void signalRefreshPlayerName(); void signalRefreshPlayerName();
void signalRefreshButton(); void signalRefreshButton();
void signalRefreshGameLabels(int); void signalRefreshGameLabels(int);
void signalSetPlayerAvatar(int, QString); void signalSetPlayerAvatar(int, QString);
void signalGuiUpdateDone(); void signalGuiUpdateDone();
void signalMeInAction(); void signalMeInAction();
void signalUpdateMyButtonsState(); void signalUpdateMyButtonsState();
void signalDisableMyButtons(); void signalDisableMyButtons();
void signalStartTimeoutAnimation(int playerId, int timeoutSec); void signalStartTimeoutAnimation(int playerId, int timeoutSec);
void signalStopTimeoutAnimation(int playerId); void signalStopTimeoutAnimation(int playerId);
void signalDealBeRoCards(int myBeRoID); void signalDealBeRoCards(int myBeRoID);
void signalDealHoleCards(); void signalDealHoleCards();
void signalDealFlopCards0(); void signalDealFlopCards0();
void signalDealTurnCards0(); void signalDealTurnCards0();
void signalDealRiverCards0(); void signalDealRiverCards0();
void signalNextPlayerAnimation(); void signalNextPlayerAnimation();
void signalBeRoAnimation2(int); void signalBeRoAnimation2(int);
void signalPreflopAnimation1(); void signalPreflopAnimation1();
void signalPreflopAnimation2(); void signalPreflopAnimation2();
void signalFlopAnimation1(); void signalFlopAnimation1();
void signalFlopAnimation2(); void signalFlopAnimation2();
void signalTurnAnimation1(); void signalTurnAnimation1();
void signalTurnAnimation2(); void signalTurnAnimation2();
void signalRiverAnimation1(); void signalRiverAnimation1();
void signalRiverAnimation2(); void signalRiverAnimation2();
void signalPostRiverAnimation1(); void signalPostRiverAnimation1();
void signalPostRiverRunAnimation1(); void signalPostRiverRunAnimation1();
void signalFlipHolecardsAllIn(); void signalFlipHolecardsAllIn();
void signalNextRoundCleanGui(); void signalNextRoundCleanGui();
void signalStartVoteOnKick(unsigned playerId, unsigned voteStarterPlayerId, int timeoutSec, int numVotesNeededToKick); void signalStartVoteOnKick(unsigned playerId, unsigned voteStarterPlayerId, int timeoutSec, int numVotesNeededToKick);
void signalChangeVoteOnKickButtonsState(bool showHide); void signalChangeVoteOnKickButtonsState(bool showHide);
void signalEndVoteOnKick(); void signalEndVoteOnKick();
void signalNetClientPlayerLeft(unsigned playerId); void signalNetClientPlayerLeft(unsigned playerId);
public slots: public slots:
void initGui(int speed); void initGui(int speed);
//refresh-Funktionen //refresh-Funktionen
void refreshSet(); void refreshSet();
void refreshCash(); void refreshCash();
void refreshAction(int =-1, int=-1); void refreshAction(int =-1, int=-1);
void refreshChangePlayer(); void refreshChangePlayer();
void refreshPot(); void refreshPot();
void refreshGroupbox(int =-1, int =-1); void refreshGroupbox(int =-1, int =-1);
void refreshAll(); void refreshAll();
void refreshPlayerName(); void refreshPlayerName();
void refreshGameLabels(int); void refreshGameLabels(int);
void refreshButton(); void refreshButton();
void refreshPlayerAvatar(); void refreshPlayerAvatar();
void refreshActionButtonFKeyIndicator(bool =0); void refreshActionButtonFKeyIndicator(bool =0);
void setPlayerAvatar(int myID, QString myAvatar); void setPlayerAvatar(int myID, QString myAvatar);
void guiUpdateDone(); void guiUpdateDone();
void waitForGuiUpdateDone(); void waitForGuiUpdateDone();
// Karten-Funktionen // Karten-Funktionen
void dealHoleCards(); void dealHoleCards();
//Spieler-Funktionen //Spieler-Funktionen
void provideMyActions(int mode = -1); //mode 0 == called from dealberocards void provideMyActions(int mode = -1); //mode 0 == called from dealberocards
void meInAction(); void meInAction();
void disableMyButtons(); void disableMyButtons();
void startTimeoutAnimation(int playerId, int timoutSec); void startTimeoutAnimation(int playerId, int timoutSec);
void stopTimeoutAnimation(int playerId); void stopTimeoutAnimation(int playerId);
void setGameSpeed(const int theValue) { guiGameSpeed = theValue; setSpeeds(); } // Achtung Faktor 10!!! void setGameSpeed(const int theValue) { guiGameSpeed = theValue; setSpeeds(); } // Achtung Faktor 10!!!
void callSettingsDialog(); void callSettingsDialog();
void applySettings(settingsDialogImpl*); void applySettings(settingsDialogImpl*);
void pushButtonBetRaiseClicked(bool checked); void pushButtonBetRaiseClicked(bool checked);
void pushButtonCallCheckClicked(bool checked); void pushButtonCallCheckClicked(bool checked);
void pushButtonFoldClicked(bool checked); void pushButtonFoldClicked(bool checked);
void pushButtonAllInClicked(bool checked); void pushButtonAllInClicked(bool checked);
void myCallCheck(); void myCallCheck();
void myFold(); void myFold();
void myCheck(); void myCheck();
int getMyCallAmount(); int getMyCallAmount();
int getBetRaisePushButtonValue(); int getBetRaisePushButtonValue();
int getMyBetAmount(); int getMyBetAmount();
void myCall(); void myCall();
void mySet(); void mySet();
void myAllIn(); void myAllIn();
void myActionDone(); void myActionDone();
void dealBeRoCards(int); void dealBeRoCards(int);
void dealFlopCards0(); void dealFlopCards0();
void dealFlopCards1(); void dealFlopCards1();
void dealFlopCards2(); void dealFlopCards2();
void dealFlopCards3(); void dealFlopCards3();
void dealFlopCards4(); void dealFlopCards4();
void dealFlopCards5(); void dealFlopCards5();
void dealFlopCards6(); void dealFlopCards6();
void dealTurnCards0(); void dealTurnCards0();
void dealTurnCards1(); void dealTurnCards1();
void dealTurnCards2(); void dealTurnCards2();
void dealRiverCards0(); void dealRiverCards0();
void dealRiverCards1(); void dealRiverCards1();
void dealRiverCards2(); void dealRiverCards2();
void nextPlayerAnimation(); void nextPlayerAnimation();
void beRoAnimation2(int); void beRoAnimation2(int);
void preflopAnimation1(); void preflopAnimation1();
void preflopAnimation1Action(); void preflopAnimation1Action();
void preflopAnimation2(); void preflopAnimation2();
void preflopAnimation2Action(); void preflopAnimation2Action();
void flopAnimation1(); void flopAnimation1();
void flopAnimation1Action(); void flopAnimation1Action();
void flopAnimation2(); void flopAnimation2();
void flopAnimation2Action(); void flopAnimation2Action();
void turnAnimation1(); void turnAnimation1();
void turnAnimation1Action(); void turnAnimation1Action();
void turnAnimation2(); void turnAnimation2();
void turnAnimation2Action(); void turnAnimation2Action();
void riverAnimation1(); void riverAnimation1();
void riverAnimation1Action(); void riverAnimation1Action();
void riverAnimation2(); void riverAnimation2();
void riverAnimation2Action(); void riverAnimation2Action();
void postRiverAnimation1(); void postRiverAnimation1();
void postRiverAnimation1Action(); void postRiverAnimation1Action();
void postRiverRunAnimation1(); void postRiverRunAnimation1();
void postRiverRunAnimation2(); void postRiverRunAnimation2();
void postRiverRunAnimation2_flipHoleCards1(); void postRiverRunAnimation2_flipHoleCards1();
void postRiverRunAnimation2_flipHoleCards2(); void postRiverRunAnimation2_flipHoleCards2();
void postRiverRunAnimation3(); void postRiverRunAnimation3();
void postRiverRunAnimation4(); void postRiverRunAnimation4();
void postRiverRunAnimation5(); void postRiverRunAnimation5();
void postRiverRunAnimation6(); void postRiverRunAnimation6();
void refreshCardsChance(GameState); void refreshCardsChance(GameState);
void blinkingStartButtonAnimationAction(); void blinkingStartButtonAnimationAction();
void flipHolecardsAllIn(); void flipHolecardsAllIn();
void showMyCards(); void showMyCards();
void triggerVoteOnKick(int id); void triggerVoteOnKick(int id);
void handSwitchRounds(); void handSwitchRounds();
void startNewHand(); void startNewHand();
void stopTimer(); void stopTimer();
void nextRoundCleanGui(); void nextRoundCleanGui();
void breakButtonClicked(); void breakButtonClicked();
void keyPressEvent ( QKeyEvent*); void keyPressEvent ( QKeyEvent*);
bool eventFilter(QObject *obj, QEvent *event); bool eventFilter(QObject *obj, QEvent *event);
void switchChatWindow(); void switchChatWindow();
void switchHelpWindow(); void switchHelpWindow();
void switchLogWindow(); void switchLogWindow();
void switchAwayWindow(); void switchAwayWindow();
void switchChanceWindow(); void switchChanceWindow();
void switchFullscreen(); void switchFullscreen();
void sendChatMessage(); void sendChatMessage();
void checkChatInputLength(QString); void checkChatInputLength(QString);
void tabSwitchAction(); void tabSwitchAction();
void leaveCurrentNetworkGame(); void leaveCurrentNetworkGame();
void localGameModification(); void localGameModification();
void networkGameModification(); void networkGameModification();
void mouseOverFlipCards(bool front); void mouseOverFlipCards(bool front);
void updateMyButtonsState(int mode = -1); //mode 0 == called from dealberocards void updateMyButtonsState(int mode = -1); //mode 0 == called from dealberocards
void uncheckMyButtons(); void uncheckMyButtons();
void resetMyButtonsCheckStateMemory(); void resetMyButtonsCheckStateMemory();
void clearMyButtons(); void clearMyButtons();
void myButtonsCheckable(bool state); void myButtonsCheckable(bool state);
void changePlayingMode(); void changePlayingMode();
void changeLineEditBetValue(int); void changeLineEditBetValue(int);
void lineEditBetValueChanged(QString); void lineEditBetValueChanged(QString);
void showMaximized (); void showMaximized ();
void closeGameTable(); void closeGameTable();
void startVoteOnKick(unsigned playerId, unsigned voteStarterPlayerId, int timeoutSec, int numVotesNeededToKick); void startVoteOnKick(unsigned playerId, unsigned voteStarterPlayerId, int timeoutSec, int numVotesNeededToKick);
void changeVoteOnKickButtonsState(bool showHide); void changeVoteOnKickButtonsState(bool showHide);
void endVoteOnKick(); void endVoteOnKick();
void voteOnKickYes(); void voteOnKickYes();
void voteOnKickNo(); void voteOnKickNo();
void startVoteOnKickTimeout(); void startVoteOnKickTimeout();
void stopVoteOnKickTimeout(); void stopVoteOnKickTimeout();
void nextVoteOnKickTimeoutAnimationFrame(); void nextVoteOnKickTimeoutAnimationFrame();
void refreshVotesMonitor(int currentVotes, int numVotesNeededToKick); void refreshVotesMonitor(int currentVotes, int numVotesNeededToKick);
void refreshGameTableStyle(); void refreshGameTableStyle();
void saveGameTableGeometry(); void saveGameTableGeometry();
void restoreGameTableGeometry(); void restoreGameTableGeometry();
void netClientPlayerLeft(unsigned playerId);
void registeredUserMode();
void guestUserMode();
void netClientPlayerLeft(unsigned playerId);
private: private:
boost::shared_ptr<GuiInterface> myServerGuiInterface; boost::shared_ptr<GuiInterface> myServerGuiInterface;
Log *myLog; Log *myLog;
ChatTools *myChat; ChatTools *myChat;
ConfigFile *myConfig; ConfigFile *myConfig;
//Timer //Timer
QTimer *potDistributeTimer; QTimer *potDistributeTimer;
QTimer *timer; QTimer *timer;
QTimer *dealFlopCards0Timer; QTimer *dealFlopCards0Timer;
QTimer *dealFlopCards1Timer; QTimer *dealFlopCards1Timer;
QTimer *dealFlopCards2Timer; QTimer *dealFlopCards2Timer;
QTimer *dealFlopCards3Timer; QTimer *dealFlopCards3Timer;
QTimer *dealFlopCards4Timer; QTimer *dealFlopCards4Timer;
QTimer *dealFlopCards5Timer; QTimer *dealFlopCards5Timer;
QTimer *dealFlopCards6Timer; QTimer *dealFlopCards6Timer;
QTimer *dealTurnCards0Timer; QTimer *dealTurnCards0Timer;
QTimer *dealTurnCards1Timer; QTimer *dealTurnCards1Timer;
QTimer *dealTurnCards2Timer; QTimer *dealTurnCards2Timer;
QTimer *dealRiverCards0Timer; QTimer *dealRiverCards0Timer;
QTimer *dealRiverCards1Timer; QTimer *dealRiverCards1Timer;
QTimer *dealRiverCards2Timer; QTimer *dealRiverCards2Timer;
QTimer *nextPlayerAnimationTimer; QTimer *nextPlayerAnimationTimer;
QTimer *preflopAnimation1Timer; QTimer *preflopAnimation1Timer;
QTimer *preflopAnimation2Timer; QTimer *preflopAnimation2Timer;
QTimer *flopAnimation1Timer; QTimer *flopAnimation1Timer;
QTimer *flopAnimation2Timer; QTimer *flopAnimation2Timer;
QTimer *turnAnimation1Timer; QTimer *turnAnimation1Timer;
QTimer *turnAnimation2Timer; QTimer *turnAnimation2Timer;
QTimer *riverAnimation1Timer; QTimer *riverAnimation1Timer;
QTimer *riverAnimation2Timer; QTimer *riverAnimation2Timer;
QTimer *postRiverAnimation1Timer; QTimer *postRiverAnimation1Timer;
QTimer *postRiverRunAnimation1Timer; QTimer *postRiverRunAnimation1Timer;
QTimer *postRiverRunAnimation2Timer; QTimer *postRiverRunAnimation2Timer;
QTimer *postRiverRunAnimation2_flipHoleCards1Timer; QTimer *postRiverRunAnimation2_flipHoleCards1Timer;
QTimer *postRiverRunAnimation2_flipHoleCards2Timer; QTimer *postRiverRunAnimation2_flipHoleCards2Timer;
QTimer *postRiverRunAnimation3Timer; QTimer *postRiverRunAnimation3Timer;
QTimer *postRiverRunAnimation5Timer; QTimer *postRiverRunAnimation5Timer;
QTimer *postRiverRunAnimation6Timer; QTimer *postRiverRunAnimation6Timer;
QTimer *blinkingStartButtonAnimationTimer; QTimer *blinkingStartButtonAnimationTimer;
QTimer *voteOnKickTimeoutTimer; QTimer *voteOnKickTimeoutTimer;
boost::timers::portable::microsec_timer voteOnKickRealTimer; boost::timers::portable::microsec_timer voteOnKickRealTimer;
QWidget *userWidgetsArray[6]; QWidget *userWidgetsArray[6];
QLabel *buttonLabelArray[MAX_NUMBER_OF_PLAYERS]; QLabel *buttonLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *cashLabelArray[MAX_NUMBER_OF_PLAYERS]; QLabel *cashLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *cashTopLabelArray[MAX_NUMBER_OF_PLAYERS]; QLabel *cashTopLabelArray[MAX_NUMBER_OF_PLAYERS];
MySetLabel *setLabelArray[MAX_NUMBER_OF_PLAYERS]; MySetLabel *setLabelArray[MAX_NUMBER_OF_PLAYERS];
QLabel *actionLabelArray[MAX_NUMBER_OF_PLAYERS]; QLabel *actionLabelArray[MAX_NUMBER_OF_PLAYERS];
MyNameLabel *playerNameLabelArray[MAX_NUMBER_OF_PLAYERS]; MyNameLabel *playerNameLabelArray[MAX_NUMBER_OF_PLAYERS];
MyAvatarLabel *playerAvatarLabelArray[MAX_NUMBER_OF_PLAYERS]; MyAvatarLabel *playerAvatarLabelArray[MAX_NUMBER_OF_PLAYERS];
MyTimeoutLabel *timeoutLabelArray[MAX_NUMBER_OF_PLAYERS]; MyTimeoutLabel *timeoutLabelArray[MAX_NUMBER_OF_PLAYERS];
QGroupBox *groupBoxArray[MAX_NUMBER_OF_PLAYERS]; QGroupBox *groupBoxArray[MAX_NUMBER_OF_PLAYERS];
MyCardsPixmapLabel *boardCardsArray[5]; MyCardsPixmapLabel *boardCardsArray[5];
MyCardsPixmapLabel *holeCardsArray[MAX_NUMBER_OF_PLAYERS][2]; MyCardsPixmapLabel *holeCardsArray[MAX_NUMBER_OF_PLAYERS][2];
QPixmap *flipside; QPixmap *flipside;
// Dialogs // Dialogs
startWindowImpl *myStartWindow; startWindowImpl *myStartWindow;
//Sound //Sound
SDLPlayer *mySDLPlayer; SDLPlayer *mySDLPlayer;
QString myAppDataPath; QString myAppDataPath;
int distributePotAnimCounter; int distributePotAnimCounter;
int playingMode; int playingMode;
QString font2String; QString font2String;
QString font1String; QString font1String;
//Speed //Speed
int guiGameSpeed; int guiGameSpeed;
int gameSpeed; int gameSpeed;
int dealCardsSpeed; int dealCardsSpeed;
int preDealCardsSpeed; int preDealCardsSpeed;
int postDealCardsSpeed; int postDealCardsSpeed;
int AllInDealCardsSpeed; int AllInDealCardsSpeed;
int postRiverRunAnimationSpeed; int postRiverRunAnimationSpeed;
int winnerBlinkSpeed; int winnerBlinkSpeed;
int newRoundSpeed; int newRoundSpeed;
int nextPlayerSpeed1; int nextPlayerSpeed1;
int nextPlayerSpeed2; int nextPlayerSpeed2;
int nextPlayerSpeed3; int nextPlayerSpeed3;
int preflopNextPlayerSpeed; int preflopNextPlayerSpeed;
int nextOpponentSpeed; int nextOpponentSpeed;
bool myActionIsBet; bool myActionIsBet;
bool myActionIsRaise; bool myActionIsRaise;
bool pushButtonBetRaiseIsChecked; bool pushButtonBetRaiseIsChecked;
bool pushButtonCallCheckIsChecked; bool pushButtonCallCheckIsChecked;
bool pushButtonFoldIsChecked; bool pushButtonFoldIsChecked;
bool pushButtonAllInIsChecked; bool pushButtonAllInIsChecked;
bool myButtonsAreCheckable; bool myButtonsAreCheckable;
bool breakAfterCurrentHand; bool breakAfterCurrentHand;
bool currentGameOver; bool currentGameOver;
bool flipHolecardsAllInAlreadyDone; bool flipHolecardsAllInAlreadyDone;
bool betSliderChangedByInput; bool betSliderChangedByInput;
bool guestMode;
// statistic testing // statistic testing
int statisticArray[15]; int statisticArray[15];
QSemaphore guiUpdateSemaphore; QSemaphore guiUpdateSemaphore;
int keyUpDownChatCounter; int keyUpDownChatCounter;
int myLastPreActionBetValue; int myLastPreActionBetValue;
int voteOnKickTimeoutSecs; int voteOnKickTimeoutSecs;
unsigned playerAboutToBeKickedId; unsigned playerAboutToBeKickedId;
GameTableStyleReader *myGameTableStyle; GameTableStyleReader *myGameTableStyle;
CardDeckStyleReader *myCardDeckStyle; CardDeckStyleReader *myCardDeckStyle;
QString AllInString; QString AllInString;
QString RaiseString; QString RaiseString;
QString BetString; QString BetString;
QString CallString; QString CallString;
QString CheckString; QString CheckString;
QString FoldString; QString FoldString;
QString PotString; QString PotString;
QString TotalString; QString TotalString;
QString BetsString; QString BetsString;
QString GameString; QString GameString;
QString HandString; QString HandString;
QString PreflopString; QString PreflopString;
QString FlopString; QString FlopString;
QString TurnString; QString TurnString;
QString RiverString; QString RiverString;
friend class GuiWrapper; friend class GuiWrapper;
}; };
#endif #endif
+91 -38
View File
@@ -15,18 +15,23 @@
#include "session.h" #include "session.h"
#include "playerinterface.h" #include "playerinterface.h"
#include "game.h" #include "game.h"
#include "mymessagedialogimpl.h"
#include "chattools.h"
using namespace std; using namespace std;
MyAvatarLabel::MyAvatarLabel(QGroupBox* parent) MyAvatarLabel::MyAvatarLabel(QGroupBox* parent)
: QLabel(parent), voteRunning(FALSE), transparent(FALSE) : QLabel(parent), voteRunning(FALSE), transparent(FALSE)
{ {
myContextMenu = new QMenu; myContextMenu = new QMenu;
action_VoteForKick = new QAction(QIcon(":/gfx/list_remove_user.png"), tr("Start vote to kick this user"), myContextMenu); action_VoteForKick = new QAction(QIcon(":/gfx/list_remove_user.png"), tr("Start vote to kick this player"), myContextMenu);
myContextMenu->addAction(action_VoteForKick); myContextMenu->addAction(action_VoteForKick);
action_IgnorePlayer = new QAction(QIcon(":/gfx/im-ban-user.png"), tr("Ignore Player"), myContextMenu);
myContextMenu->addAction(action_IgnorePlayer);
connect( action_VoteForKick, SIGNAL ( triggered() ), this, SLOT ( sendTriggerVoteOnKickSignal() ) ); connect( action_VoteForKick, SIGNAL ( triggered() ), this, SLOT ( sendTriggerVoteOnKickSignal() ) );
connect( action_IgnorePlayer, SIGNAL ( triggered() ), this, SLOT ( putPlayerOnIgnoreList() ) );
} }
@@ -36,72 +41,120 @@ MyAvatarLabel::~MyAvatarLabel()
void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) { void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) {
assert(myW->getSession()->getCurrentGame()); assert(myW->getSession()->getCurrentGame());
if (myW->getSession()->isNetworkClientRunning()) { if (myW->getSession()->isNetworkClientRunning() && !myW->getGuestMode()) {
PlayerListIterator it = myW->getSession()->getCurrentGame()->getSeatsList()->begin(); PlayerListIterator it = myW->getSession()->getCurrentGame()->getSeatsList()->begin();
//only active players are allowed to start a vote //only active players are allowed to start a vote
if((*it)->getMyActiveStatus()) { if((*it)->getMyActiveStatus()) {
Game *currentGame = myW->getSession()->getCurrentGame(); Game *currentGame = myW->getSession()->getCurrentGame();
PlayerListConstIterator it_c; PlayerListConstIterator it_c;
int activePlayerCounter=0; int activePlayerCounter=0;
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) { for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
if((*it_c)->getMyActiveStatus()) activePlayerCounter++; if((*it_c)->getMyActiveStatus()) activePlayerCounter++;
} }
if(activePlayerCounter > 2 && !voteRunning ) setVoteOnKickContextMenuEnabled(TRUE); if(activePlayerCounter > 2 && !voteRunning ) setVoteOnKickContextMenuEnabled(TRUE);
else setVoteOnKickContextMenuEnabled(FALSE); else setVoteOnKickContextMenuEnabled(FALSE);
int i=0; action_IgnorePlayer->setEnabled(true);
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 int j=0;
if(myContextMenuEnabled && myId != 0 && myId == i && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER && ( (*it_c)->getMyActiveStatus() || (*it_c)->getMyStayOnTableStatus() ) ) for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
showContextMenu(event->globalPos());
i++; if(myId == j && myW->getSession()->getClientPlayerInfo((*it_c)->getMyUniqueID()).isGuest) {
} action_IgnorePlayer->setDisabled(true);
} }
j++;
}
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) { void MyAvatarLabel::showContextMenu(const QPoint &pos) {
myContextMenu->popup(pos); myContextMenu->popup(pos);
} }
void MyAvatarLabel::sendTriggerVoteOnKickSignal() void MyAvatarLabel::sendTriggerVoteOnKickSignal()
{ {
myW->triggerVoteOnKick(myId); myW->triggerVoteOnKick(myId);
} }
void MyAvatarLabel::setEnabledContextMenu(bool b) void MyAvatarLabel::setEnabledContextMenu(bool b)
{ {
myContextMenuEnabled = b; myContextMenuEnabled = b;
} }
void MyAvatarLabel::setVoteOnKickContextMenuEnabled(bool b) void MyAvatarLabel::setVoteOnKickContextMenuEnabled(bool b)
{ {
action_VoteForKick->setEnabled(b); action_VoteForKick->setEnabled(b);
} }
void MyAvatarLabel::setPixmap ( const QPixmap &pix, const bool trans) { void MyAvatarLabel::setPixmap ( const QPixmap &pix, const bool trans) {
myPixmap = pix.scaled(50,50, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); myPixmap = pix.scaled(50,50, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
transparent = trans; transparent = trans;
update(); update();
} }
void MyAvatarLabel::paintEvent(QPaintEvent*) { void MyAvatarLabel::paintEvent(QPaintEvent*) {
QPainter painter(this); QPainter painter(this);
if(transparent) if(transparent)
painter.setOpacity(0.4); painter.setOpacity(0.4);
else else
painter.setOpacity(1.0); painter.setOpacity(1.0);
painter.drawPixmap(0,0,myPixmap); painter.drawPixmap(0,0,myPixmap);
} }
bool MyAvatarLabel::playerIsOnIgnoreList(QString playerName) {
list<std::string> playerIgnoreList = myW->getMyConfig()->readConfigStringList("PlayerIgnoreList");
list<std::string>::iterator it1;
for(it1= playerIgnoreList.begin(); it1 != playerIgnoreList.end(); it1++) {
if(playerName == QString::fromUtf8(it1->c_str())) {
return true;
}
}
return false;
}
void MyAvatarLabel::putPlayerOnIgnoreList() {
QStringList list;
PlayerListConstIterator it_c;
for (it_c=myW->getSession()->getCurrentGame()->getSeatsList()->begin(); it_c!=myW->getSession()->getCurrentGame()->getSeatsList()->end(); it_c++) {
list << QString::fromUtf8((*it_c)->getMyName().c_str());
}
if(!playerIsOnIgnoreList(list.at(myId))) {
myMessageDialogImpl dialog(myW->getMyConfig(), this);
if(dialog.exec(4, tr("You will no longer recieve chat messages or game invitations from this user.<br>Do you really want to put player <b>%1</b> on ignore list?").arg(list.at(myId)), tr("PokerTH - Question"), QPixmap(":/gfx/im-ban-user_64.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, false ) == QDialog::Accepted) {
std::list<std::string> playerIgnoreList = myW->getMyConfig()->readConfigStringList("PlayerIgnoreList");
playerIgnoreList.push_back(list.at(myId).toUtf8().constData());
myW->getMyConfig()->writeConfigStringList("PlayerIgnoreList", playerIgnoreList);
myW->getMyConfig()->writeBuffer();
myW->getMyChat()->refreshIgnoreList();
}
}
}
+5 -2
View File
@@ -37,15 +37,18 @@ public slots:
void setEnabledContextMenu(bool); void setEnabledContextMenu(bool);
void setVoteOnKickContextMenuEnabled(bool); void setVoteOnKickContextMenuEnabled(bool);
void setVoteRunning ( bool theValue ) { voteRunning = theValue; } void setVoteRunning ( bool theValue ) { voteRunning = theValue; }
void setPixmap ( const QPixmap &, const bool = FALSE); void setPixmap ( const QPixmap &, const bool = FALSE);
void paintEvent(QPaintEvent*); void paintEvent(QPaintEvent*);
void putPlayerOnIgnoreList();
bool playerIsOnIgnoreList(QString playerName);
private: private:
gameTableImpl *myW; gameTableImpl *myW;
QMenu *myContextMenu; QMenu *myContextMenu;
QAction *action_VoteForKick; QAction *action_VoteForKick;
QAction *action_IgnorePlayer;
QPixmap myPixmap; QPixmap myPixmap;
int myId; int myId;