next steps votekick gui implementation

This commit is contained in:
doitux
2008-10-13 12:34:48 +00:00
parent feb3341f8a
commit de53c89fca
4 changed files with 52 additions and 16 deletions
+2 -2
View File
@@ -1784,7 +1784,7 @@
<item row="0" column="0" >
<layout class="QHBoxLayout" name="horizontalLayout_2" >
<item>
<widget class="QLabel" name="label_2" >
<widget class="QLabel" name="label_timeout" >
<property name="text" >
<string>Vote Timeout:</string>
</property>
@@ -2949,7 +2949,7 @@
<x>0</x>
<y>0</y>
<width>1000</width>
<height>30</height>
<height>28</height>
</rect>
</property>
<widget class="QMenu" name="menuView" >
+44 -9
View File
@@ -155,6 +155,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
postRiverRunAnimation6Timer = new QTimer(this);
blinkingStartButtonAnimationTimer = new QTimer(this);
voteOnKickTimeoutTimer = new QTimer(this);
dealFlopCards0Timer->setSingleShot(TRUE);
dealFlopCards1Timer->setSingleShot(TRUE);
@@ -391,6 +392,12 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
pushButton_break->setStyleSheet("QPushButton:enabled { background-color: #145300; color: #99D500;} QPushButton:disabled { background-color: #145300; color: #486F3E; font-weight: 900;}");
label_speedString->setStyleSheet("QLabel { color: #99D500;}");
label_speedValue->setStyleSheet("QLabel { color: #99D500;}");
pushButton_voteOnKickYes->setStyleSheet("QPushButton:enabled { background-color: #1C7000; color: #99D500;} QPushButton:disabled { background-color: #145300; color: #486F3E; font-weight: 900;}");
pushButton_voteOnKickNo->setStyleSheet("QPushButton:enabled { background-color: #1C7000; color: #99D500;} QPushButton:disabled { background-color: #145300; color: #486F3E; font-weight: 900;}");
label_timeout->setStyleSheet("QLabel { color: #99D500;}");
label_kickVoteTimeout->setStyleSheet("QLabel { color: #99D500;}");
label_kickUser->setStyleSheet("QLabel { color: #99D500;}");
statusbar->setStyleSheet(" QStatusBar { "+ font1String +" font-size: 12px; color: #B7FF00; }");
@@ -508,6 +515,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
connect(postRiverRunAnimation6Timer, SIGNAL(timeout()), this, SLOT( startNewHand() ));
connect(blinkingStartButtonAnimationTimer, SIGNAL(timeout()), this, SLOT( blinkingStartButtonAnimationAction()));
connect(voteOnKickTimeoutTimer, SIGNAL(timeout()), this, SLOT(nextVoteOnKickTimeoutAnimationFrame()));
connect( actionConfigure_PokerTH, SIGNAL( triggered() ), this, SLOT( callSettingsDialog() ) );
connect( actionClose, SIGNAL( triggered() ), this, SLOT( closeGameTable()) );
@@ -2678,6 +2686,14 @@ bool gameTableImpl::eventFilter(QObject *obj, QEvent *event)
myChat->nickAutoCompletition();
return true;
}
else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_M) { //TESTING UNIT
startVoteOnKick(3,60);
return true;
}
else if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_N) { //TESTING UNIT
stopVoteOnKickTimeout();
return true;
}
else if (event->type() == QEvent::Close) {
event->ignore();
closeGameTable();
@@ -2793,8 +2809,7 @@ void gameTableImpl::localGameModification() {
tabWidget_Left->setCurrentIndex(0);
tabWidget_Left->removeTab(1);
if(tabWidget_Left->widget(2) == tab_Kick)
tabWidget_Left->removeTab(2);
tabWidget_Left->removeTab(1);
int i;
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++ ) {
@@ -2818,9 +2833,9 @@ void gameTableImpl::localGameModification() {
void gameTableImpl::networkGameModification() {
if(tabWidget_Left->widget(1) != tab_Chat)
tabWidget_Left->insertTab(1, tab_Chat, QString(tr("Chat")));
if(tabWidget_Left->widget(2) == tab_Kick)
tabWidget_Left->removeTab(2);
tabWidget_Left->insertTab(1, tab_Chat, QString(tr(" Chat "))); /*TODO text abgeschnitten --> stylesheets*/
tabWidget_Left->removeTab(2);
tabWidget_Left->setCurrentIndex(1);
myChat->clearNewGame();
@@ -3062,20 +3077,21 @@ void gameTableImpl::triggerVoteOnKick(int id) {
void gameTableImpl::startVoteOnKick(int playerId, int timeoutSec)
{
if(tabWidget_Left->widget(2) != tab_Kick)
tabWidget_Left->insertTab(2, tab_Chat, QString(tr("Kick")));
tabWidget_Left->insertTab(2, tab_Kick, QString(tr("Kick")));
tabWidget_Left->setCurrentIndex(2);
PlayerInfo info(myStartWindow->getSession()->getClientPlayerInfo(playerId));
label_kickUser->setText(tr("Do you want to kick %1 \nfrom this game?").arg(QString::fromUtf8(info.playerName.c_str())));
// TODO timeout timer
voteOnKickTimeoutSecs = timeoutSec;
startVoteOnKickTimeout();
}
void gameTableImpl::endVoteOnKick()
{
if(tabWidget_Left->widget(2) == tab_Kick)
tabWidget_Left->removeTab(2);
stopVoteOnKickTimeout();
tabWidget_Left->removeTab(2);
tabWidget_Left->setCurrentIndex(1);
}
@@ -3088,3 +3104,22 @@ void gameTableImpl::voteOnKickNo()
{
}
void gameTableImpl::startVoteOnKickTimeout()
{
voteOnKickRealTimer.reset();
voteOnKickRealTimer.start();
voteOnKickTimeoutTimer->start(1000);
}
void gameTableImpl::stopVoteOnKickTimeout()
{
voteOnKickRealTimer.reset();
voteOnKickTimeoutTimer->stop();
}
void gameTableImpl::nextVoteOnKickTimeoutAnimationFrame()
{
qDebug() << voteOnKickTimeoutSecs-voteOnKickRealTimer.elapsed().total_seconds();
label_kickVoteTimeout->setText(tr("%1 secs left").arg(voteOnKickTimeoutSecs-voteOnKickRealTimer.elapsed().total_seconds()));
}
+6 -2
View File
@@ -283,6 +283,9 @@ public slots:
void endVoteOnKick();
void voteOnKickYes();
void voteOnKickNo();
void startVoteOnKickTimeout();
void stopVoteOnKickTimeout();
void nextVoteOnKickTimeoutAnimationFrame();
private:
@@ -328,7 +331,8 @@ private:
QTimer *postRiverRunAnimation6Timer;
QTimer *blinkingStartButtonAnimationTimer;
QTimer *voteOnKickTimeoutTimer;
boost::timers::portable::microsec_timer voteOnKickRealTimer;
QWidget *userWidgetsArray[6];
QLabel *buttonLabelArray[MAX_NUMBER_OF_PLAYERS];
@@ -398,7 +402,7 @@ private:
int keyUpDownChatCounter;
int myLastPreActionBetValue;
int voteOnKickTimeoutSecs;
// StyleSheetReader *myStyleSheetReader;
friend class GuiWrapper;
-3
View File
@@ -68,6 +68,3 @@ void MyLeftTabWidget::paintEvent(QPaintEvent * event) {
QTabWidget::paintEvent(event);
}