start votekick gui implementation
This commit is contained in:
+74
-1
@@ -1776,6 +1776,79 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_Kick" >
|
||||
<attribute name="title" >
|
||||
<string>Kick</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<string>Vote id:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLabel" name="label_kickVoteId" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<string>Timeout:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLabel" name="label_kickVoteTimeout" >
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2" >
|
||||
<widget class="QLabel" name="label_kickUser" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="MinimumExpanding" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Do you want to kick %1
|
||||
from this game?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" >
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton" >
|
||||
<property name="text" >
|
||||
<string>Yes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2" >
|
||||
<property name="text" >
|
||||
<string>No</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -2874,7 +2947,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1000</width>
|
||||
<height>21</height>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuView" >
|
||||
|
||||
@@ -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; i<MAX_NUMBER_OF_PLAYERS; i++ ) {
|
||||
setLabelArray[i]->stopTimeOutAnimation();
|
||||
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; i<MAX_NUMBER_OF_PLAYERS; i++ ) {
|
||||
playerAvatarLabelArray[i]->setEnabledContextMenu(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);
|
||||
|
||||
@@ -231,7 +231,7 @@ public slots:
|
||||
|
||||
void flipHolecardsAllIn();
|
||||
void showMyCards();
|
||||
void voteForKick(int id);
|
||||
void triggerVoteOnKick(int id);
|
||||
|
||||
void handSwitchRounds();
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user