diff --git a/pokerth_game.pro b/pokerth_game.pro index ce7061d1..632f9bd9 100644 --- a/pokerth_game.pro +++ b/pokerth_game.pro @@ -54,7 +54,7 @@ INCLUDEPATH += . \ src/gui/qt/mymessagedialog \ src/gui/qt/gamelobbydialog \ src/gui/qt/gamelobbydialog/lobbychat \ - src/gui/qt/gamelobbydialog/opengametimeoutmsgbox + src/gui/qt/timeoutmsgbox DEPENDPATH += . \ src \ @@ -92,7 +92,7 @@ DEPENDPATH += . \ src/gui/qt/mymessagedialog \ src/gui/qt/gamelobbydialog \ src/gui/qt/gamelobbydialog/lobbychat \ - src/gui/qt/gamelobbydialog/opengametimeoutmsgbox + src/gui/qt/timeoutmsgbox # Input HEADERS += \ @@ -173,7 +173,7 @@ HEADERS += \ src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h \ src/gui/qt/gamelobbydialog/mygamelisttreewidget.h \ src/gui/qt/gamelobbydialog/lobbychat/lobbychat.h \ - src/gui/qt/gamelobbydialog/opengametimeoutmsgbox\opengametimeoutmsgboximpl.h \ + src/gui/qt/timeoutmsgbox\timeoutmsgboximpl.h \ src/gui/qt/mymessagedialog/mymessagedialogimpl.h \ src/gui/qttoolsinterface.h \ src/gui/qt/qttools/qttoolswrapper.h \ @@ -232,7 +232,7 @@ SOURCES += \ src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp \ src/gui/qt/gamelobbydialog/mygamelisttreewidget.cpp \ src/gui/qt/gamelobbydialog/lobbychat/lobbychat.cpp \ - src/gui/qt/gamelobbydialog/opengametimeoutmsgbox\opengametimeoutmsgboximpl.cpp \ + src/gui/qt/timeoutmsgbox\timeoutmsgboximpl.cpp \ src/net/common/net_helper_client.cpp \ src/core/common/loghelper_client.cpp diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp index b783681f..63030c14 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp @@ -12,7 +12,7 @@ #include "gamelobbydialogimpl.h" #include "lobbychat.h" #include "changecompleteblindsdialogimpl.h" -#include "opengametimeoutmsgboximpl.h" +#include "timeoutmsgboximpl.h" #include "session.h" #include "configfile.h" #include "gamedata.h" @@ -32,8 +32,6 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(QWidget *parent, ConfigFile *c) myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str()); - myOpenGameTimeoutMsgBoxImpl = new openGameTimeoutMsgBoxImpl(this, this); - //wait start game message waitStartGameMsgBox = new QMessageBox(this); waitStartGameMsgBox->setText(tr("Starting game. Please wait ...")); @@ -225,6 +223,7 @@ void gameLobbyDialogImpl::removedFromGame(int /*reason*/) void gameLobbyDialogImpl::gameSelected(QTreeWidgetItem* item, QTreeWidgetItem*) { + if (!inGame && item) { pushButton_JoinGame->setEnabled(true); @@ -845,6 +844,8 @@ void gameLobbyDialogImpl::joinAnyGameButtonRefresh() { void gameLobbyDialogImpl::startOpenGameTimeout() { + myOpenGameTimeoutMsgBoxImpl.reset(new timeoutMsgBoxImpl(this, mySession, 1)); + myOpenGameTimeoutMsgBoxImpl->show(); myOpenGameTimeoutMsgBoxImpl->raise(); myOpenGameTimeoutMsgBoxImpl->activateWindow(); @@ -855,5 +856,3 @@ void gameLobbyDialogImpl::closeOpenGameTimeoutMsgBox() { myOpenGameTimeoutMsgBoxImpl->hide(); } - -void gameLobbyDialogImpl::openGameTimeoutStoped() { /*mySession->openGameTimeoutStoped();*/ } diff --git a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h index 26db179a..21721a65 100644 --- a/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h +++ b/src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h @@ -27,7 +27,7 @@ class Session; class ConfigFile; class LobbyChat; -class openGameTimeoutMsgBoxImpl; +class timeoutMsgBoxImpl; /** @author FThauer FHammer @@ -102,7 +102,6 @@ public slots: void showWaitStartGameMsgBox(); void startOpenGameTimeout(); - void openGameTimeoutStoped(); void closeOpenGameTimeoutMsgBox(); void joinAnyGameButtonRefresh(); @@ -123,7 +122,7 @@ private: int keyUpCounter; QMessageBox *waitStartGameMsgBox; QTimer *waitStartGameMsgBoxTimer; - openGameTimeoutMsgBoxImpl *myOpenGameTimeoutMsgBoxImpl; + boost::shared_ptr myOpenGameTimeoutMsgBoxImpl; protected: bool eventFilter(QObject *obj, QEvent *event); diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index 7f47dc67..751cedae 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -1087,7 +1087,7 @@ void mainWindowImpl::initGui(int speed) label_Pot->setText("Pot"); label_Total->setText("Total:"); - label_Sets->setText("Sets:"); + label_Sets->setText("Bets:"); label_handNumber->setText("Hand:"); label_gameNumber->setText("Game:"); diff --git a/src/gui/qt/gamelobbydialog/opengametimeoutmsgbox/opengametimeoutmsgboximpl.cpp b/src/gui/qt/timeoutmsgbox/timeoutmsgboximpl.cpp similarity index 50% rename from src/gui/qt/gamelobbydialog/opengametimeoutmsgbox/opengametimeoutmsgboximpl.cpp rename to src/gui/qt/timeoutmsgbox/timeoutmsgboximpl.cpp index 4ed7fc25..dc1c403f 100644 --- a/src/gui/qt/gamelobbydialog/opengametimeoutmsgbox/opengametimeoutmsgboximpl.cpp +++ b/src/gui/qt/timeoutmsgbox/timeoutmsgboximpl.cpp @@ -9,43 +9,49 @@ // Copyright: See COPYING file that comes with this distribution // // -#include "opengametimeoutmsgboximpl.h" -#include "gamelobbydialogimpl.h" +#include "timeoutmsgboximpl.h" +#include "session.h" -openGameTimeoutMsgBoxImpl::openGameTimeoutMsgBoxImpl(QDialog *parent, gameLobbyDialogImpl *l) - : QMessageBox(parent), myLobby(l) +timeoutMsgBoxImpl::timeoutMsgBoxImpl(QDialog *parent, Session *s, int id) + : QMessageBox(parent), mySession(s), msgId(id) { okButton = this->addButton(QMessageBox::Ok); - this->setWindowTitle(tr("Open Game Timeout Warning")); + this->setWindowTitle(tr("Timeout Warning")); this->setIcon(QMessageBox::Warning); - this->setText(tr("Your open game reaches timeout in %1 seconds.").arg(60,0,10)); this->setInformativeText(tr("Please click \"OK\" to stop timeout!")); timeOutTimer = new QTimer; connect(timeOutTimer, SIGNAL(timeout()), this, SLOT(timerRefresh())); - connect(okButton, SIGNAL(clicked()), myLobby, SLOT(openGameTimeoutStoped())); +// connect(okButton, SIGNAL(clicked()), mySession, SLOT(spechialSessionSlot(msgId))); } -openGameTimeoutMsgBoxImpl::~openGameTimeoutMsgBoxImpl() +timeoutMsgBoxImpl::~timeoutMsgBoxImpl() { } -void openGameTimeoutMsgBoxImpl::startTimeout() { +void timeoutMsgBoxImpl::startTimeout() { //start the real timer realTimer.reset(); realTimer.start(); + timerRefresh(); timeOutTimer->start(1000); } -void openGameTimeoutMsgBoxImpl::timerRefresh() { +void timeoutMsgBoxImpl::timerRefresh() { int sec = 60; unsigned int realTimerValue = realTimer.elapsed().total_milliseconds(); sec -= realTimerValue/1000; if (sec < 0) sec = 0; - this->setText(tr("Your open game reaches timeout in %1 seconds.").arg(sec,0,10)); + switch (msgId) { + case 0: { this->setText(tr("Your connection is about to time out due to inactivity in %1 seconds.").arg(sec,0,10)); } + break; + case 1: { this->setText(tr("Your open game reaches timeout in %1 seconds.").arg(sec,0,10)); } + break; + } + } diff --git a/src/gui/qt/gamelobbydialog/opengametimeoutmsgbox/opengametimeoutmsgboximpl.h b/src/gui/qt/timeoutmsgbox/timeoutmsgboximpl.h similarity index 65% rename from src/gui/qt/gamelobbydialog/opengametimeoutmsgbox/opengametimeoutmsgboximpl.h rename to src/gui/qt/timeoutmsgbox/timeoutmsgboximpl.h index 63395684..4db0baf4 100644 --- a/src/gui/qt/gamelobbydialog/opengametimeoutmsgbox/opengametimeoutmsgboximpl.h +++ b/src/gui/qt/timeoutmsgbox/timeoutmsgboximpl.h @@ -9,8 +9,8 @@ // Copyright: See COPYING file that comes with this distribution // // -#ifndef OPENGAMETIMEOUTMSGBOXIMPL_H -#define OPENGAMETIMEOUTMSGBOXIMPL_H +#ifndef TIMEOUTMSGBOXIMPL_H +#define TIMEOUTMSGBOXIMPL_H #include #include @@ -20,15 +20,15 @@ /** @author Felix Hammer */ -class gameLobbyDialogImpl; +class Session; -class openGameTimeoutMsgBoxImpl : public QMessageBox +class timeoutMsgBoxImpl : public QMessageBox { Q_OBJECT public: - openGameTimeoutMsgBoxImpl(QDialog*, gameLobbyDialogImpl*); + timeoutMsgBoxImpl(QDialog*, Session*, int); - ~openGameTimeoutMsgBoxImpl(); + ~timeoutMsgBoxImpl(); public slots: @@ -36,9 +36,11 @@ public slots: void timerRefresh(); private: + QTimer *timeOutTimer; QPushButton *okButton; - gameLobbyDialogImpl *myLobby; + Session *mySession; + int msgId; boost::timers::portable::microsec_timer realTimer; };