From aaeef120a7dbfc6d81c02c1b62db6764a15e60ae Mon Sep 17 00:00:00 2001 From: doitux Date: Thu, 27 Oct 2011 09:04:19 +0000 Subject: [PATCH] add special rejoin dialog for waiting game msg box --- .../gamelobbydialog/gamelobbydialogimpl.cpp | 28 +++++++++++++++++-- .../qt/gamelobbydialog/gamelobbydialogimpl.h | 1 + src/gui/qt/startwindow/startwindowimpl.cpp | 9 +++--- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp index 01d76767..510f2c08 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp @@ -52,6 +52,16 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(startWindowImpl *parent, ConfigFile *c) #endif 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->setSingleShot(TRUE); blinkingButtonAnimationTimer = new QTimer(this); @@ -192,6 +202,7 @@ void gameLobbyDialogImpl::exec() waitStartGameMsgBoxTimer->stop(); waitStartGameMsgBox->hide(); + waitRejoinStartGameMsgBox->hide(); } @@ -381,15 +392,23 @@ void gameLobbyDialogImpl::refresh(int actionID) headerList2 << tr("Available Players"); myNickListModel->setHorizontalHeaderLabels(headerList2); - //stop waitStartGameMsgBox + //stop waitStartGameMsgBoxes waitStartGameMsgBoxTimer->stop(); waitStartGameMsgBox->hide(); + waitRejoinStartGameMsgBox->hide(); this->accept(); myW->show(); } else if(actionID == MSG_NET_GAME_CLIENT_SYNCSTART) { 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(); autoStartTimer->stop(); - //stop waitStartGameMsgBox + //stop waitStartGameMsgBoxes waitStartGameMsgBoxTimer->stop(); waitStartGameMsgBox->hide(); + waitRejoinStartGameMsgBox->hide(); } void gameLobbyDialogImpl::kickPlayer() @@ -1317,6 +1337,7 @@ void gameLobbyDialogImpl::showWaitStartGameMsgBox() void gameLobbyDialogImpl::hideWaitStartGameMsgBox() { waitStartGameMsgBox->hide(); + waitRejoinStartGameMsgBox->hide(); } void gameLobbyDialogImpl::joinAnyGameButtonRefresh() @@ -1348,9 +1369,10 @@ void gameLobbyDialogImpl::reject() void gameLobbyDialogImpl::closeEvent(QCloseEvent *event) { event->accept(); - //stop waitStartGameMsgBox + //stop waitStartGameMsgBoxes waitStartGameMsgBoxTimer->stop(); waitStartGameMsgBox->hide(); + waitRejoinStartGameMsgBox->hide(); } diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h index 1bd444d6..fe1a69fa 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h @@ -157,6 +157,7 @@ private: QString myAppDataPath; QMessageBox *waitStartGameMsgBox; + QMessageBox *waitRejoinStartGameMsgBox; QTimer *waitStartGameMsgBoxTimer; QTimer *blinkingButtonAnimationTimer; QTimer *showInfoMsgBoxTimer; diff --git a/src/gui/qt/startwindow/startwindowimpl.cpp b/src/gui/qt/startwindow/startwindowimpl.cpp index 0cfa7252..ba1865ff 100644 --- a/src/gui/qt/startwindow/startwindowimpl.cpp +++ b/src/gui/qt/startwindow/startwindowimpl.cpp @@ -371,14 +371,15 @@ void startWindowImpl::callInternetGameLoginDialog() void startWindowImpl::callRejoinPossibleDialog(unsigned gameId) -{ -// assert(mySession); -// GameInfo info(mySession->getClientGameInfo(gameId)); +{/* + assert(mySession); + GameInfo info(mySession->getClientGameInfo(gameId));*/ QMessageBox msgBox; msgBox.setIcon(QMessageBox::Question); 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.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox.setDefaultButton(QMessageBox::Yes);