GUI: send busy message if invite dialog is currently shown

This commit is contained in:
doitux
2010-03-30 12:12:22 +00:00
parent 499c2b72e6
commit adaec3d8cd
2 changed files with 15 additions and 5 deletions
@@ -22,7 +22,7 @@
#include "mymessagedialogimpl.h"
gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
: QDialog(parent), myW(NULL), myStartWindow(parent), myConfig(c), currentGameName(""), myPlayerId(0), myCurrentGameId(0), isGameAdministrator(false), inGame(false), guestMode(false), blinkingButtonAnimationState(true), myChat(NULL), keyUpCounter(0), infoMsgToShowId(0), currentInvitationGameId(0)
: QDialog(parent), myW(NULL), myStartWindow(parent), myConfig(c), currentGameName(""), myPlayerId(0), myCurrentGameId(0), isGameAdministrator(false), inGame(false), guestMode(false), blinkingButtonAnimationState(true), myChat(NULL), keyUpCounter(0), infoMsgToShowId(0), currentInvitationGameId(0), inviteDialogIsCurrentlyShown(false)
{
#ifdef __APPLE__
@@ -1344,14 +1344,23 @@ void gameLobbyDialogImpl::showInfoMsgBox()
void gameLobbyDialogImpl::showInvitationDialog(unsigned gameId, unsigned playerIdFrom)
{
if(!inviteDialogIsCurrentlyShown) {
myMessageDialogImpl dialog(myConfig, this);
if(dialog.exec(3, tr("You've been invited to the game <b>%1</b> by <b>%2</b>.<br>Do you want to join this game?").arg(QString::fromUtf8(mySession->getClientGameInfo(gameId).name.c_str())).arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerIdFrom).playerName.c_str())), tr("PokerTH - Info Message"), QPixmap(":/gfx/list_add_user_64.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, false)) {
inviteDialogIsCurrentlyShown = true;
mySession->acceptGameInvitation(currentInvitationGameId);
myMessageDialogImpl dialog(myConfig, this);
if(dialog.exec(3, tr("You've been invited to the game <b>%1</b> by <b>%2</b>.<br>Do you want to join this game?").arg(QString::fromUtf8(mySession->getClientGameInfo(gameId).name.c_str())).arg(QString::fromUtf8(mySession->getClientPlayerInfo(playerIdFrom).playerName.c_str())), tr("PokerTH - Info Message"), QPixmap(":/gfx/list_add_user_64.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, false)) {
mySession->acceptGameInvitation(currentInvitationGameId);
inviteDialogIsCurrentlyShown = false;
}
else {
mySession->rejectGameInvitation(currentInvitationGameId, DENY_GAME_INVITATION_NO);
inviteDialogIsCurrentlyShown = false;
}
}
else {
mySession->rejectGameInvitation(currentInvitationGameId, DENY_GAME_INVITATION_NO);
mySession->rejectGameInvitation(currentInvitationGameId, DENY_GAME_INVITATION_BUSY);
}
}
@@ -143,6 +143,7 @@ private:
QAction *ignorePlayerAction;
int infoMsgToShowId;
int currentInvitationGameId;
bool inviteDialogIsCurrentlyShown;
protected: