Information about the game is now shown in lobby, when selecting a game.
Some GUI modifications, GUI update is working properly now if the dialog is shown the second time (after clearing items). List of players for the game is still missing. With the new on-demand model for player id/player name, this is kind of hard to implement.
This commit is contained in:
@@ -22,6 +22,7 @@ gameLobbyDialogImpl::gameLobbyDialogImpl(QWidget *parent, ConfigFile *c)
|
||||
connect( pushButton_CreateGame, SIGNAL( clicked() ), this, SLOT( createGame() ) );
|
||||
connect( pushButton_JoinGame, SIGNAL( clicked() ), this, SLOT( joinGame() ) );
|
||||
connect( treeWidget_GameList, SIGNAL( itemClicked ( QTreeWidgetItem*, int) ), this, SLOT( gameSelected(QTreeWidgetItem*, int) ) );
|
||||
connect( treeWidget_GameList, SIGNAL( clear () ), this, SLOT( clearGames() ) );
|
||||
|
||||
pushButton_JoinGame->setEnabled(false);
|
||||
|
||||
@@ -98,8 +99,16 @@ void gameLobbyDialogImpl::gameSelected(QTreeWidgetItem* item, int)
|
||||
|
||||
currentGameName = item->text(0);
|
||||
|
||||
groupBox_GameInfo->setEnabled(TRUE);
|
||||
groupBox_GameInfo->setTitle("Game Info - " + item->text(0));
|
||||
groupBox_GameInfo->setEnabled(true);
|
||||
groupBox_GameInfo->setTitle(tr("Game Info") + " - " + currentGameName);
|
||||
|
||||
assert(mySession);
|
||||
GameInfo info = mySession->getClientGameInfo(currentGameName.toUtf8().constData());
|
||||
label_SmallBlind->setText(QString::number(info.data.smallBlind));
|
||||
label_StartCash->setText(QString::number(info.data.startMoney));
|
||||
label_MaximumNumberOfPlayers->setText(QString::number(info.data.maxNumberOfPlayers));
|
||||
label_HandsToRaiseSmallBlind->setText(QString::number(info.data.handsBeforeRaise));
|
||||
label_TimeoutForPlayerAction->setText(QString::number(info.data.playerActionTimeoutSec));
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::addGame(QString gameName)
|
||||
@@ -116,3 +125,17 @@ void gameLobbyDialogImpl::removeGame(QString gameName)
|
||||
}
|
||||
}
|
||||
|
||||
void gameLobbyDialogImpl::clearGames()
|
||||
{
|
||||
pushButton_JoinGame->setEnabled(false);
|
||||
groupBox_GameInfo->setTitle(tr("Game Info"));
|
||||
groupBox_GameInfo->setEnabled(false);
|
||||
currentGameName = "";
|
||||
|
||||
label_SmallBlind->setText("");
|
||||
label_StartCash->setText("");
|
||||
label_MaximumNumberOfPlayers->setText("");
|
||||
label_HandsToRaiseSmallBlind->setText("");
|
||||
label_TimeoutForPlayerAction->setText("");
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,8 @@ public slots:
|
||||
void setCurrentGameName ( const QString& theValue ) { currentGameName = theValue; }
|
||||
QString getCurrentGameName() const { return currentGameName; }
|
||||
|
||||
void clearGames();
|
||||
|
||||
private:
|
||||
|
||||
ConfigFile *myConfig;
|
||||
|
||||
@@ -121,7 +121,8 @@ void GuiWrapper::SignalNetClientPlayerLeft(const string &playerName)
|
||||
{
|
||||
QString tmpName(QString::fromUtf8(playerName.c_str()));
|
||||
myW->signalNetClientPlayerLeft(tmpName);
|
||||
myLog->signalLogPlayerLeftMsg(tmpName);
|
||||
if (!playerName.empty() && playerName[0] != '#')
|
||||
myLog->signalLogPlayerLeftMsg(tmpName);
|
||||
}
|
||||
|
||||
void GuiWrapper::SignalNetClientGameListNew(const string &gameName) { myW->signalNetClientGameListNew(QString::fromUtf8(gameName.c_str())); }
|
||||
|
||||
@@ -31,6 +31,7 @@ startNetworkGameDialogImpl::startNetworkGameDialogImpl(QWidget *parent, ConfigFi
|
||||
connect( pushButton_startGame, SIGNAL( clicked() ), this, SLOT( startGame() ) );
|
||||
connect( pushButton_Kick, SIGNAL( clicked() ), this, SLOT( kickPlayer() ) );
|
||||
connect( treeWidget, SIGNAL( itemClicked ( QTreeWidgetItem*, int) ), this, SLOT( playerSelected(QTreeWidgetItem*, int) ) );
|
||||
connect( treeWidget, SIGNAL( clear () ), this, SLOT( clearPlayers() ) );
|
||||
|
||||
pushButton_Kick->setEnabled(false);
|
||||
pushButton_startGame->setEnabled(false);
|
||||
@@ -114,20 +115,25 @@ void startNetworkGameDialogImpl::kickPlayer() {
|
||||
mySession->kickPlayer(playerName.toUtf8().constData());
|
||||
}
|
||||
}
|
||||
pushButton_Kick->setEnabled(FALSE);
|
||||
pushButton_Kick->setEnabled(false);
|
||||
}
|
||||
|
||||
void startNetworkGameDialogImpl::checkPlayerQuantity() {
|
||||
|
||||
if (treeWidget->topLevelItemCount() >= 2 && isAdmin) {
|
||||
pushButton_startGame->setEnabled(TRUE);
|
||||
pushButton_startGame->setEnabled(true);
|
||||
}
|
||||
else {
|
||||
pushButton_startGame->setEnabled(FALSE);
|
||||
pushButton_startGame->setEnabled(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void startNetworkGameDialogImpl::clearPlayers()
|
||||
{
|
||||
pushButton_Kick->setEnabled(false);
|
||||
}
|
||||
|
||||
void startNetworkGameDialogImpl::setSession(Session *session)
|
||||
{
|
||||
mySession = session;
|
||||
|
||||
@@ -52,12 +52,13 @@ public slots:
|
||||
void playerSelected(QTreeWidgetItem*, int);
|
||||
void kickPlayer();
|
||||
void checkPlayerQuantity();
|
||||
void clearPlayers();
|
||||
|
||||
void keyPressEvent ( QKeyEvent*);
|
||||
|
||||
void setMaxPlayerNumber ( int theValue ) { maxPlayerNumber = theValue; label_maxPlayerNumber->setText(QString::number(theValue,10)); }
|
||||
int getMaxPlayerNumber() const { return maxPlayerNumber; }
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user