From 88e6e3f1a9e9e989caeaa0495c579a9d9194a9dd Mon Sep 17 00:00:00 2001 From: doitux Date: Sun, 12 Oct 2008 19:36:46 +0000 Subject: [PATCH] start votekick gui implementation --- src/gui/qt/gametable.ui | 75 +++++++++++++++++++++++++- src/gui/qt/gametable/gametableimpl.cpp | 12 ++++- src/gui/qt/gametable/gametableimpl.h | 2 +- src/gui/qt/gametable/myavatarlabel.cpp | 16 ++++-- src/gui/qt/gametable/myavatarlabel.h | 4 +- 5 files changed, 100 insertions(+), 9 deletions(-) diff --git a/src/gui/qt/gametable.ui b/src/gui/qt/gametable.ui index 539f4863..35c8fd5b 100644 --- a/src/gui/qt/gametable.ui +++ b/src/gui/qt/gametable.ui @@ -1776,6 +1776,79 @@ + + + Kick + + + + + + Vote id: + + + + + + + + 0 + 0 + + + + + + + + + + + Timeout: + + + + + + + + + + + + + + + 0 + 0 + + + + Do you want to kick %1 +from this game? + + + + + + + + + Yes + + + + + + + No + + + + + + + @@ -2874,7 +2947,7 @@ 0 0 1000 - 21 + 28 diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index 53333cad..6dcc1546 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -2788,10 +2788,13 @@ void gameTableImpl::localGameModification() { tabWidget_Left->setCurrentIndex(0); tabWidget_Left->removeTab(1); + if(tabWidget_Left->widget(2) == tab_Kick) + tabWidget_Left->removeTab(2); int i; for (i=0; istopTimeOutAnimation(); + playerAvatarLabelArray[i]->setEnabledContextMenu(FALSE); } pushButton_break->show(); @@ -2811,9 +2814,16 @@ 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->setCurrentIndex(1); myChat->clearNewGame(); + + int i; + for (i=0; isetEnabledContextMenu(TRUE); + } if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET) { pushButton_break->show(); @@ -3038,7 +3048,7 @@ void gameTableImpl::leaveCurrentNetworkGame() { } } -void gameTableImpl::voteForKick(int id) { +void gameTableImpl::triggerVoteOnKick(int id) { qDebug() << "vote for kick user: " << id; // myStartWindow->getSession()->sendVoteKickSignal(id); diff --git a/src/gui/qt/gametable/gametableimpl.h b/src/gui/qt/gametable/gametableimpl.h index e255d721..f8d9ab82 100755 --- a/src/gui/qt/gametable/gametableimpl.h +++ b/src/gui/qt/gametable/gametableimpl.h @@ -231,7 +231,7 @@ public slots: void flipHolecardsAllIn(); void showMyCards(); - void voteForKick(int id); + void triggerVoteOnKick(int id); void handSwitchRounds(); diff --git a/src/gui/qt/gametable/myavatarlabel.cpp b/src/gui/qt/gametable/myavatarlabel.cpp index 879c381f..d58e60b6 100644 --- a/src/gui/qt/gametable/myavatarlabel.cpp +++ b/src/gui/qt/gametable/myavatarlabel.cpp @@ -20,10 +20,10 @@ MyAvatarLabel::MyAvatarLabel(QGroupBox* parent) { myContextMenu = new QMenu; - action_VoteForKick = new QAction(tr("Vote for kick this user"), myContextMenu); + action_VoteForKick = new QAction(tr("Start vote on kick this user"), myContextMenu); myContextMenu->addAction(action_VoteForKick); - connect( action_VoteForKick, SIGNAL ( triggered() ), this, SLOT ( sendVoteForKickSignal() ) ); + connect( action_VoteForKick, SIGNAL ( triggered() ), this, SLOT ( sendTriggerVoteOnKickSignal() ) ); } @@ -33,7 +33,8 @@ MyAvatarLabel::~MyAvatarLabel() void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) { - showContextMenu(event->globalPos()); + if(myContextMenuEnabled) + showContextMenu(event->globalPos()); } void MyAvatarLabel::showContextMenu(const QPoint &pos) { @@ -41,7 +42,12 @@ void MyAvatarLabel::showContextMenu(const QPoint &pos) { myContextMenu->popup(pos); } -void MyAvatarLabel::sendVoteForKickSignal() +void MyAvatarLabel::sendTriggerVoteOnKickSignal() { - myW->voteForKick(myId); + myW->triggerVoteOnKick(myId); +} + +void MyAvatarLabel::setEnabledContextMenu(bool b) +{ + myContextMenuEnabled = b; } diff --git a/src/gui/qt/gametable/myavatarlabel.h b/src/gui/qt/gametable/myavatarlabel.h index 568a561e..8a791f58 100644 --- a/src/gui/qt/gametable/myavatarlabel.h +++ b/src/gui/qt/gametable/myavatarlabel.h @@ -33,7 +33,8 @@ public: public slots: void showContextMenu(const QPoint &pos); - void sendVoteForKickSignal(); + void sendTriggerVoteOnKickSignal(); + void setEnabledContextMenu(bool); private: @@ -42,6 +43,7 @@ private: QAction *action_VoteForKick; int myId; + bool myContextMenuEnabled; }; #endif