From bf623ae6e82738b75fde4f5c9e480c1bc6fa115e Mon Sep 17 00:00:00 2001 From: doitux Date: Fri, 17 Oct 2008 19:39:27 +0000 Subject: [PATCH] next steps votekick gui implementation --- src/gui/qt/gametable/myavatarlabel.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/gui/qt/gametable/myavatarlabel.cpp b/src/gui/qt/gametable/myavatarlabel.cpp index d58e60b6..9bf45fb4 100644 --- a/src/gui/qt/gametable/myavatarlabel.cpp +++ b/src/gui/qt/gametable/myavatarlabel.cpp @@ -12,6 +12,9 @@ #include "mysetlabel.h" #include "gametableimpl.h" +#include "session.h" +#include "playerinterface.h" +#include "game.h" using namespace std; @@ -20,7 +23,7 @@ MyAvatarLabel::MyAvatarLabel(QGroupBox* parent) { myContextMenu = new QMenu; - action_VoteForKick = new QAction(tr("Start vote on kick this user"), myContextMenu); + action_VoteForKick = new QAction(QIcon(":/gfx/list_remove_user.png"), tr("Start vote on kick this user"), myContextMenu); myContextMenu->addAction(action_VoteForKick); connect( action_VoteForKick, SIGNAL ( triggered() ), this, SLOT ( sendTriggerVoteOnKickSignal() ) ); @@ -33,8 +36,18 @@ MyAvatarLabel::~MyAvatarLabel() void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) { - if(myContextMenuEnabled) - showContextMenu(event->globalPos()); + + Game *currentGame = myW->getSession()->getCurrentGame(); + + PlayerListConstIterator it_c; + int i=0; + for (it_c=currentGame->getSeatsList()->begin(); it_c!=currentGame->getSeatsList()->end(); it_c++) { + + if(myContextMenuEnabled && myId != 0 && myId == i && (*it_c)->getMyActiveStatus() ) + showContextMenu(event->globalPos()); + + i++; + } } void MyAvatarLabel::showContextMenu(const QPoint &pos) {