guest avatar bugfix

This commit is contained in:
doitux
2011-01-03 21:55:35 +00:00
parent 493081a764
commit 0da77fd0ed
+32 -26
View File
@@ -29,7 +29,7 @@ MyAvatarLabel::MyAvatarLabel(QGroupBox* parent)
myContextMenu->addAction(action_VoteForKick); myContextMenu->addAction(action_VoteForKick);
action_IgnorePlayer = new QAction(QIcon(":/gfx/im-ban-user.png"), tr("Ignore Player"), myContextMenu); action_IgnorePlayer = new QAction(QIcon(":/gfx/im-ban-user.png"), tr("Ignore Player"), myContextMenu);
myContextMenu->addAction(action_IgnorePlayer); myContextMenu->addAction(action_IgnorePlayer);
action_ReportBadAvatar = new QAction(QIcon(":/gfx/emblem-important.png"), tr("Report bad Avatar"), myContextMenu); action_ReportBadAvatar = new QAction(QIcon(":/gfx/emblem-important.png"), tr("Report inappropriate avatar"), myContextMenu);
myContextMenu->addAction(action_ReportBadAvatar); myContextMenu->addAction(action_ReportBadAvatar);
@@ -52,34 +52,36 @@ void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) {
//only active players are allowed to start a vote //only active players are allowed to start a vote
if((*it)->getMyActiveStatus()) { if((*it)->getMyActiveStatus()) {
if(myW->getGuestMode()) { // if(myW->getGuestMode()) {
//excpetions for client is logged in as guest //excpetions for client is logged in as guest
Game *currentGame = myW->getSession()->getCurrentGame(); //TODO diese RIESENSAUEREI aufräumen!!!
PlayerListConstIterator it_c;
int activePlayerCounter=0;
setVoteOnKickContextMenuEnabled(FALSE); // Game *currentGame = myW->getSession()->getCurrentGame();
action_IgnorePlayer->setEnabled(FALSE); // PlayerListConstIterator it_c;
// int activePlayerCounter=0;
if(myW->getSession()->getGameType() == Session::GAME_TYPE_INTERNET) { // setVoteOnKickContextMenuEnabled(FALSE);
action_ReportBadAvatar->setVisible(TRUE); // action_IgnorePlayer->setEnabled(FALSE);
}
else {
action_ReportBadAvatar->setVisible(FALSE);
}
int i=0; // if(myW->getSession()->getGameType() == Session::GAME_TYPE_INTERNET) {
for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) { // action_ReportBadAvatar->setVisible(TRUE);
// }
// else {
// action_ReportBadAvatar->setVisible(FALSE);
// }
//also inactive player which stays on table can be voted to kick // int i=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++; // //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() ) && !(QString::fromUtf8((*it_c)->getMyAvatar().c_str()).isEmpty()) )
} // showContextMenu(event->globalPos());
else {
// i++;
// }
// }
// else {
//normal player mode in internet game //normal player mode in internet game
Game *currentGame = myW->getSession()->getCurrentGame(); Game *currentGame = myW->getSession()->getCurrentGame();
@@ -91,8 +93,12 @@ void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) {
} }
GameInfo info(myW->getSession()->getClientGameInfo(myW->getSession()->getClientCurrentGameId())); GameInfo info(myW->getSession()->getClientGameInfo(myW->getSession()->getClientCurrentGameId()));
if(activePlayerCounter > 2 && !voteRunning && info.data.gameType != GAME_TYPE_RANKING) setVoteOnKickContextMenuEnabled(TRUE); if(activePlayerCounter > 2 && !voteRunning && info.data.gameType != GAME_TYPE_RANKING && !myW->getGuestMode()) {
else setVoteOnKickContextMenuEnabled(FALSE); setVoteOnKickContextMenuEnabled(TRUE);
}
else {
setVoteOnKickContextMenuEnabled(FALSE);
}
action_IgnorePlayer->setEnabled(true); action_IgnorePlayer->setEnabled(true);
@@ -116,13 +122,13 @@ void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) {
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++) {
//also inactive player which stays on table can be voted to kick //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() ) ) if(myContextMenuEnabled && myId != 0 && myId == i && (*it_c)->getMyType() != PLAYER_TYPE_COMPUTER && ( (*it_c)->getMyActiveStatus() || (*it_c)->getMyStayOnTableStatus() ) && !(QString::fromUtf8((*it_c)->getMyAvatar().c_str()).isEmpty()) )
showContextMenu(event->globalPos()); showContextMenu(event->globalPos());
i++; i++;
} }
}
} }
} }
} }