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,51 +0,0 @@
//
// C++ Implementation: opengametimeoutmsgboximpl
//
// Description:
//
//
// Author: Felix Hammer <f.hammer@web.de>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "opengametimeoutmsgboximpl.h"
#include "gamelobbydialogimpl.h"
openGameTimeoutMsgBoxImpl::openGameTimeoutMsgBoxImpl(QDialog *parent, gameLobbyDialogImpl *l)
: 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()
{
}
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));
}
@@ -1,45 +0,0 @@
//
// C++ Interface: opengametimeoutmsgboximpl
//
// Description:
//
//
// Author: Felix Hammer <f.hammer@web.de>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef OPENGAMETIMEOUTMSGBOXIMPL_H
#define OPENGAMETIMEOUTMSGBOXIMPL_H
#include <QMessageBox>
#include <QtGui>
#include <QtCore>
#include <core/boost/timers.hpp>
/**
@author Felix Hammer <f.hammer@web.de>
*/
class gameLobbyDialogImpl;
class openGameTimeoutMsgBoxImpl : public QMessageBox
{
Q_OBJECT
public:
openGameTimeoutMsgBoxImpl(QDialog*, gameLobbyDialogImpl*);
~openGameTimeoutMsgBoxImpl();
public slots:
void startTimeout();
void timerRefresh();
private:
QTimer *timeOutTimer;
QPushButton *okButton;
gameLobbyDialogImpl *myLobby;
boost::timers::portable::microsec_timer realTimer;
};
#endif