This commit is contained in:
doitux
2008-03-03 10:25:32 +00:00
parent 39efcf3ddf
commit f5c82bb1f7
6 changed files with 37 additions and 31 deletions
@@ -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();*/ }
@@ -27,7 +27,7 @@
class Session;
class ConfigFile;
class LobbyChat;
class openGameTimeoutMsgBoxImpl;
class timeoutMsgBoxImpl;
/**
@author FThauer FHammer <webmaster@pokerth.net>
@@ -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<timeoutMsgBoxImpl> myOpenGameTimeoutMsgBoxImpl;
protected:
bool eventFilter(QObject *obj, QEvent *event);
+1 -1
View File
@@ -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:");
@@ -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;
}
}
@@ -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 <QMessageBox>
#include <QtGui>
@@ -20,15 +20,15 @@
/**
@author Felix Hammer <f.hammer@web.de>
*/
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;
};