diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index 3ca3414d..94e8ab82 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -233,6 +233,10 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) playerAvatarLabelArray[4] = label_Avatar4; playerAvatarLabelArray[5] = label_Avatar5; playerAvatarLabelArray[6] = label_Avatar6; + for (i=0; isetMyW(this); + playerAvatarLabelArray[i]->setMyId(i); + } // setLabelArray init setLabelArray[0] = textLabel_Set0; @@ -3037,3 +3041,10 @@ void gameTableImpl::leaveCurrentNetworkGame() { } } } + +void gameTableImpl::voteForKick(int id) { + + qDebug() << "vote for kick user: " << id; +// mySession->sendVoteKickSignal(id); +} + diff --git a/src/gui/qt/gametable/gametableimpl.h b/src/gui/qt/gametable/gametableimpl.h index 26d3c586..5dd6c593 100755 --- a/src/gui/qt/gametable/gametableimpl.h +++ b/src/gui/qt/gametable/gametableimpl.h @@ -232,6 +232,7 @@ public slots: void flipHolecardsAllIn(); void showMyCards(); + void voteForKick(int id); void handSwitchRounds(); diff --git a/src/gui/qt/gametable/myavatarlabel.cpp b/src/gui/qt/gametable/myavatarlabel.cpp index 76bb4058..879c381f 100644 --- a/src/gui/qt/gametable/myavatarlabel.cpp +++ b/src/gui/qt/gametable/myavatarlabel.cpp @@ -20,8 +20,10 @@ MyAvatarLabel::MyAvatarLabel(QGroupBox* parent) { myContextMenu = new QMenu; - myContextMenu->addAction(tr("Vote for kick this user")); + action_VoteForKick = new QAction(tr("Vote for kick this user"), myContextMenu); + myContextMenu->addAction(action_VoteForKick); + connect( action_VoteForKick, SIGNAL ( triggered() ), this, SLOT ( sendVoteForKickSignal() ) ); } @@ -29,12 +31,17 @@ MyAvatarLabel::~MyAvatarLabel() { } -void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent * /*event*/ ) { +void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) { -// showContextMenu(event->globalPos()); + showContextMenu(event->globalPos()); } -void MyAvatarLabel::showContextMenu(const QPoint &/*pos*/) { +void MyAvatarLabel::showContextMenu(const QPoint &pos) { -// myContextMenu->popup(pos); + myContextMenu->popup(pos); +} + +void MyAvatarLabel::sendVoteForKickSignal() +{ + myW->voteForKick(myId); } diff --git a/src/gui/qt/gametable/myavatarlabel.h b/src/gui/qt/gametable/myavatarlabel.h index 70ab5e20..568a561e 100644 --- a/src/gui/qt/gametable/myavatarlabel.h +++ b/src/gui/qt/gametable/myavatarlabel.h @@ -24,22 +24,24 @@ class MyAvatarLabel : public QLabel Q_OBJECT public: MyAvatarLabel(QGroupBox*); - ~MyAvatarLabel(); - - void setMyW ( gameTableImpl* theValue ) { myW = theValue; } - + void setMyW(gameTableImpl* theValue) { myW = theValue; } + void setMyId ( int theValue ) { myId = theValue; } void contextMenuEvent ( QContextMenuEvent * event ); public slots: void showContextMenu(const QPoint &pos); + void sendVoteForKickSignal(); private: gameTableImpl *myW; QMenu *myContextMenu; + QAction *action_VoteForKick; + + int myId; }; #endif