timeoutDialog
This commit is contained in:
@@ -12,8 +12,8 @@
|
||||
#include "timeoutmsgboximpl.h"
|
||||
#include "session.h"
|
||||
|
||||
timeoutMsgBoxImpl::timeoutMsgBoxImpl(QDialog *parent, int id)
|
||||
: QMessageBox(parent), mySession(NULL), msgId(id)
|
||||
timeoutMsgBoxImpl::timeoutMsgBoxImpl(QMainWindow *parent)
|
||||
: QMessageBox(parent)
|
||||
{
|
||||
okButton = this->addButton(QMessageBox::Ok);
|
||||
|
||||
@@ -24,7 +24,7 @@ timeoutMsgBoxImpl::timeoutMsgBoxImpl(QDialog *parent, int id)
|
||||
timeOutTimer = new QTimer;
|
||||
|
||||
connect(timeOutTimer, SIGNAL(timeout()), this, SLOT(timerRefresh()));
|
||||
// connect(okButton, SIGNAL(clicked()), mySession, SLOT(spechialSessionSlot(msgId)));
|
||||
connect(okButton, SIGNAL(clicked()), this, SLOT(stopTimeout()));
|
||||
|
||||
}
|
||||
|
||||
@@ -46,12 +46,16 @@ void timeoutMsgBoxImpl::timerRefresh() {
|
||||
unsigned int realTimerValue = realTimer.elapsed().total_milliseconds();
|
||||
sec -= realTimerValue/1000;
|
||||
if (sec < 0) sec = 0;
|
||||
switch (msgId) {
|
||||
case 0: { this->setText(tr("Your connection is about to time out due to inactivity in %1 seconds.").arg(sec,0,10)); }
|
||||
switch (msgID) {
|
||||
case GENERIC: { 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)); }
|
||||
case OPENGAMEADMINIDLE: { this->setText(tr("Your open game reaches timeout in %1 seconds.").arg(sec,0,10)); }
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void timeoutMsgBoxImpl::stopTimeout() {
|
||||
|
||||
// mySession->stopTimeout
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <QtGui>
|
||||
#include <QtCore>
|
||||
#include <core/boost/timers.hpp>
|
||||
#include "game_defs.h"
|
||||
|
||||
/**
|
||||
@author Felix Hammer <f.hammer@web.de>
|
||||
@@ -26,7 +27,7 @@ class timeoutMsgBoxImpl : public QMessageBox
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
timeoutMsgBoxImpl(QDialog*, int);
|
||||
timeoutMsgBoxImpl(QMainWindow*);
|
||||
|
||||
~timeoutMsgBoxImpl();
|
||||
|
||||
@@ -34,15 +35,17 @@ public slots:
|
||||
|
||||
void startTimeout();
|
||||
void timerRefresh();
|
||||
void stopTimeout();
|
||||
|
||||
void setMySession ( Session* theValue ) { mySession = theValue; }
|
||||
void setMySession ( boost::shared_ptr<Session> theValue ) { mySession = theValue; }
|
||||
void setMsgID ( int theValue ) { msgID = theValue; }
|
||||
|
||||
private:
|
||||
|
||||
QTimer *timeOutTimer;
|
||||
QPushButton *okButton;
|
||||
Session *mySession;
|
||||
int msgId;
|
||||
boost::shared_ptr<Session> mySession;
|
||||
int msgID;
|
||||
boost::timers::portable::microsec_timer realTimer;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user