ingame votekick gui signals

This commit is contained in:
doitux
2008-09-23 08:15:33 +00:00
parent deef5a8ed9
commit ce81e09156
4 changed files with 30 additions and 9 deletions
+11
View File
@@ -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; i<MAX_NUMBER_OF_PLAYERS; i++) {
playerAvatarLabelArray[i]->setMyW(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);
}
+1
View File
@@ -232,6 +232,7 @@ public slots:
void flipHolecardsAllIn();
void showMyCards();
void voteForKick(int id);
void handSwitchRounds();
+12 -5
View File
@@ -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);
}
+6 -4
View File
@@ -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