mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-29 09:22:18 -07:00
Add command zone visibility and filtering to game lobby
This commit is contained in:
parent
127d8a5f5a
commit
1ba839ca20
9 changed files with 35 additions and 3 deletions
|
|
@ -219,6 +219,7 @@ DlgCreateGame::DlgCreateGame(const ServerInfo_Game &gameInfo, const QMap<int, QS
|
|||
spectatorsCanTalkCheckBox->setChecked(gameInfo.spectators_can_chat());
|
||||
spectatorsSeeEverythingCheckBox->setChecked(gameInfo.spectators_omniscient());
|
||||
shareDecklistsOnLoadCheckBox->setChecked(gameInfo.share_decklists_on_load());
|
||||
enableCommandZoneCheckBox->setChecked(gameInfo.enable_command_zone());
|
||||
|
||||
QSet<int> types;
|
||||
for (int i = 0; i < gameInfo.game_types_size(); ++i) {
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes,
|
|||
hideOpenDecklistGames = new QCheckBox(tr("Hide games with forced open decklists"));
|
||||
hideOpenDecklistGames->setChecked(filters.hideOpenDecklistGames);
|
||||
|
||||
hideCommandZoneGames = new QCheckBox(tr("Hide games with command zone enabled"));
|
||||
hideCommandZoneGames->setChecked(filters.hideCommandZoneGames);
|
||||
|
||||
maxGameAgeComboBox = new QComboBox();
|
||||
maxGameAgeComboBox->setEditable(false);
|
||||
maxGameAgeComboBox->addItems(gameAgeMap.values());
|
||||
|
|
@ -122,6 +125,7 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes,
|
|||
restrictionsLayout->addWidget(hideIgnoredUserGames, 4, 0);
|
||||
restrictionsLayout->addWidget(hideNotBuddyCreatedGames, 5, 0);
|
||||
restrictionsLayout->addWidget(hideOpenDecklistGames, 6, 0);
|
||||
restrictionsLayout->addWidget(hideCommandZoneGames, 7, 0);
|
||||
|
||||
auto *restrictionsGroupBox = new QGroupBox(tr("Restrictions"));
|
||||
restrictionsGroupBox->setLayout(restrictionsLayout);
|
||||
|
|
@ -192,6 +196,7 @@ GameFilterConfigs DlgFilterGames::getFilters() const
|
|||
hidePasswordProtectedGames->isChecked(),
|
||||
hideNotBuddyCreatedGames->isChecked(),
|
||||
hideOpenDecklistGames->isChecked(),
|
||||
hideCommandZoneGames->isChecked(),
|
||||
gameNameFilterEdit->text(),
|
||||
getCreatorNameFilters(),
|
||||
getGameTypeFilter(),
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ private:
|
|||
QCheckBox *hideIgnoredUserGames;
|
||||
QCheckBox *hideNotBuddyCreatedGames;
|
||||
QCheckBox *hideOpenDecklistGames;
|
||||
QCheckBox *hideCommandZoneGames;
|
||||
QLineEdit *gameNameFilterEdit;
|
||||
QLineEdit *creatorNameFilterEdit;
|
||||
QMap<int, QCheckBox *> gameTypeFilterCheckBoxes;
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ struct GameFilterConfigs
|
|||
bool hidePasswordProtectedGames = false;
|
||||
bool hideNotBuddyCreatedGames = false;
|
||||
bool hideOpenDecklistGames = false;
|
||||
bool hideCommandZoneGames = false;
|
||||
QString gameNameFilter = "";
|
||||
QStringList creatorNameFilters = {};
|
||||
QSet<int> gameTypeFilter = {};
|
||||
|
|
|
|||
|
|
@ -158,6 +158,9 @@ QVariant GamesModel::data(const QModelIndex &index, int role) const
|
|||
if (gameentry.share_decklists_on_load()) {
|
||||
result.append(tr("open decklists"));
|
||||
}
|
||||
if (gameentry.enable_command_zone()) {
|
||||
result.append(tr("command zone"));
|
||||
}
|
||||
return result.join(", ");
|
||||
}
|
||||
case Qt::DecorationRole: {
|
||||
|
|
@ -346,9 +349,9 @@ void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameType
|
|||
setGameFilters({gameFilters.isHideBuddiesOnlyGames(), gameFilters.isHideIgnoredUserGames(),
|
||||
gameFilters.isHideFullGames(), gameFilters.isHideGamesThatStarted(),
|
||||
gameFilters.isHidePasswordProtectedGames(), gameFilters.isHideNotBuddyCreatedGames(),
|
||||
gameFilters.isHideOpenDecklistGames(), gameFilters.getGameNameFilter(),
|
||||
gameFilters.getCreatorNameFilters(), newGameTypeFilter, gameFilters.getMinPlayers(),
|
||||
gameFilters.getMaxPlayers(), gameFilters.getMaxGameAge(),
|
||||
gameFilters.isHideOpenDecklistGames(), gameFilters.isHideCommandZoneGames(),
|
||||
gameFilters.getGameNameFilter(), gameFilters.getCreatorNameFilters(), newGameTypeFilter,
|
||||
gameFilters.getMinPlayers(), gameFilters.getMaxPlayers(), gameFilters.getMaxGameAge(),
|
||||
gameFilters.isShowOnlyIfSpectatorsCanWatch(), gameFilters.isShowSpectatorPasswordProtected(),
|
||||
gameFilters.isShowOnlyIfSpectatorsCanChat(), gameFilters.isShowOnlyIfSpectatorsCanSeeHands()});
|
||||
}
|
||||
|
|
@ -363,6 +366,7 @@ void GamesProxyModel::saveFilterParameters(const QMap<int, QString> &allGameType
|
|||
gameFilters.setHideIgnoredUserGames(filters.hideIgnoredUserGames);
|
||||
gameFilters.setHideNotBuddyCreatedGames(filters.hideNotBuddyCreatedGames);
|
||||
gameFilters.setHideOpenDecklistGames(filters.hideOpenDecklistGames);
|
||||
gameFilters.setHideCommandZoneGames(filters.hideCommandZoneGames);
|
||||
gameFilters.setGameNameFilter(filters.gameNameFilter);
|
||||
gameFilters.setCreatorNameFilters(filters.creatorNameFilters);
|
||||
|
||||
|
|
@ -408,6 +412,9 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow) const
|
|||
if (filters.hideOpenDecklistGames && game.share_decklists_on_load()) {
|
||||
return false;
|
||||
}
|
||||
if (filters.hideCommandZoneGames && game.enable_command_zone()) {
|
||||
return false;
|
||||
}
|
||||
if (filters.hideIgnoredUserGames &&
|
||||
userListProxy->isUserIgnored(QString::fromStdString(game.creator_info().name()))) {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue