opengametimeoutmsgbox local basics

This commit is contained in:
doitux
2008-03-01 23:44:12 +00:00
parent 1ba22682ee
commit 39efcf3ddf
9 changed files with 82 additions and 6 deletions
+6 -2
View File
@@ -53,7 +53,8 @@ INCLUDEPATH += . \
src/gui/qt/changecompleteblindsdialog \ src/gui/qt/changecompleteblindsdialog \
src/gui/qt/mymessagedialog \ src/gui/qt/mymessagedialog \
src/gui/qt/gamelobbydialog \ src/gui/qt/gamelobbydialog \
src/gui/qt/gamelobbydialog/lobbychat src/gui/qt/gamelobbydialog/lobbychat \
src/gui/qt/gamelobbydialog/opengametimeoutmsgbox
DEPENDPATH += . \ DEPENDPATH += . \
src \ src \
@@ -90,7 +91,8 @@ DEPENDPATH += . \
src/gui/qt/changecompleteblindsdialog \ src/gui/qt/changecompleteblindsdialog \
src/gui/qt/mymessagedialog \ src/gui/qt/mymessagedialog \
src/gui/qt/gamelobbydialog \ src/gui/qt/gamelobbydialog \
src/gui/qt/gamelobbydialog/lobbychat src/gui/qt/gamelobbydialog/lobbychat \
src/gui/qt/gamelobbydialog/opengametimeoutmsgbox
# Input # Input
HEADERS += \ HEADERS += \
@@ -171,6 +173,7 @@ HEADERS += \
src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h \ src/gui/qt/gamelobbydialog/gamelobbydialogimpl.h \
src/gui/qt/gamelobbydialog/mygamelisttreewidget.h \ src/gui/qt/gamelobbydialog/mygamelisttreewidget.h \
src/gui/qt/gamelobbydialog/lobbychat/lobbychat.h \ src/gui/qt/gamelobbydialog/lobbychat/lobbychat.h \
src/gui/qt/gamelobbydialog/opengametimeoutmsgbox\opengametimeoutmsgboximpl.h \
src/gui/qt/mymessagedialog/mymessagedialogimpl.h \ src/gui/qt/mymessagedialog/mymessagedialogimpl.h \
src/gui/qttoolsinterface.h \ src/gui/qttoolsinterface.h \
src/gui/qt/qttools/qttoolswrapper.h \ src/gui/qt/qttools/qttoolswrapper.h \
@@ -229,6 +232,7 @@ SOURCES += \
src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp \ src/gui/qt/gamelobbydialog/gamelobbydialogimpl.cpp \
src/gui/qt/gamelobbydialog/mygamelisttreewidget.cpp \ src/gui/qt/gamelobbydialog/mygamelisttreewidget.cpp \
src/gui/qt/gamelobbydialog/lobbychat/lobbychat.cpp \ src/gui/qt/gamelobbydialog/lobbychat/lobbychat.cpp \
src/gui/qt/gamelobbydialog/opengametimeoutmsgbox\opengametimeoutmsgboximpl.cpp \
src/net/common/net_helper_client.cpp \ src/net/common/net_helper_client.cpp \
src/core/common/loghelper_client.cpp src/core/common/loghelper_client.cpp
@@ -12,6 +12,7 @@
#include "gamelobbydialogimpl.h" #include "gamelobbydialogimpl.h"
#include "lobbychat.h" #include "lobbychat.h"
#include "changecompleteblindsdialogimpl.h" #include "changecompleteblindsdialogimpl.h"
#include "opengametimeoutmsgboximpl.h"
#include "session.h" #include "session.h"
#include "configfile.h" #include "configfile.h"
#include "gamedata.h" #include "gamedata.h"
@@ -31,6 +32,8 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(QWidget *parent, ConfigFile *c)
myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str()); myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
myOpenGameTimeoutMsgBoxImpl = new openGameTimeoutMsgBoxImpl(this, this);
//wait start game message //wait start game message
waitStartGameMsgBox = new QMessageBox(this); waitStartGameMsgBox = new QMessageBox(this);
waitStartGameMsgBox->setText(tr("Starting game. Please wait ...")); waitStartGameMsgBox->setText(tr("Starting game. Please wait ..."));
@@ -77,6 +80,8 @@ void gameLobbyDialogImpl::exec()
waitStartGameMsgBoxTimer->stop(); waitStartGameMsgBoxTimer->stop();
waitStartGameMsgBox->hide(); waitStartGameMsgBox->hide();
myOpenGameTimeoutMsgBoxImpl->hide();
} }
@@ -838,3 +843,17 @@ void gameLobbyDialogImpl::joinAnyGameButtonRefresh() {
else pushButton_joinAnyGame->setEnabled(FALSE); else pushButton_joinAnyGame->setEnabled(FALSE);
} }
void gameLobbyDialogImpl::startOpenGameTimeout() {
myOpenGameTimeoutMsgBoxImpl->show();
myOpenGameTimeoutMsgBoxImpl->raise();
myOpenGameTimeoutMsgBoxImpl->activateWindow();
myOpenGameTimeoutMsgBoxImpl->startTimeout();
}
void gameLobbyDialogImpl::closeOpenGameTimeoutMsgBox() {
myOpenGameTimeoutMsgBoxImpl->hide();
}
void gameLobbyDialogImpl::openGameTimeoutStoped() { /*mySession->openGameTimeoutStoped();*/ }
@@ -27,6 +27,7 @@
class Session; class Session;
class ConfigFile; class ConfigFile;
class LobbyChat; class LobbyChat;
class openGameTimeoutMsgBoxImpl;
/** /**
@author FThauer FHammer <webmaster@pokerth.net> @author FThauer FHammer <webmaster@pokerth.net>
@@ -100,6 +101,10 @@ public slots:
void showWaitStartGameMsgBox(); void showWaitStartGameMsgBox();
void startOpenGameTimeout();
void openGameTimeoutStoped();
void closeOpenGameTimeoutMsgBox();
void joinAnyGameButtonRefresh(); void joinAnyGameButtonRefresh();
@@ -118,6 +123,7 @@ private:
int keyUpCounter; int keyUpCounter;
QMessageBox *waitStartGameMsgBox; QMessageBox *waitStartGameMsgBox;
QTimer *waitStartGameMsgBoxTimer; QTimer *waitStartGameMsgBoxTimer;
openGameTimeoutMsgBoxImpl *myOpenGameTimeoutMsgBoxImpl;
protected: protected:
bool eventFilter(QObject *obj, QEvent *event); bool eventFilter(QObject *obj, QEvent *event);
@@ -10,15 +10,42 @@
// //
// //
#include "opengametimeoutmsgboximpl.h" #include "opengametimeoutmsgboximpl.h"
#include "gamelobbydialogimpl.h"
openGameTimeoutMsgBoxImpl::openGameTimeoutMsgBoxImpl() openGameTimeoutMsgBoxImpl::openGameTimeoutMsgBoxImpl(QDialog *parent, gameLobbyDialogImpl *l)
: QMessageBox() : QMessageBox(parent), myLobby(l)
{ {
} okButton = this->addButton(QMessageBox::Ok);
this->setWindowTitle(tr("Open Game 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()));
}
openGameTimeoutMsgBoxImpl::~openGameTimeoutMsgBoxImpl() openGameTimeoutMsgBoxImpl::~openGameTimeoutMsgBoxImpl()
{ {
} }
void openGameTimeoutMsgBoxImpl::startTimeout() {
//start the real timer
realTimer.reset();
realTimer.start();
timeOutTimer->start(1000);
}
void openGameTimeoutMsgBoxImpl::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));
}
@@ -13,17 +13,33 @@
#define OPENGAMETIMEOUTMSGBOXIMPL_H #define OPENGAMETIMEOUTMSGBOXIMPL_H
#include <QMessageBox> #include <QMessageBox>
#include <QtGui>
#include <QtCore>
#include <core/boost/timers.hpp>
/** /**
@author Felix Hammer <f.hammer@web.de> @author Felix Hammer <f.hammer@web.de>
*/ */
class gameLobbyDialogImpl;
class openGameTimeoutMsgBoxImpl : public QMessageBox class openGameTimeoutMsgBoxImpl : public QMessageBox
{ {
Q_OBJECT
public: public:
openGameTimeoutMsgBoxImpl(); openGameTimeoutMsgBoxImpl(QDialog*, gameLobbyDialogImpl*);
~openGameTimeoutMsgBoxImpl(); ~openGameTimeoutMsgBoxImpl();
public slots:
void startTimeout();
void timerRefresh();
private:
QTimer *timeOutTimer;
QPushButton *okButton;
gameLobbyDialogImpl *myLobby;
boost::timers::portable::microsec_timer realTimer;
}; };
#endif #endif
+1
View File
@@ -120,6 +120,7 @@ void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->signalNetClientGam
void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myW->signalNetClientError(errorID, osErrorID); } void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myW->signalNetClientError(errorID, osErrorID); }
void GuiWrapper::SignalNetClientNotification(int notificationId) { myW->signalNetClientNotification(notificationId); } void GuiWrapper::SignalNetClientNotification(int notificationId) { myW->signalNetClientNotification(notificationId); }
void GuiWrapper::SignalNetClientStatsUpdate(const ServerStats &stats) { myW->signalNetClientStatsUpdate(stats); } void GuiWrapper::SignalNetClientStatsUpdate(const ServerStats &stats) { myW->signalNetClientStatsUpdate(stats); }
void GuiWrapper::SignalNetClientStartOpenGameTimeout() { myW->signalNetClientStartOpenGameTimeout(); }
void GuiWrapper::SignalNetClientRemovedFromGame(int notificationId) { myW->signalNetClientRemovedFromGame(notificationId); } void GuiWrapper::SignalNetClientRemovedFromGame(int notificationId) { myW->signalNetClientRemovedFromGame(notificationId); }
void GuiWrapper::SignalNetClientSelfJoined(unsigned playerId, const string &playerName, PlayerRights rights) { myW->signalNetClientSelfJoined(playerId, QString::fromUtf8(playerName.c_str()), rights); } void GuiWrapper::SignalNetClientSelfJoined(unsigned playerId, const string &playerName, PlayerRights rights) { myW->signalNetClientSelfJoined(playerId, QString::fromUtf8(playerName.c_str()), rights); }
void GuiWrapper::SignalNetClientPlayerJoined(unsigned playerId, const string &playerName, PlayerRights rights) { myW->signalNetClientPlayerJoined(playerId, QString::fromUtf8(playerName.c_str()), rights); } void GuiWrapper::SignalNetClientPlayerJoined(unsigned playerId, const string &playerName, PlayerRights rights) { myW->signalNetClientPlayerJoined(playerId, QString::fromUtf8(playerName.c_str()), rights); }
+1
View File
@@ -108,6 +108,7 @@ public:
void SignalNetClientError(int errorID, int osErrorID); void SignalNetClientError(int errorID, int osErrorID);
void SignalNetClientNotification(int notificationId); void SignalNetClientNotification(int notificationId);
void SignalNetClientStatsUpdate(const ServerStats &stats); void SignalNetClientStatsUpdate(const ServerStats &stats);
void SignalNetClientStartOpenGameTimeout();
void SignalNetClientRemovedFromGame(int notificationId); void SignalNetClientRemovedFromGame(int notificationId);
void SignalNetClientSelfJoined(unsigned playerId, const std::string &playerName, PlayerRights rights); void SignalNetClientSelfJoined(unsigned playerId, const std::string &playerName, PlayerRights rights);
void SignalNetClientPlayerJoined(unsigned playerId, const std::string &playerName, PlayerRights rights); void SignalNetClientPlayerJoined(unsigned playerId, const std::string &playerName, PlayerRights rights);
+1
View File
@@ -635,6 +635,7 @@ mainWindowImpl::mainWindowImpl(ConfigFile *c, QMainWindow *parent)
connect(this, SIGNAL(signalNetClientGameListPlayerLeft(unsigned, unsigned)), myGameLobbyDialog, SLOT(gameRemovePlayer(unsigned, unsigned))); connect(this, SIGNAL(signalNetClientGameListPlayerLeft(unsigned, unsigned)), myGameLobbyDialog, SLOT(gameRemovePlayer(unsigned, unsigned)));
connect(this, SIGNAL(signalNetClientRemovedFromGame(int)), myGameLobbyDialog, SLOT(removedFromGame(int))); connect(this, SIGNAL(signalNetClientRemovedFromGame(int)), myGameLobbyDialog, SLOT(removedFromGame(int)));
connect(this, SIGNAL(signalNetClientStatsUpdate(ServerStats)), myGameLobbyDialog, SLOT(updateStats(ServerStats))); connect(this, SIGNAL(signalNetClientStatsUpdate(ServerStats)), myGameLobbyDialog, SLOT(updateStats(ServerStats)));
connect(this, SIGNAL(signalNetClientStartOpenGameTimeout()), myGameLobbyDialog, SLOT(startOpenGameTimeout()));
// Errors are handled globally, not within one dialog. // Errors are handled globally, not within one dialog.
connect(this, SIGNAL(signalNetClientError(int, int)), this, SLOT(networkError(int, int))); connect(this, SIGNAL(signalNetClientError(int, int)), this, SLOT(networkError(int, int)));
+1
View File
@@ -130,6 +130,7 @@ signals:
void signalNetClientError(int errorID, int osErrorID); void signalNetClientError(int errorID, int osErrorID);
void signalNetClientNotification(int notificationId); void signalNetClientNotification(int notificationId);
void signalNetClientStatsUpdate(ServerStats stats); void signalNetClientStatsUpdate(ServerStats stats);
void signalNetClientStartOpenGameTimeout();
void signalNetClientRemovedFromGame(int notificationId); void signalNetClientRemovedFromGame(int notificationId);
void signalNetServerError(int errorID, int osErrorID); void signalNetServerError(int errorID, int osErrorID);
void signalNetClientSelfJoined(unsigned playerId, QString playerName, int rights); void signalNetClientSelfJoined(unsigned playerId, QString playerName, int rights);