ingame chat is disbaled for guest, ignore context menu ingame
This commit is contained in:
@@ -3561,7 +3561,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1024</width>
|
||||
<height>27</height>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuView">
|
||||
|
||||
@@ -58,11 +58,11 @@
|
||||
using namespace std;
|
||||
|
||||
gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
||||
: QMainWindow(parent), myChat(NULL), myConfig(c), gameSpeed(0), myActionIsBet(0), myActionIsRaise(0), pushButtonBetRaiseIsChecked(FALSE), pushButtonCallCheckIsChecked(FALSE), pushButtonFoldIsChecked(FALSE), pushButtonAllInIsChecked(FALSE), myButtonsAreCheckable(FALSE), breakAfterCurrentHand(FALSE), currentGameOver(FALSE), betSliderChangedByInput(FALSE), myLastPreActionBetValue(0)
|
||||
: QMainWindow(parent), myChat(NULL), myConfig(c), gameSpeed(0), myActionIsBet(0), myActionIsRaise(0), pushButtonBetRaiseIsChecked(FALSE), pushButtonCallCheckIsChecked(FALSE), pushButtonFoldIsChecked(FALSE), pushButtonAllInIsChecked(FALSE), myButtonsAreCheckable(FALSE), breakAfterCurrentHand(FALSE), currentGameOver(FALSE), betSliderChangedByInput(FALSE), guestMode(FALSE), myLastPreActionBetValue(0)
|
||||
{
|
||||
int i;
|
||||
|
||||
// this->setStyle(new QPlastiqueStyle);
|
||||
// this->setStyle(new QPlastiqueStyle);
|
||||
|
||||
//for statistic development
|
||||
for(i=0; i<15; i++) {
|
||||
@@ -77,11 +77,11 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
||||
//Sound
|
||||
mySDLPlayer = new SDLPlayer(myConfig);
|
||||
|
||||
// Init game table style
|
||||
// Init game table style
|
||||
myGameTableStyle = new GameTableStyleReader(myConfig, this);
|
||||
myGameTableStyle->readStyleFile(QString::fromUtf8(myConfig->readConfigString("CurrentGameTableStyle").c_str()));
|
||||
|
||||
// Init card deck style
|
||||
// Init card deck style
|
||||
myCardDeckStyle = new CardDeckStyleReader(myConfig, this);
|
||||
myCardDeckStyle->readStyleFile(QString::fromUtf8(myConfig->readConfigString("CurrentCardDeckStyle").c_str()));
|
||||
|
||||
@@ -347,7 +347,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
||||
for (i=0; i<5; i++) { boardCardsArray[i]->raise(); }
|
||||
|
||||
//fix for away string bug in righttabwidget on windows
|
||||
#if (defined _WIN32) || (defined __APPLE__)
|
||||
#if (defined _WIN32) || (defined __APPLE__)
|
||||
tabWidget_Right->setTabText(0, " "+tabWidget_Right->tabText(0)+" ");
|
||||
tabWidget_Right->setTabText(1, " "+tabWidget_Right->tabText(1)+" ");
|
||||
tabWidget_Right->setTabText(2, " "+tabWidget_Right->tabText(2)+" ");
|
||||
@@ -374,20 +374,20 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
|
||||
this->setFocus();
|
||||
|
||||
//windowicon
|
||||
// QString windowIconString();
|
||||
// QString windowIconString();
|
||||
this->setWindowIcon(QIcon(myAppDataPath+"gfx/gui/misc/windowicon.png"));
|
||||
|
||||
//Statusbar
|
||||
if(myConfig->readConfigInt("ShowStatusbarMessages")) {
|
||||
|
||||
#ifdef __APPLE__
|
||||
// statusBar()->showMessage(tr("Cmd+N to start a new game"));
|
||||
// statusBar()->showMessage(tr("Cmd+N to start a new game"));
|
||||
#else
|
||||
// statusBar()->showMessage(tr("Ctrl+N to start a new game"));
|
||||
// statusBar()->showMessage(tr("Ctrl+N to start a new game"));
|
||||
#endif
|
||||
}
|
||||
|
||||
// Dialogs
|
||||
// Dialogs
|
||||
myChat = new ChatTools(lineEdit_ChatInput, myConfig, INGAME_CHAT, textBrowser_Chat);
|
||||
myChat->setMyStyle(myGameTableStyle);
|
||||
|
||||
@@ -630,7 +630,7 @@ void gameTableImpl::applySettings(settingsDialogImpl* mySettingsDialog) {
|
||||
|
||||
//Check for anti-peek mode
|
||||
if(myStartWindow->getSession()->getCurrentGame()) {
|
||||
// check if human player is already active
|
||||
// check if human player is already active
|
||||
if(myStartWindow->getSession()->getCurrentGame()->getSeatsList()->front()->getMyActiveStatus()) {
|
||||
|
||||
QPixmap tempCardsPixmapArray[2];
|
||||
@@ -1298,7 +1298,7 @@ void gameTableImpl::dealRiverCards1() {
|
||||
|
||||
boardCardsArray[4]->setPixmap(*flipside, TRUE);
|
||||
|
||||
// QTimer::singleShot(dealCardsSpeed, this, SLOT( dealRiverCards2() ));
|
||||
// QTimer::singleShot(dealCardsSpeed, this, SLOT( dealRiverCards2() ));
|
||||
dealRiverCards1Timer->start(dealCardsSpeed);
|
||||
}
|
||||
|
||||
@@ -1424,7 +1424,7 @@ void gameTableImpl::provideMyActions(int mode) {
|
||||
//if text changed on checked button --> uncheck to prevent unwanted actions
|
||||
if((pushButtonCallCheckString != lastPushButtonCallCheckString && pushButton_CallCheck->isChecked())) {
|
||||
|
||||
// cout << "jo" << endl;
|
||||
// cout << "jo" << endl;
|
||||
uncheckMyButtons();
|
||||
resetMyButtonsCheckStateMemory();
|
||||
}
|
||||
@@ -1441,7 +1441,7 @@ void gameTableImpl::provideMyActions(int mode) {
|
||||
pushButton_AllIn->setText(pushButtonAllInString);
|
||||
|
||||
refreshActionButtonFKeyIndicator();
|
||||
// myBetRaise();
|
||||
// myBetRaise();
|
||||
|
||||
if(pushButton_BetRaise->text().startsWith(RaiseString)) {
|
||||
|
||||
@@ -1503,9 +1503,9 @@ void gameTableImpl::meInAction() {
|
||||
|
||||
if(myConfig->readConfigInt("ShowStatusbarMessages")) {
|
||||
if ( myConfig->readConfigInt("AlternateFKeysUserActionMode") == 0 ) {
|
||||
// // statusBar()->showMessage(tr("F1 - Fold | F2 - Check/Call | F3 - Bet/Raise | F4 - All-In"), 15000);
|
||||
// // statusBar()->showMessage(tr("F1 - Fold | F2 - Check/Call | F3 - Bet/Raise | F4 - All-In"), 15000);
|
||||
} else {
|
||||
// statusBar()->showMessage(tr("F1 - All-In | F2 - Bet/Raise | F3 - Check/Call | F4 - Fold"), 15000);
|
||||
// statusBar()->showMessage(tr("F1 - All-In | F2 - Bet/Raise | F3 - Check/Call | F4 - Fold"), 15000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1596,7 +1596,7 @@ void gameTableImpl::myFold(){
|
||||
//set that i was the last active player. need this for unhighlighting groupbox
|
||||
currentHand->setLastPlayersTurn(0);
|
||||
|
||||
// statusBar()->clearMessage();
|
||||
// statusBar()->clearMessage();
|
||||
|
||||
//Spiel läuft weiter
|
||||
myActionDone();
|
||||
@@ -1612,7 +1612,7 @@ void gameTableImpl::myCheck() {
|
||||
//set that i was the last active player. need this for unhighlighting groupbox
|
||||
currentHand->setLastPlayersTurn(0);
|
||||
|
||||
// statusBar()->clearMessage();
|
||||
// statusBar()->clearMessage();
|
||||
|
||||
//Spiel läuft weiter
|
||||
myActionDone();
|
||||
@@ -1681,7 +1681,7 @@ void gameTableImpl::myCall(){
|
||||
//set that i was the last active player. need this for unhighlighting groupbox
|
||||
currentHand->setLastPlayersTurn(0);
|
||||
|
||||
// statusBar()->clearMessage();
|
||||
// statusBar()->clearMessage();
|
||||
|
||||
//Spiel läuft weiter
|
||||
myActionDone();
|
||||
@@ -1694,7 +1694,7 @@ void gameTableImpl::mySet(){
|
||||
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
|
||||
int tempCash = currentHand->getSeatsList()->front()->getMyCash();
|
||||
|
||||
// cout << "Set-Value " << getBetRaisePushButtonValue() << endl;
|
||||
// cout << "Set-Value " << getBetRaisePushButtonValue() << endl;
|
||||
currentHand->getSeatsList()->front()->setMySet(getBetRaisePushButtonValue());
|
||||
|
||||
if (getBetRaisePushButtonValue() >= tempCash ) {
|
||||
@@ -1736,7 +1736,7 @@ void gameTableImpl::mySet(){
|
||||
currentHand->getBoard()->collectSets();
|
||||
refreshPot();
|
||||
|
||||
// statusBar()->clearMessage();
|
||||
// statusBar()->clearMessage();
|
||||
|
||||
//set that i was the last active player. need this for unhighlighting groupbox
|
||||
currentHand->setLastPlayersTurn(0);
|
||||
@@ -1799,7 +1799,7 @@ void gameTableImpl::pushButtonBetRaiseClicked(bool checked) {
|
||||
if(!radioButton_manualAction->isChecked())
|
||||
radioButton_manualAction->click();
|
||||
|
||||
// myLastPreActionBetValue = lineEdit_betValue->value();
|
||||
// myLastPreActionBetValue = lineEdit_betValue->value();
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -2000,11 +2000,11 @@ void gameTableImpl::postRiverRunAnimation2() {
|
||||
|
||||
if(!flipHolecardsAllInAlreadyDone) {
|
||||
|
||||
//TODO - Turn cards like in the rules
|
||||
//TODO - Turn cards like in the rules
|
||||
|
||||
// postRiverRunAnimation2_flipHoleCards1Timer->start(nextPlayerSpeed2);
|
||||
// postRiverRunAnimation2_flipHoleCards1Timer->start(nextPlayerSpeed2);
|
||||
|
||||
// //Config? mit oder ohne Eye-Candy?
|
||||
// //Config? mit oder ohne Eye-Candy?
|
||||
if(myConfig->readConfigInt("ShowFlipCardsAnimation")) {
|
||||
// mit Eye-Candy
|
||||
|
||||
@@ -2058,7 +2058,7 @@ void gameTableImpl::postRiverRunAnimation2() {
|
||||
}
|
||||
else {
|
||||
int tempCardsIntArray[2];
|
||||
// int i;
|
||||
// int i;
|
||||
for (it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
(*it_c)->getMyCards(tempCardsIntArray);
|
||||
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD) {
|
||||
@@ -2087,12 +2087,12 @@ void gameTableImpl::postRiverRunAnimation2_flipHoleCards1() {
|
||||
|
||||
void gameTableImpl::postRiverRunAnimation2_flipHoleCards2() {
|
||||
|
||||
// if() {
|
||||
// postRiverRunAnimation2_flipHoleCards1Timer->start(nextPlayerSpeed2);
|
||||
// }
|
||||
// else {
|
||||
// postRiverRunAnimation2Timer->start(postRiverRunAnimationSpeed);
|
||||
// }
|
||||
// if() {
|
||||
// postRiverRunAnimation2_flipHoleCards1Timer->start(nextPlayerSpeed2);
|
||||
// }
|
||||
// else {
|
||||
// postRiverRunAnimation2Timer->start(postRiverRunAnimationSpeed);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -2117,9 +2117,9 @@ void gameTableImpl::postRiverRunAnimation3() {
|
||||
for(it_c=currentHand->getActivePlayerList()->begin(); it_c!=currentHand->getActivePlayerList()->end(); it_c++) {
|
||||
if((*it_c)->getMyAction() != PLAYER_ACTION_FOLD && (*it_c)->getMyCardsValueInt() == currentHand->getCurrentBeRo()->getHighestCardsValue() ) {
|
||||
|
||||
// QPalette tempPalette = groupBoxArray[i]->palette();
|
||||
// tempPalette.setColor(QPalette::Window, highlight);
|
||||
// groupBoxArray[i]->setPalette(tempPalette);
|
||||
// QPalette tempPalette = groupBoxArray[i]->palette();
|
||||
// tempPalette.setColor(QPalette::Window, highlight);
|
||||
// groupBoxArray[i]->setPalette(tempPalette);
|
||||
actionLabelArray[(*it_c)->getMyID()]->setPixmap(QPixmap::fromImage(QImage(myGameTableStyle->getActionPic(7))));
|
||||
|
||||
//show winnercards if more than one player is active TODO
|
||||
@@ -2129,9 +2129,9 @@ void gameTableImpl::postRiverRunAnimation3() {
|
||||
int bestHandPos[5];
|
||||
(*it_c)->getMyBestHandPosition(bestHandPos);
|
||||
|
||||
// for(j=0; j<5; j++) {
|
||||
// cout << bestHandPos[j] << endl;
|
||||
// }
|
||||
// for(j=0; j<5; j++) {
|
||||
// cout << bestHandPos[j] << endl;
|
||||
// }
|
||||
|
||||
//index 0 testen --> Karte darf nicht im MyBestHand Position Array drin sein, es darf nicht nur ein Spieler Aktiv sein, die Config fordert die Animation
|
||||
bool index0 = TRUE;
|
||||
@@ -2180,15 +2180,15 @@ void gameTableImpl::postRiverRunAnimation3() {
|
||||
//Pro Spieler den Cash aus dem Player und dem Label auslesen. Player_cash - Label_cash = Gewinnsumme
|
||||
int pot = (*it_c)->getLastMoneyWon();
|
||||
//Wenn River dann auch das Blatt loggen!
|
||||
// if (textLabel_handLabel->text() == "River") {
|
||||
// if (textLabel_handLabel->text() == "River") {
|
||||
|
||||
//set Player value (logging)
|
||||
(*it_c)->setMyWinnerState(true, pot);
|
||||
|
||||
// }
|
||||
// else {
|
||||
// myLog->logPlayerWinsMsg(i, pot);
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// myLog->logPlayerWinsMsg(i, pot);
|
||||
// }
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -2273,7 +2273,7 @@ void gameTableImpl::postRiverRunAnimation5() {
|
||||
|
||||
void gameTableImpl::postRiverRunAnimation6() {
|
||||
|
||||
// int i;
|
||||
// int i;
|
||||
HandInterface *currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand();
|
||||
|
||||
refreshCash();
|
||||
@@ -2484,7 +2484,7 @@ void gameTableImpl::nextRoundCleanGui() {
|
||||
pushButton_break->setText(tr("Stop"));
|
||||
}
|
||||
//Clear Statusbarmessage
|
||||
// statusBar()->clearMessage();
|
||||
// statusBar()->clearMessage();
|
||||
|
||||
//fix press mouse button during bankrupt with anti-peek-mode
|
||||
this->mouseOverFlipCards(FALSE);
|
||||
@@ -2582,7 +2582,7 @@ void gameTableImpl::breakButtonClicked() {
|
||||
|
||||
void gameTableImpl::keyPressEvent ( QKeyEvent * event ) {
|
||||
|
||||
// cout << event->key() << endl;
|
||||
// cout << event->key() << endl;
|
||||
|
||||
bool ctrlPressed = FALSE;
|
||||
|
||||
@@ -2634,12 +2634,12 @@ void gameTableImpl::keyPressEvent ( QKeyEvent * event ) {
|
||||
}
|
||||
if (event->key() == Qt::Key_Up && lineEdit_ChatInput->hasFocus()) {
|
||||
if((keyUpDownChatCounter + 1) <= myChat->getChatLinesHistorySize()) { keyUpDownChatCounter++; }
|
||||
// std::cout << "Up keyUpDownChatCounter: " << keyUpDownChatCounter << "\n";
|
||||
// std::cout << "Up keyUpDownChatCounter: " << keyUpDownChatCounter << "\n";
|
||||
myChat->showChatHistoryIndex(keyUpDownChatCounter);
|
||||
}
|
||||
else if(event->key() == Qt::Key_Down && lineEdit_ChatInput->hasFocus()) {
|
||||
if((keyUpDownChatCounter - 1) >= 0) { keyUpDownChatCounter--; }
|
||||
// std::cout << "Down keyUpDownChatCounter: " << keyUpDownChatCounter << "\n";
|
||||
// std::cout << "Down keyUpDownChatCounter: " << keyUpDownChatCounter << "\n";
|
||||
myChat->showChatHistoryIndex(keyUpDownChatCounter);
|
||||
}
|
||||
else { keyUpDownChatCounter = 0; }
|
||||
@@ -2659,11 +2659,11 @@ void gameTableImpl::changePlayingMode() {
|
||||
|
||||
switch (mode) {
|
||||
|
||||
// case 0: { statusBar()->showMessage(tr("Manual mode set. You've got to choose yourself now."), 5000); }
|
||||
// case 0: { statusBar()->showMessage(tr("Manual mode set. You've got to choose yourself now."), 5000); }
|
||||
break;
|
||||
// case 1: { statusBar()->showMessage(tr("Auto mode set: Check or call any."), 5000); }
|
||||
// case 1: { statusBar()->showMessage(tr("Auto mode set: Check or call any."), 5000); }
|
||||
break;
|
||||
// case 2: { statusBar()->showMessage(tr("Auto mode set: Check or fold."), 5000); }
|
||||
// case 2: { statusBar()->showMessage(tr("Auto mode set: Check or fold."), 5000); }
|
||||
break;
|
||||
default: { /*cout << "changePlayingMode ERROR!!!!" << endl;*/ }
|
||||
|
||||
@@ -2867,6 +2867,12 @@ void gameTableImpl::networkGameModification() {
|
||||
|
||||
//restore saved windows geometry
|
||||
restoreGameTableGeometry();
|
||||
|
||||
if(myStartWindow->getSession()->getClientPlayerInfo(myStartWindow->getSession()->getClientUniquePlayerId()).isGuest) {
|
||||
guestUserMode();
|
||||
}
|
||||
else { registeredUserMode(); }
|
||||
|
||||
}
|
||||
|
||||
void gameTableImpl::mouseOverFlipCards(bool front) {
|
||||
@@ -3065,7 +3071,7 @@ void gameTableImpl::leaveCurrentNetworkGame() {
|
||||
if (myStartWindow->getSession()->isNetworkClientRunning()) {
|
||||
|
||||
|
||||
// T O D O !!!!!!! anzeigen? aus myMessageDialog auslesen per Config!!!!!!! T O D O
|
||||
// T O D O !!!!!!! anzeigen? aus myMessageDialog auslesen per Config!!!!!!! T O D O
|
||||
|
||||
myMessageDialogImpl dialog(myConfig, this);
|
||||
|
||||
@@ -3301,7 +3307,7 @@ void gameTableImpl::refreshGameTableStyle()
|
||||
myGameTableStyle->setSliderStyle(horizontalSlider_bet);
|
||||
myGameTableStyle->setSliderStyle(horizontalSlider_speed);
|
||||
|
||||
// away radiobuttons
|
||||
// away radiobuttons
|
||||
myGameTableStyle->setAwayRadioButtonsStyle(radioButton_manualAction);
|
||||
myGameTableStyle->setAwayRadioButtonsStyle(radioButton_autoCheckFold);
|
||||
myGameTableStyle->setAwayRadioButtonsStyle(radioButton_autoCheckCallAny);
|
||||
@@ -3392,3 +3398,18 @@ void gameTableImpl::netClientPlayerLeft(unsigned playerId) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void gameTableImpl::registeredUserMode()
|
||||
{
|
||||
lineEdit_ChatInput->clear();
|
||||
lineEdit_ChatInput->setEnabled(true);
|
||||
guestMode = false;
|
||||
}
|
||||
|
||||
|
||||
void gameTableImpl::guestUserMode()
|
||||
{
|
||||
lineEdit_ChatInput->setText("Chat is avaiable only for registered members");
|
||||
lineEdit_ChatInput->setDisabled(true);
|
||||
guestMode = true;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class CardDeckStyleReader;
|
||||
class SDLPlayer;
|
||||
|
||||
class gameTableImpl: public QMainWindow, public Ui::gameTable {
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
gameTableImpl(ConfigFile *c = 0, QMainWindow *parent = 0);
|
||||
@@ -59,14 +59,14 @@ public:
|
||||
~gameTableImpl();
|
||||
|
||||
boost::shared_ptr<Session> getSession();
|
||||
void setStartWindow(startWindowImpl* s) { myStartWindow = s; }
|
||||
|
||||
void setLog(Log* l) { myLog = l; }
|
||||
|
||||
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 setStartWindow(startWindowImpl* s) { myStartWindow = s; }
|
||||
void setLog(Log* l) { myLog = l; }
|
||||
|
||||
void setSpeeds();
|
||||
|
||||
@@ -303,6 +303,9 @@ public slots:
|
||||
void restoreGameTableGeometry();
|
||||
|
||||
void netClientPlayerLeft(unsigned playerId);
|
||||
void registeredUserMode();
|
||||
void guestUserMode();
|
||||
|
||||
private:
|
||||
|
||||
boost::shared_ptr<GuiInterface> myServerGuiInterface;
|
||||
@@ -366,7 +369,7 @@ private:
|
||||
|
||||
QPixmap *flipside;
|
||||
|
||||
// Dialogs
|
||||
// Dialogs
|
||||
startWindowImpl *myStartWindow;
|
||||
|
||||
//Sound
|
||||
@@ -406,6 +409,7 @@ private:
|
||||
bool currentGameOver;
|
||||
bool flipHolecardsAllInAlreadyDone;
|
||||
bool betSliderChangedByInput;
|
||||
bool guestMode;
|
||||
|
||||
// statistic testing
|
||||
int statisticArray[15];
|
||||
@@ -437,7 +441,7 @@ private:
|
||||
QString TurnString;
|
||||
QString RiverString;
|
||||
|
||||
friend class GuiWrapper;
|
||||
friend class GuiWrapper;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "session.h"
|
||||
#include "playerinterface.h"
|
||||
#include "game.h"
|
||||
#include "mymessagedialogimpl.h"
|
||||
#include "chattools.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -23,10 +25,13 @@ MyAvatarLabel::MyAvatarLabel(QGroupBox* parent)
|
||||
{
|
||||
|
||||
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);
|
||||
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_IgnorePlayer, SIGNAL ( triggered() ), this, SLOT ( putPlayerOnIgnoreList() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +42,7 @@ MyAvatarLabel::~MyAvatarLabel()
|
||||
void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) {
|
||||
|
||||
assert(myW->getSession()->getCurrentGame());
|
||||
if (myW->getSession()->isNetworkClientRunning()) {
|
||||
if (myW->getSession()->isNetworkClientRunning() && !myW->getGuestMode()) {
|
||||
|
||||
PlayerListIterator it = myW->getSession()->getCurrentGame()->getSeatsList()->begin();
|
||||
//only active players are allowed to start a vote
|
||||
@@ -53,6 +58,17 @@ void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) {
|
||||
if(activePlayerCounter > 2 && !voteRunning ) setVoteOnKickContextMenuEnabled(TRUE);
|
||||
else setVoteOnKickContextMenuEnabled(FALSE);
|
||||
|
||||
action_IgnorePlayer->setEnabled(true);
|
||||
|
||||
int j=0;
|
||||
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) {
|
||||
|
||||
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++) {
|
||||
|
||||
@@ -105,3 +121,40 @@ void MyAvatarLabel::paintEvent(QPaintEvent*) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,15 +37,18 @@ public slots:
|
||||
void setEnabledContextMenu(bool);
|
||||
void setVoteOnKickContextMenuEnabled(bool);
|
||||
void setVoteRunning ( bool theValue ) { voteRunning = theValue; }
|
||||
|
||||
void setPixmap ( const QPixmap &, const bool = FALSE);
|
||||
|
||||
void paintEvent(QPaintEvent*);
|
||||
void putPlayerOnIgnoreList();
|
||||
bool playerIsOnIgnoreList(QString playerName);
|
||||
|
||||
private:
|
||||
|
||||
gameTableImpl *myW;
|
||||
QMenu *myContextMenu;
|
||||
QAction *action_VoteForKick;
|
||||
QAction *action_IgnorePlayer;
|
||||
|
||||
QPixmap myPixmap;
|
||||
|
||||
int myId;
|
||||
|
||||
Reference in New Issue
Block a user