next steps votekick gui implementation

This commit is contained in:
doitux
2008-11-17 16:02:11 +00:00
parent 1cfe551f19
commit 46c82d169f
3 changed files with 21 additions and 6 deletions
+15 -6
View File
@@ -2676,8 +2676,8 @@ void gameTableImpl::keyPressEvent ( QKeyEvent * event ) {
else { keyUpDownChatCounter = 0; } else { keyUpDownChatCounter = 0; }
//TESTING UNIT //TESTING UNIT
// if (event->key() == Qt::Key_M) { startVoteOnKick(3,60); } if (event->key() == Qt::Key_M) { startVoteOnKick(3,60); }
// if (event->key() == Qt::Key_N) { endVoteOnKick(); } if (event->key() == Qt::Key_N) { endVoteOnKick(); }
} }
void gameTableImpl::changePlayingMode() { void gameTableImpl::changePlayingMode() {
@@ -2861,6 +2861,7 @@ void gameTableImpl::networkGameModification() {
int i; int i;
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++ ) { for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++ ) {
playerAvatarLabelArray[i]->setEnabledContextMenu(TRUE); playerAvatarLabelArray[i]->setEnabledContextMenu(TRUE);
playerAvatarLabelArray[i]->setVoteOnKickContextMenuEnabled(TRUE);
} }
if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET) { if(myStartWindow->getSession()->getGameType() == Session::GAME_TYPE_INTERNET) {
@@ -3108,11 +3109,16 @@ void gameTableImpl::startVoteOnKick(int playerId, int timeoutSec)
pushButton_voteOnKickYes->hide(); pushButton_voteOnKickYes->hide();
PlayerInfo info(myStartWindow->getSession()->getClientPlayerInfo(playerId)); PlayerInfo info(myStartWindow->getSession()->getClientPlayerInfo(playerId));
label_kickUser->setText(tr("Do you want to kick <b>%1</b> \nfrom this game?").arg(QString::fromUtf8(info.playerName.c_str()))); label_kickUser->setText(tr("Do you want to kick <b>%1</b><br>from this game?").arg(QString::fromUtf8(info.playerName.c_str())));
voteOnKickTimeoutSecs = timeoutSec; voteOnKickTimeoutSecs = timeoutSec;
playerAboutToKickId = playerId; playerAboutToKickId = playerId;
startVoteOnKickTimeout(); startVoteOnKickTimeout();
int i;
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++ ) {
playerAvatarLabelArray[i]->setVoteOnKickContextMenuEnabled(FALSE);
}
} }
void gameTableImpl::changeVoteOnKickButtonsState(bool showHide) void gameTableImpl::changeVoteOnKickButtonsState(bool showHide)
@@ -3131,7 +3137,11 @@ void gameTableImpl::endVoteOnKick()
{ {
stopVoteOnKickTimeout(); stopVoteOnKickTimeout();
tabWidget_Left->removeTab(2); tabWidget_Left->removeTab(2);
// tabWidget_Left->setCurrentIndex(1);
int i;
for (i=0; i<MAX_NUMBER_OF_PLAYERS; i++ ) {
playerAvatarLabelArray[i]->setVoteOnKickContextMenuEnabled(TRUE);
}
} }
void gameTableImpl::voteOnKickYes() void gameTableImpl::voteOnKickYes()
@@ -3157,7 +3167,7 @@ void gameTableImpl::stopVoteOnKickTimeout()
void gameTableImpl::nextVoteOnKickTimeoutAnimationFrame() void gameTableImpl::nextVoteOnKickTimeoutAnimationFrame()
{ {
label_kickVoteTimeout->setText(tr("%1 secs left").arg(voteOnKickTimeoutSecs-voteOnKickRealTimer.elapsed().total_seconds())); label_kickVoteTimeout->setText(tr("<b>%1</b> secs left").arg(voteOnKickTimeoutSecs-voteOnKickRealTimer.elapsed().total_seconds()));
} }
void gameTableImpl::refreshVotesMonitor() void gameTableImpl::refreshVotesMonitor()
@@ -3188,6 +3198,5 @@ void gameTableImpl::refreshCardsChance(GameState bero)
} }
delete myCardsValue; delete myCardsValue;
} }
+5
View File
@@ -64,3 +64,8 @@ void MyAvatarLabel::setEnabledContextMenu(bool b)
{ {
myContextMenuEnabled = b; myContextMenuEnabled = b;
} }
void MyAvatarLabel::setVoteOnKickContextMenuEnabled(bool b)
{
action_VoteForKick->setEnabled(b);
}
+1
View File
@@ -35,6 +35,7 @@ public slots:
void showContextMenu(const QPoint &pos); void showContextMenu(const QPoint &pos);
void sendTriggerVoteOnKickSignal(); void sendTriggerVoteOnKickSignal();
void setEnabledContextMenu(bool); void setEnabledContextMenu(bool);
void setVoteOnKickContextMenuEnabled(bool);
private: private: