mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-06 10:03:26 -08:00
[Client] Add tournament UI for creating and following lobby tournaments
Wires the tournament protocol into the client: - DlgCreateGame gains a tournament checkbox with a games-per-match settings sub-dialog; both values are sent with Command_CreateGame and mirrored in the join-info variant of the dialog - TournamentWidget renders live standings (with deck-submission state) and pairings for the local player's perspective, and asks to open the current match game via openMatchGameRequested() - TournamentTabGameExtension attaches an overview page to TabGame's stacked views, mirrors phase and submission progress onto a deck-view status strip, and provides round-trip navigation between game view and standings; hosts get an in-game settings dialog during deck building - Open-match falls back to joining as spectator through TabSupervisor; sub-games now return to their parent tab on close, falling back to the normal leave-game flow when the parent is gone
This commit is contained in:
parent
dfa0edfcdb
commit
de983ed01b
11 changed files with 706 additions and 3 deletions
|
|
@ -0,0 +1,48 @@
|
|||
#include "dlg_tournament_settings.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFormLayout>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QSpinBox>
|
||||
|
||||
DlgTournamentSettings::DlgTournamentSettings(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
setWindowTitle(tr("Tournament Settings"));
|
||||
|
||||
auto *mainLayout = new QFormLayout(this);
|
||||
|
||||
gamesPerMatchSpin = new QSpinBox(this);
|
||||
gamesPerMatchSpin->setRange(1, 5);
|
||||
gamesPerMatchSpin->setValue(1);
|
||||
gamesPerMatchSpin->setToolTip(tr("Number of games per match (e.g., 3 for Best of 3)"));
|
||||
mainLayout->addRow(tr("Games per match:"), gamesPerMatchSpin);
|
||||
|
||||
QLabel *hintLabel = new QLabel(tr("Set to 3 for Best of 3, 5 for Best of 5, etc."), this);
|
||||
hintLabel->setStyleSheet("color: palette(placeholderText);");
|
||||
mainLayout->addRow(QString(), hintLabel);
|
||||
|
||||
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
|
||||
connect(buttonBox, &QDialogButtonBox::accepted, this, &DlgTournamentSettings::actOK);
|
||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
mainLayout->addRow(buttonBox);
|
||||
|
||||
setFixedHeight(sizeHint().height());
|
||||
}
|
||||
|
||||
DlgTournamentSettingsResult DlgTournamentSettings::getResult() const
|
||||
{
|
||||
DlgTournamentSettingsResult result;
|
||||
result.gamesPerMatch = gamesPerMatchSpin->value();
|
||||
return result;
|
||||
}
|
||||
|
||||
void DlgTournamentSettings::setCurrentGamesPerMatch(int n)
|
||||
{
|
||||
gamesPerMatchSpin->setValue(n);
|
||||
}
|
||||
|
||||
void DlgTournamentSettings::actOK()
|
||||
{
|
||||
accept();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue