Now using the prepared password dialog.
This commit is contained in:
@@ -81,25 +81,22 @@ void gameLobbyDialogImpl::createGame()
|
|||||||
|
|
||||||
void gameLobbyDialogImpl::joinGame()
|
void gameLobbyDialogImpl::joinGame()
|
||||||
{
|
{
|
||||||
|
assert(mySession);
|
||||||
QTreeWidgetItem *item = treeWidget_GameList->currentItem();
|
QTreeWidgetItem *item = treeWidget_GameList->currentItem();
|
||||||
if (item)
|
if (item)
|
||||||
{
|
{
|
||||||
assert(mySession);
|
unsigned gameId = item->data(0, Qt::UserRole).toUInt();
|
||||||
|
GameInfo info(mySession->getClientGameInfo(gameId));
|
||||||
int isPrivate = 1;
|
bool ok = true;
|
||||||
|
QString password;
|
||||||
//if private ask for password
|
//if private ask for password
|
||||||
if(isPrivate) {
|
if (info.isPasswordProtected) {
|
||||||
|
password = QInputDialog::getText(this, tr("Joining a private Game"),
|
||||||
bool ok;
|
tr("You are about to join a private game. Please enter the password!"), QLineEdit::Password, (""), &ok);
|
||||||
QString password = QInputDialog::getText(this, tr("Join a private Game"),
|
|
||||||
tr("You like to join a private game. Please enter the password!"), QLineEdit::Password, (""), &ok);
|
|
||||||
if (ok && !password.isEmpty()) {
|
|
||||||
// std::cout << password.toStdString() << "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mySession->clientJoinGame(item->data(0, Qt::UserRole).toUInt(), "");
|
if (ok)
|
||||||
|
mySession->clientJoinGame(gameId, password.toUtf8().constData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user