mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 00:04:48 -07:00
filter running games; minor server code cleanup
This commit is contained in:
parent
9727a38956
commit
898623f1ba
24 changed files with 369 additions and 289 deletions
|
|
@ -27,23 +27,34 @@ GameSelector::GameSelector(AbstractClient *_client, TabRoom *_room, const QMap<i
|
|||
gameListView->header()->setResizeMode(1, QHeaderView::ResizeToContents);
|
||||
|
||||
showFullGamesCheckBox = new QCheckBox;
|
||||
showRunningGamesCheckBox = new QCheckBox;
|
||||
|
||||
QVBoxLayout *filterLayout = new QVBoxLayout;
|
||||
filterLayout->addWidget(showFullGamesCheckBox);
|
||||
filterLayout->addWidget(showRunningGamesCheckBox);
|
||||
|
||||
if (room)
|
||||
createButton = new QPushButton;
|
||||
else
|
||||
createButton = 0;
|
||||
joinButton = new QPushButton;
|
||||
spectateButton = new QPushButton;
|
||||
|
||||
QHBoxLayout *buttonLayout = new QHBoxLayout;
|
||||
buttonLayout->addWidget(showFullGamesCheckBox);
|
||||
buttonLayout->addStretch();
|
||||
if (room)
|
||||
buttonLayout->addWidget(createButton);
|
||||
buttonLayout->addWidget(joinButton);
|
||||
buttonLayout->addWidget(spectateButton);
|
||||
buttonLayout->setAlignment(Qt::AlignTop);
|
||||
|
||||
QHBoxLayout *hbox = new QHBoxLayout;
|
||||
hbox->addLayout(filterLayout);
|
||||
hbox->addStretch();
|
||||
hbox->addLayout(buttonLayout);
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->addWidget(gameListView);
|
||||
mainLayout->addLayout(buttonLayout);
|
||||
mainLayout->addLayout(hbox);
|
||||
|
||||
retranslateUi();
|
||||
setLayout(mainLayout);
|
||||
|
|
@ -52,6 +63,7 @@ GameSelector::GameSelector(AbstractClient *_client, TabRoom *_room, const QMap<i
|
|||
setMinimumHeight(200);
|
||||
|
||||
connect(showFullGamesCheckBox, SIGNAL(stateChanged(int)), this, SLOT(showFullGamesChanged(int)));
|
||||
connect(showRunningGamesCheckBox, SIGNAL(stateChanged(int)), this, SLOT(showRunningGamesChanged(int)));
|
||||
connect(createButton, SIGNAL(clicked()), this, SLOT(actCreate()));
|
||||
connect(joinButton, SIGNAL(clicked()), this, SLOT(actJoin()));
|
||||
connect(spectateButton, SIGNAL(clicked()), this, SLOT(actJoin()));
|
||||
|
|
@ -62,6 +74,11 @@ void GameSelector::showFullGamesChanged(int state)
|
|||
gameListProxyModel->setFullGamesVisible(state);
|
||||
}
|
||||
|
||||
void GameSelector::showRunningGamesChanged(int state)
|
||||
{
|
||||
gameListProxyModel->setRunningGamesVisible(state);
|
||||
}
|
||||
|
||||
void GameSelector::actCreate()
|
||||
{
|
||||
DlgCreateGame dlg(client, room->getRoomId(), room->getGameTypes(), this);
|
||||
|
|
@ -118,6 +135,7 @@ void GameSelector::retranslateUi()
|
|||
{
|
||||
setTitle(tr("Games"));
|
||||
showFullGamesCheckBox->setText(tr("Show &full games"));
|
||||
showRunningGamesCheckBox->setText(tr("Show &running games"));
|
||||
if (createButton)
|
||||
createButton->setText(tr("C&reate"));
|
||||
joinButton->setText(tr("&Join"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue