add special rejoin dialog for waiting game msg box

This commit is contained in:
doitux
2011-10-27 09:04:19 +00:00
parent 7f13da91e5
commit aaeef120a7
3 changed files with 31 additions and 7 deletions
@@ -52,6 +52,16 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c)
#endif #endif
waitStartGameMsgBox->setStandardButtons(QMessageBox::NoButton); waitStartGameMsgBox->setStandardButtons(QMessageBox::NoButton);
//wait start game message for rejoin
waitRejoinStartGameMsgBox = new QMessageBox(this);
waitRejoinStartGameMsgBox->setText(tr("Reconnection done! Now we are waiting for the next hand to rejoin the game ..."));
waitRejoinStartGameMsgBox->setWindowModality(Qt::NonModal);
#ifdef __APPLE__
waitRejoinStartGameMsgBox->setWindowFlags(Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::Dialog);
#endif
waitRejoinStartGameMsgBox->setStandardButtons(QMessageBox::NoButton);
waitStartGameMsgBoxTimer = new QTimer(this); waitStartGameMsgBoxTimer = new QTimer(this);
waitStartGameMsgBoxTimer->setSingleShot(TRUE); waitStartGameMsgBoxTimer->setSingleShot(TRUE);
blinkingButtonAnimationTimer = new QTimer(this); blinkingButtonAnimationTimer = new QTimer(this);
@@ -192,6 +202,7 @@ void gameLobbyDialogImpl::exec()
waitStartGameMsgBoxTimer->stop(); waitStartGameMsgBoxTimer->stop();
waitStartGameMsgBox->hide(); waitStartGameMsgBox->hide();
waitRejoinStartGameMsgBox->hide();
} }
@@ -381,15 +392,23 @@ void gameLobbyDialogImpl::refresh(int actionID)
headerList2 << tr("Available Players"); headerList2 << tr("Available Players");
myNickListModel->setHorizontalHeaderLabels(headerList2); myNickListModel->setHorizontalHeaderLabels(headerList2);
//stop waitStartGameMsgBox //stop waitStartGameMsgBoxes
waitStartGameMsgBoxTimer->stop(); waitStartGameMsgBoxTimer->stop();
waitStartGameMsgBox->hide(); waitStartGameMsgBox->hide();
waitRejoinStartGameMsgBox->hide();
this->accept(); this->accept();
myW->show(); myW->show();
} else if(actionID == MSG_NET_GAME_CLIENT_SYNCSTART) { } else if(actionID == MSG_NET_GAME_CLIENT_SYNCSTART) {
waitStartGameMsgBoxTimer->start(2000); waitStartGameMsgBoxTimer->start(2000);
} else if(actionID == MSG_NET_GAME_CLIENT_SYNCREJOIN) {
if(this->isVisible()) {
waitRejoinStartGameMsgBox->show();
waitRejoinStartGameMsgBox->raise();
waitRejoinStartGameMsgBox->activateWindow();
}
} }
} }
@@ -1202,9 +1221,10 @@ void gameLobbyDialogImpl::leaveGame()
autoStartTimerOverlay->hide(); autoStartTimerOverlay->hide();
autoStartTimer->stop(); autoStartTimer->stop();
//stop waitStartGameMsgBox //stop waitStartGameMsgBoxes
waitStartGameMsgBoxTimer->stop(); waitStartGameMsgBoxTimer->stop();
waitStartGameMsgBox->hide(); waitStartGameMsgBox->hide();
waitRejoinStartGameMsgBox->hide();
} }
void gameLobbyDialogImpl::kickPlayer() void gameLobbyDialogImpl::kickPlayer()
@@ -1317,6 +1337,7 @@ void gameLobbyDialogImpl::showWaitStartGameMsgBox()
void gameLobbyDialogImpl::hideWaitStartGameMsgBox() void gameLobbyDialogImpl::hideWaitStartGameMsgBox()
{ {
waitStartGameMsgBox->hide(); waitStartGameMsgBox->hide();
waitRejoinStartGameMsgBox->hide();
} }
void gameLobbyDialogImpl::joinAnyGameButtonRefresh() void gameLobbyDialogImpl::joinAnyGameButtonRefresh()
@@ -1348,9 +1369,10 @@ void gameLobbyDialogImpl::reject()
void gameLobbyDialogImpl::closeEvent(QCloseEvent *event) void gameLobbyDialogImpl::closeEvent(QCloseEvent *event)
{ {
event->accept(); event->accept();
//stop waitStartGameMsgBox //stop waitStartGameMsgBoxes
waitStartGameMsgBoxTimer->stop(); waitStartGameMsgBoxTimer->stop();
waitStartGameMsgBox->hide(); waitStartGameMsgBox->hide();
waitRejoinStartGameMsgBox->hide();
} }
@@ -157,6 +157,7 @@ private:
QString myAppDataPath; QString myAppDataPath;
QMessageBox *waitStartGameMsgBox; QMessageBox *waitStartGameMsgBox;
QMessageBox *waitRejoinStartGameMsgBox;
QTimer *waitStartGameMsgBoxTimer; QTimer *waitStartGameMsgBoxTimer;
QTimer *blinkingButtonAnimationTimer; QTimer *blinkingButtonAnimationTimer;
QTimer *showInfoMsgBoxTimer; QTimer *showInfoMsgBoxTimer;
+5 -4
View File
@@ -371,14 +371,15 @@ void startWindowImpl::callInternetGameLoginDialog()
void startWindowImpl::callRejoinPossibleDialog(unsigned gameId) void startWindowImpl::callRejoinPossibleDialog(unsigned gameId)
{ {/*
// assert(mySession); assert(mySession);
// GameInfo info(mySession->getClientGameInfo(gameId)); GameInfo info(mySession->getClientGameInfo(gameId));*/
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Question); msgBox.setIcon(QMessageBox::Question);
msgBox.setWindowTitle("Rejoin possible!"); msgBox.setWindowTitle("Rejoin possible!");
msgBox.setText(QString("There is an existing session with the game: %1").arg("QString::fromUtf8(info.name.c_str())")); // msgBox.setText(QString("There is an existing session with the game: %1").arg(QString::fromUtf8(info.name.c_str())));
msgBox.setText("There is an existing session with a previous game.");
msgBox.setInformativeText("Do you want to rejoin this game?"); msgBox.setInformativeText("Do you want to rejoin this game?");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
msgBox.setDefaultButton(QMessageBox::Yes); msgBox.setDefaultButton(QMessageBox::Yes);