2008-05-05 07:46:19 +00:00
|
|
|
//
|
|
|
|
|
// C++ Implementation: mycardspixmaplabel
|
|
|
|
|
//
|
|
|
|
|
// Description:
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// Author: FThauer FHammer <f.thauer@web.de>, (C) 2007
|
|
|
|
|
//
|
|
|
|
|
// Copyright: See COPYING file that comes with this distribution
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
#include "mysetlabel.h"
|
|
|
|
|
|
|
|
|
|
#include "gametableimpl.h"
|
2008-10-17 19:39:27 +00:00
|
|
|
#include "session.h"
|
|
|
|
|
#include "playerinterface.h"
|
|
|
|
|
#include "game.h"
|
2008-05-05 07:46:19 +00:00
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
MyAvatarLabel::MyAvatarLabel(QGroupBox* parent)
|
|
|
|
|
: QLabel(parent)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
myContextMenu = new QMenu;
|
2008-10-17 19:39:27 +00:00
|
|
|
action_VoteForKick = new QAction(QIcon(":/gfx/list_remove_user.png"), tr("Start vote on kick this user"), myContextMenu);
|
2008-09-23 08:15:33 +00:00
|
|
|
myContextMenu->addAction(action_VoteForKick);
|
2008-05-05 07:46:19 +00:00
|
|
|
|
2008-10-12 19:36:46 +00:00
|
|
|
connect( action_VoteForKick, SIGNAL ( triggered() ), this, SLOT ( sendTriggerVoteOnKickSignal() ) );
|
2008-05-05 07:46:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MyAvatarLabel::~MyAvatarLabel()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-23 08:15:33 +00:00
|
|
|
void MyAvatarLabel::contextMenuEvent ( QContextMenuEvent *event ) {
|
2008-05-05 07:46:19 +00:00
|
|
|
|
2008-10-17 19:39:27 +00:00
|
|
|
|
|
|
|
|
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++;
|
|
|
|
|
}
|
2008-05-05 07:46:19 +00:00
|
|
|
}
|
|
|
|
|
|
2008-09-23 08:15:33 +00:00
|
|
|
void MyAvatarLabel::showContextMenu(const QPoint &pos) {
|
2008-05-05 07:46:19 +00:00
|
|
|
|
2008-09-23 08:15:33 +00:00
|
|
|
myContextMenu->popup(pos);
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-12 19:36:46 +00:00
|
|
|
void MyAvatarLabel::sendTriggerVoteOnKickSignal()
|
2008-09-23 08:15:33 +00:00
|
|
|
{
|
2008-10-12 19:36:46 +00:00
|
|
|
myW->triggerVoteOnKick(myId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MyAvatarLabel::setEnabledContextMenu(bool b)
|
|
|
|
|
{
|
|
|
|
|
myContextMenuEnabled = b;
|
2008-05-05 07:46:19 +00:00
|
|
|
}
|