From 41b0186279eb63eec2d588bb7e5a40de2f7b270f Mon Sep 17 00:00:00 2001 From: doitux Date: Mon, 13 Dec 2010 18:16:01 +0000 Subject: [PATCH] bugfix for #0000022: Notification window kept open when game finishes --- src/gui/qt/gametable/gametableimpl.cpp | 24 ++++++++++++++-------- src/gui/qt/gametable/gametableimpl.h | 3 +++ src/gui/qt/startwindow/startwindowimpl.cpp | 1 + 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index b4f3195c..4a00bf7d 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -393,6 +393,12 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) //set WindowTitle dynamically this->setWindowTitle(QString(tr("PokerTH %1 - The Open-Source Texas Holdem Engine").arg(POKERTH_BETA_RELEASE_STRING))); + // create universal messageDialgo + myUniversalMessageDialog = new myMessageDialogImpl(myConfig, this); + myUniversalMessageDialog->setParent(this); + + + //Connects connect(dealFlopCards0Timer, SIGNAL(timeout()), this, SLOT( dealFlopCards1() )); connect(dealFlopCards1Timer, SIGNAL(timeout()), this, SLOT( dealFlopCards2() )); @@ -2975,9 +2981,9 @@ void gameTableImpl::closeGameTable() { else { bool close = true; - myMessageDialogImpl dialog(myConfig, this); - if(dialog.checkIfMesssageWillBeDisplayed(6) && (myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK ) && this->isVisible()) { - if (dialog.exec(6, tr("Really want to exit?"), tr("PokerTH - Close Table?"), QPixmap(":/gfx/logoChip3D.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, true) == QDialog::Rejected) { + + if(myUniversalMessageDialog->checkIfMesssageWillBeDisplayed(6) && (myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET || myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_NETWORK ) && this->isVisible()) { + if (myUniversalMessageDialog->exec(6, tr("Really want to exit?"), tr("PokerTH - Close Table?"), QPixmap(":/gfx/logoChip3D.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, true) == QDialog::Rejected) { close = false; } } @@ -3052,16 +3058,13 @@ void gameTableImpl::leaveCurrentNetworkGame() { if (myStartWindow->getSession()->isNetworkClientRunning()) { - myMessageDialogImpl dialog(myConfig, this); - dialog.setParent(this); - - if(!dialog.checkIfMesssageWillBeDisplayed(1)) { + if(!myUniversalMessageDialog->checkIfMesssageWillBeDisplayed(1)) { assert(myStartWindow->getSession()); myStartWindow->getSession()->sendLeaveCurrentGame(); } else { - if (dialog.exec(1, tr("Attention! Do you really want to leave the current game\nand go back to the lobby?"), tr("PokerTH - Internet Game Message"), QPixmap(":/gfx/logoChip3D.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, true) == QDialog::Accepted) { + if (myUniversalMessageDialog->exec(1, tr("Attention! Do you really want to leave the current game\nand go back to the lobby?"), tr("PokerTH - Internet Game Message"), QPixmap(":/gfx/logoChip3D.png"), QDialogButtonBox::Yes|QDialogButtonBox::No, true) == QDialog::Accepted) { assert(myStartWindow->getSession()); myStartWindow->getSession()->sendLeaveCurrentGame(); } @@ -3420,3 +3423,8 @@ void gameTableImpl::showWarningAutoFoldInRankingGame(unsigned remainingAutoFolds QMessageBox::Ok); tabWidget_Right->setCurrentIndex(1); } + +void gameTableImpl::closeMessageBoxes() { + + myUniversalMessageDialog->close(); +} diff --git a/src/gui/qt/gametable/gametableimpl.h b/src/gui/qt/gametable/gametableimpl.h index 861449cd..3bd0f997 100755 --- a/src/gui/qt/gametable/gametableimpl.h +++ b/src/gui/qt/gametable/gametableimpl.h @@ -44,6 +44,7 @@ class MyTimeoutLabel; class settingsDialogImpl; class startWindowImpl; +class myMessageDialogImpl; class GameTableStyleReader; class CardDeckStyleReader; @@ -308,6 +309,7 @@ public slots: void sendShowMyCardsSignal(); void showWarningAutoFoldInRankingGame(unsigned); + void closeMessageBoxes(); private: @@ -374,6 +376,7 @@ private: // Dialogs startWindowImpl *myStartWindow; + myMessageDialogImpl *myUniversalMessageDialog; //Sound SDLPlayer *mySDLPlayer; diff --git a/src/gui/qt/startwindow/startwindowimpl.cpp b/src/gui/qt/startwindow/startwindowimpl.cpp index f391b914..9499990f 100644 --- a/src/gui/qt/startwindow/startwindowimpl.cpp +++ b/src/gui/qt/startwindow/startwindowimpl.cpp @@ -505,6 +505,7 @@ void startWindowImpl::showClientDialog() else if (mySession->getGameType() == Session::GAME_TYPE_INTERNET) { if (myGuiInterface->getMyW()->isVisible()) + myGuiInterface->getMyW()->closeMessageBoxes(); myGuiInterface->getMyW()->hide(); if (!this->isVisible()) this->show();