mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 09:05:10 -07:00
[Client] Name the game in the join-game password prompt (#7141)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
d36865518e
commit
078e67c56f
1 changed files with 6 additions and 1 deletions
|
|
@ -370,7 +370,12 @@ void GameSelector::joinGame(const bool asSpectator, const bool asJudge)
|
||||||
QString password;
|
QString password;
|
||||||
if (game.with_password() && !(spectator && !game.spectators_need_password()) && !overrideRestrictions) {
|
if (game.with_password() && !(spectator && !game.spectators_need_password()) && !overrideRestrictions) {
|
||||||
bool ok;
|
bool ok;
|
||||||
password = getTextWithMax(this, tr("Join game"), tr("Password:"), QLineEdit::Password, QString(), &ok);
|
// Games without a description have no sensible label — fall back to the
|
||||||
|
// game id so the prompt still tells the user which game they're entering.
|
||||||
|
const QString gameLabel = QString::fromStdString(game.description());
|
||||||
|
const QString prompt = gameLabel.isEmpty() ? tr("Password for game #%1:").arg(game.game_id())
|
||||||
|
: tr("Password for \"%1\":").arg(gameLabel);
|
||||||
|
password = getTextWithMax(this, tr("Join game"), prompt, QLineEdit::Password, QString(), &ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue