Change button to filter to games created by buddies, set default filter settings to be very permissive.

Took 45 minutes
This commit is contained in:
Lukas Brübach 2025-11-15 22:30:16 +01:00
parent 8022135d8c
commit 1cb45433a2
9 changed files with 76 additions and 52 deletions

View file

@ -56,7 +56,7 @@ DlgFilterGames::DlgFilterGames(const QMap<int, QString> &_allGameTypes,
auto *gameNameFilterLabel = new QLabel(tr("Game &description:")); auto *gameNameFilterLabel = new QLabel(tr("Game &description:"));
gameNameFilterLabel->setBuddy(gameNameFilterEdit); gameNameFilterLabel->setBuddy(gameNameFilterEdit);
creatorNameFilterEdit = new QLineEdit; creatorNameFilterEdit = new QLineEdit;
creatorNameFilterEdit->setText(gamesProxyModel->getCreatorNameFilter()); creatorNameFilterEdit->setText(gamesProxyModel->getCreatorNameFilters().join(", "));
auto *creatorNameFilterLabel = new QLabel(tr("&Creator name:")); auto *creatorNameFilterLabel = new QLabel(tr("&Creator name:"));
creatorNameFilterLabel->setBuddy(creatorNameFilterEdit); creatorNameFilterLabel->setBuddy(creatorNameFilterEdit);
@ -232,9 +232,9 @@ QString DlgFilterGames::getGameNameFilter() const
return gameNameFilterEdit->text(); return gameNameFilterEdit->text();
} }
QString DlgFilterGames::getCreatorNameFilter() const QStringList DlgFilterGames::getCreatorNameFilters() const
{ {
return creatorNameFilterEdit->text(); return creatorNameFilterEdit->text().split(",", Qt::SkipEmptyParts);
} }
QSet<int> DlgFilterGames::getGameTypeFilter() const QSet<int> DlgFilterGames::getGameTypeFilter() const

View file

@ -71,7 +71,7 @@ public:
bool getHideNotBuddyCreatedGames() const; bool getHideNotBuddyCreatedGames() const;
QString getGameNameFilter() const; QString getGameNameFilter() const;
void setGameNameFilter(const QString &_gameNameFilter); void setGameNameFilter(const QString &_gameNameFilter);
QString getCreatorNameFilter() const; QStringList getCreatorNameFilters() const;
void setCreatorNameFilter(const QString &_creatorNameFilter); void setCreatorNameFilter(const QString &_creatorNameFilter);
QSet<int> getGameTypeFilter() const; QSet<int> getGameTypeFilter() const;
void setGameTypeFilter(const QSet<int> &_gameTypeFilter); void setGameTypeFilter(const QSet<int> &_gameTypeFilter);

View file

@ -76,7 +76,7 @@ GameSelector::GameSelector(AbstractClient *_client,
gameListView->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); gameListView->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
quickFilterToolBar = new GameSelectorQuickFilterToolBar(this, gameListProxyModel, gameTypeMap); quickFilterToolBar = new GameSelectorQuickFilterToolBar(this, tabSupervisor, gameListProxyModel, gameTypeMap);
filterButton = new QPushButton; filterButton = new QPushButton;
filterButton->setIcon(QPixmap("theme:icons/search")); filterButton->setIcon(QPixmap("theme:icons/search"));
@ -169,7 +169,7 @@ void GameSelector::actSetFilter()
gameListProxyModel->setGameFilters( gameListProxyModel->setGameFilters(
dlg.getHideBuddiesOnlyGames(), dlg.getHideIgnoredUserGames(), dlg.getHideFullGames(), dlg.getHideBuddiesOnlyGames(), dlg.getHideIgnoredUserGames(), dlg.getHideFullGames(),
dlg.getHideGamesThatStarted(), dlg.getHidePasswordProtectedGames(), dlg.getHideNotBuddyCreatedGames(), dlg.getHideGamesThatStarted(), dlg.getHidePasswordProtectedGames(), dlg.getHideNotBuddyCreatedGames(),
dlg.getHideOpenDecklistGames(), dlg.getGameNameFilter(), dlg.getCreatorNameFilter(), dlg.getGameTypeFilter(), dlg.getHideOpenDecklistGames(), dlg.getGameNameFilter(), dlg.getCreatorNameFilters(), dlg.getGameTypeFilter(),
dlg.getMaxPlayersFilterMin(), dlg.getMaxPlayersFilterMax(), dlg.getMaxGameAge(), dlg.getMaxPlayersFilterMin(), dlg.getMaxPlayersFilterMax(), dlg.getMaxGameAge(),
dlg.getShowOnlyIfSpectatorsCanWatch(), dlg.getShowSpectatorPasswordProtected(), dlg.getShowOnlyIfSpectatorsCanWatch(), dlg.getShowSpectatorPasswordProtected(),
dlg.getShowOnlyIfSpectatorsCanChat(), dlg.getShowOnlyIfSpectatorsCanSeeHands()); dlg.getShowOnlyIfSpectatorsCanChat(), dlg.getShowOnlyIfSpectatorsCanSeeHands());

View file

@ -1,6 +1,7 @@
#include "game_selector_quick_filter_toolbar.h" #include "game_selector_quick_filter_toolbar.h"
#include "games_model.h" #include "games_model.h"
#include "user/user_list_manager.h"
#include <QCheckBox> #include <QCheckBox>
#include <QComboBox> #include <QComboBox>
@ -9,23 +10,32 @@
#include <QLineEdit> #include <QLineEdit>
GameSelectorQuickFilterToolBar::GameSelectorQuickFilterToolBar(QWidget *parent, GameSelectorQuickFilterToolBar::GameSelectorQuickFilterToolBar(QWidget *parent,
TabSupervisor *_tabSupervisor,
GamesProxyModel *_model, GamesProxyModel *_model,
const QMap<int, QString> &allGameTypes) const QMap<int, QString> &allGameTypes)
: QWidget(parent), model(_model) : QWidget(parent), tabSupervisor(_tabSupervisor), model(_model)
{ {
mainLayout = new QHBoxLayout(this); mainLayout = new QHBoxLayout(this);
searchBar = new QLineEdit(this); searchBar = new QLineEdit(this);
searchBar->setText(model->getCreatorNameFilter()); searchBar->setText(model->getCreatorNameFilters().join(", "));
connect(searchBar, &QLineEdit::textChanged, this, connect(searchBar, &QLineEdit::textChanged, this, [this](const QString &text) { model->setGameNameFilter(text); });
[this](const QString &text) { model->setCreatorNameFilter(text); });
hideGamesWithoutBuddiesCheckBox = new QCheckBox(this); hideGamesNotCreatedByBuddiesCheckBox = new QCheckBox(this);
hideGamesWithoutBuddiesCheckBox->setChecked(model->getHideBuddiesOnlyGames()); hideGamesNotCreatedByBuddiesCheckBox->setChecked(model->getHideBuddiesOnlyGames());
hideGamesWithoutBuddiesLabel = new QLabel(this); hideGamesNotCreatedByBuddiesLabel = new QLabel(this);
hideGamesWithoutBuddiesLabel->setBuddy(hideGamesWithoutBuddiesCheckBox); hideGamesNotCreatedByBuddiesLabel->setBuddy(hideGamesNotCreatedByBuddiesCheckBox);
connect(hideGamesWithoutBuddiesCheckBox, &QCheckBox::toggled, this, connect(hideGamesNotCreatedByBuddiesCheckBox, &QCheckBox::toggled, this, [this](bool checked) {
[this](bool checked) { model->setHideBuddiesOnlyGames(checked); }); if (checked) {
QStringList buddyNames;
for (auto buddy : tabSupervisor->getUserListManager()->getBuddyList().values()) {
buddyNames << QString::fromStdString(buddy.name());
}
model->setCreatorNameFilters(buddyNames);
} else {
model->setCreatorNameFilters({});
}
});
hideFullGamesCheckBox = new QCheckBox(this); hideFullGamesCheckBox = new QCheckBox(this);
hideFullGamesCheckBox->setChecked(model->getHideFullGames()); hideFullGamesCheckBox->setChecked(model->getHideFullGames());
@ -76,8 +86,8 @@ GameSelectorQuickFilterToolBar::GameSelectorQuickFilterToolBar(QWidget *parent,
}); });
mainLayout->addWidget(searchBar); mainLayout->addWidget(searchBar);
mainLayout->addWidget(hideGamesWithoutBuddiesLabel); mainLayout->addWidget(hideGamesNotCreatedByBuddiesLabel);
mainLayout->addWidget(hideGamesWithoutBuddiesCheckBox); mainLayout->addWidget(hideGamesNotCreatedByBuddiesCheckBox);
mainLayout->addWidget(hideFullGamesLabel); mainLayout->addWidget(hideFullGamesLabel);
mainLayout->addWidget(hideFullGamesCheckBox); mainLayout->addWidget(hideFullGamesCheckBox);
mainLayout->addWidget(hideStartedGamesLabel); mainLayout->addWidget(hideStartedGamesLabel);
@ -92,8 +102,8 @@ GameSelectorQuickFilterToolBar::GameSelectorQuickFilterToolBar(QWidget *parent,
void GameSelectorQuickFilterToolBar::retranslateUi() void GameSelectorQuickFilterToolBar::retranslateUi()
{ {
searchBar->setPlaceholderText(tr("Filter by creator name...")); searchBar->setPlaceholderText(tr("Filter by game name..."));
hideGamesWithoutBuddiesLabel->setText(tr("Hide buddies only games")); hideGamesNotCreatedByBuddiesLabel->setText(tr("Hide games not created by buddies"));
hideFullGamesLabel->setText(tr("Hide full games")); hideFullGamesLabel->setText(tr("Hide full games"));
hideStartedGamesLabel->setText(tr("Hide started games")); hideStartedGamesLabel->setText(tr("Hide started games"));
filterToFormatLabel->setText(tr("Filter to format")); filterToFormatLabel->setText(tr("Filter to format"));

View file

@ -1,5 +1,7 @@
#ifndef COCKATRICE_GAME_SELECTOR_QUICK_FILTER_TOOLBAR_H #ifndef COCKATRICE_GAME_SELECTOR_QUICK_FILTER_TOOLBAR_H
#define COCKATRICE_GAME_SELECTOR_QUICK_FILTER_TOOLBAR_H #define COCKATRICE_GAME_SELECTOR_QUICK_FILTER_TOOLBAR_H
#include "../tabs/tab_supervisor.h"
#include "games_model.h" #include "games_model.h"
#include <QCheckBox> #include <QCheckBox>
@ -16,18 +18,20 @@ class GameSelectorQuickFilterToolBar : public QWidget
public: public:
explicit GameSelectorQuickFilterToolBar(QWidget *parent, explicit GameSelectorQuickFilterToolBar(QWidget *parent,
TabSupervisor *tabSupervisor,
GamesProxyModel *model, GamesProxyModel *model,
const QMap<int, QString> &allGameTypes); const QMap<int, QString> &allGameTypes);
void retranslateUi(); void retranslateUi();
private: private:
TabSupervisor *tabSupervisor;
GamesProxyModel *model; GamesProxyModel *model;
QHBoxLayout *mainLayout; QHBoxLayout *mainLayout;
QLineEdit *searchBar; QLineEdit *searchBar;
QCheckBox *hideGamesWithoutBuddiesCheckBox; QCheckBox *hideGamesNotCreatedByBuddiesCheckBox;
QLabel *hideGamesWithoutBuddiesLabel; QLabel *hideGamesNotCreatedByBuddiesLabel;
QCheckBox *hideFullGamesCheckBox; QCheckBox *hideFullGamesCheckBox;
QLabel *hideFullGamesLabel; QLabel *hideFullGamesLabel;
QCheckBox *hideStartedGamesCheckBox; QCheckBox *hideStartedGamesCheckBox;

View file

@ -294,7 +294,7 @@ void GamesProxyModel::setGameFilters(bool _hideBuddiesOnlyGames,
bool _hideNotBuddyCreatedGames, bool _hideNotBuddyCreatedGames,
bool _hideOpenDecklistGames, bool _hideOpenDecklistGames,
const QString &_gameNameFilter, const QString &_gameNameFilter,
const QString &_creatorNameFilter, const QStringList &_creatorNameFilters,
const QSet<int> &_gameTypeFilter, const QSet<int> &_gameTypeFilter,
int _maxPlayersFilterMin, int _maxPlayersFilterMin,
int _maxPlayersFilterMax, int _maxPlayersFilterMax,
@ -315,7 +315,7 @@ void GamesProxyModel::setGameFilters(bool _hideBuddiesOnlyGames,
hideNotBuddyCreatedGames = _hideNotBuddyCreatedGames; hideNotBuddyCreatedGames = _hideNotBuddyCreatedGames;
hideOpenDecklistGames = _hideOpenDecklistGames; hideOpenDecklistGames = _hideOpenDecklistGames;
gameNameFilter = _gameNameFilter; gameNameFilter = _gameNameFilter;
creatorNameFilter = _creatorNameFilter; creatorNameFilters = _creatorNameFilters;
gameTypeFilter = _gameTypeFilter; gameTypeFilter = _gameTypeFilter;
maxPlayersFilterMin = _maxPlayersFilterMin; maxPlayersFilterMin = _maxPlayersFilterMin;
maxPlayersFilterMax = _maxPlayersFilterMax; maxPlayersFilterMax = _maxPlayersFilterMax;
@ -348,15 +348,15 @@ int GamesProxyModel::getNumFilteredGames() const
void GamesProxyModel::resetFilterParameters() void GamesProxyModel::resetFilterParameters()
{ {
setGameFilters(false, false, false, false, false, false, false, QString(), QString(), {}, DEFAULT_MAX_PLAYERS_MIN, setGameFilters(false, false, false, false, false, false, false, QString(), QStringList(), {},
DEFAULT_MAX_PLAYERS_MAX, DEFAULT_MAX_GAME_AGE, false, false, false, false); DEFAULT_MAX_PLAYERS_MIN, DEFAULT_MAX_PLAYERS_MAX, DEFAULT_MAX_GAME_AGE, false, false, false, false);
} }
bool GamesProxyModel::areFilterParametersSetToDefaults() const bool GamesProxyModel::areFilterParametersSetToDefaults() const
{ {
return !hideFullGames && !hideGamesThatStarted && !hidePasswordProtectedGames && !hideBuddiesOnlyGames && return !hideFullGames && !hideGamesThatStarted && !hidePasswordProtectedGames && !hideBuddiesOnlyGames &&
!hideOpenDecklistGames && !hideIgnoredUserGames && !hideNotBuddyCreatedGames && gameNameFilter.isEmpty() && !hideOpenDecklistGames && !hideIgnoredUserGames && !hideNotBuddyCreatedGames && gameNameFilter.isEmpty() &&
creatorNameFilter.isEmpty() && gameTypeFilter.isEmpty() && maxPlayersFilterMin == DEFAULT_MAX_PLAYERS_MIN && creatorNameFilters.isEmpty() && gameTypeFilter.isEmpty() && maxPlayersFilterMin == DEFAULT_MAX_PLAYERS_MIN &&
maxPlayersFilterMax == DEFAULT_MAX_PLAYERS_MAX && maxGameAge == DEFAULT_MAX_GAME_AGE && maxPlayersFilterMax == DEFAULT_MAX_PLAYERS_MAX && maxGameAge == DEFAULT_MAX_GAME_AGE &&
!showOnlyIfSpectatorsCanWatch && !showSpectatorPasswordProtected && !showOnlyIfSpectatorsCanChat && !showOnlyIfSpectatorsCanWatch && !showSpectatorPasswordProtected && !showOnlyIfSpectatorsCanChat &&
!showOnlyIfSpectatorsCanSeeHands; !showOnlyIfSpectatorsCanSeeHands;
@ -379,7 +379,7 @@ void GamesProxyModel::loadFilterParameters(const QMap<int, QString> &allGameType
gameFilters.isHideFullGames(), gameFilters.isHideGamesThatStarted(), gameFilters.isHideFullGames(), gameFilters.isHideGamesThatStarted(),
gameFilters.isHidePasswordProtectedGames(), gameFilters.isHideNotBuddyCreatedGames(), gameFilters.isHidePasswordProtectedGames(), gameFilters.isHideNotBuddyCreatedGames(),
gameFilters.isHideOpenDecklistGames(), gameFilters.getGameNameFilter(), gameFilters.isHideOpenDecklistGames(), gameFilters.getGameNameFilter(),
gameFilters.getCreatorNameFilter(), newGameTypeFilter, gameFilters.getMinPlayers(), gameFilters.getCreatorNameFilters(), newGameTypeFilter, gameFilters.getMinPlayers(),
gameFilters.getMaxPlayers(), gameFilters.getMaxGameAge(), gameFilters.getMaxPlayers(), gameFilters.getMaxGameAge(),
gameFilters.isShowOnlyIfSpectatorsCanWatch(), gameFilters.isShowSpectatorPasswordProtected(), gameFilters.isShowOnlyIfSpectatorsCanWatch(), gameFilters.isShowSpectatorPasswordProtected(),
gameFilters.isShowOnlyIfSpectatorsCanChat(), gameFilters.isShowOnlyIfSpectatorsCanSeeHands()); gameFilters.isShowOnlyIfSpectatorsCanChat(), gameFilters.isShowOnlyIfSpectatorsCanSeeHands());
@ -396,7 +396,7 @@ void GamesProxyModel::saveFilterParameters(const QMap<int, QString> &allGameType
gameFilters.setHideNotBuddyCreatedGames(hideNotBuddyCreatedGames); gameFilters.setHideNotBuddyCreatedGames(hideNotBuddyCreatedGames);
gameFilters.setHideOpenDecklistGames(hideOpenDecklistGames); gameFilters.setHideOpenDecklistGames(hideOpenDecklistGames);
gameFilters.setGameNameFilter(gameNameFilter); gameFilters.setGameNameFilter(gameNameFilter);
gameFilters.setCreatorNameFilter(creatorNameFilter); gameFilters.setCreatorNameFilters(creatorNameFilters);
QMapIterator<int, QString> gameTypeIterator(allGameTypes); QMapIterator<int, QString> gameTypeIterator(allGameTypes);
while (gameTypeIterator.hasNext()) { while (gameTypeIterator.hasNext()) {
@ -459,9 +459,18 @@ bool GamesProxyModel::filterAcceptsRow(int sourceRow) const
if (!gameNameFilter.isEmpty()) if (!gameNameFilter.isEmpty())
if (!QString::fromStdString(game.description()).contains(gameNameFilter, Qt::CaseInsensitive)) if (!QString::fromStdString(game.description()).contains(gameNameFilter, Qt::CaseInsensitive))
return false; return false;
if (!creatorNameFilter.isEmpty()) if (!creatorNameFilters.isEmpty()) {
if (!QString::fromStdString(game.creator_info().name()).contains(creatorNameFilter, Qt::CaseInsensitive)) qInfo() << "Creator Name filters: " << creatorNameFilters;
bool found = false;
for (auto createNameFilter : creatorNameFilters) {
if (QString::fromStdString(game.creator_info().name()).contains(createNameFilter, Qt::CaseInsensitive)) {
found = true;
}
}
if (!found) {
return false; return false;
}
}
QSet<int> gameTypes; QSet<int> gameTypes;
for (int i = 0; i < game.game_types_size(); ++i) for (int i = 0; i < game.game_types_size(); ++i)

View file

@ -129,7 +129,8 @@ private:
bool hidePasswordProtectedGames; bool hidePasswordProtectedGames;
bool hideNotBuddyCreatedGames; bool hideNotBuddyCreatedGames;
bool hideOpenDecklistGames; bool hideOpenDecklistGames;
QString gameNameFilter, creatorNameFilter; QString gameNameFilter;
QStringList creatorNameFilters;
QSet<int> gameTypeFilter; QSet<int> gameTypeFilter;
quint32 maxPlayersFilterMin, maxPlayersFilterMax; quint32 maxPlayersFilterMin, maxPlayersFilterMax;
QTime maxGameAge; QTime maxGameAge;
@ -179,9 +180,9 @@ public:
{ {
return gameNameFilter; return gameNameFilter;
} }
QString getCreatorNameFilter() const QStringList getCreatorNameFilters() const
{ {
return creatorNameFilter; return creatorNameFilters;
} }
QSet<int> getGameTypeFilter() const QSet<int> getGameTypeFilter() const
{ {
@ -227,7 +228,7 @@ public:
bool _hideNotBuddyCreatedGames, bool _hideNotBuddyCreatedGames,
bool _hideOpenDecklistGames, bool _hideOpenDecklistGames,
const QString &_gameNameFilter, const QString &_gameNameFilter,
const QString &_creatorNameFilter, const QStringList &_creatorNameFilter,
const QSet<int> &_gameTypeFilter, const QSet<int> &_gameTypeFilter,
int _maxPlayersFilterMin, int _maxPlayersFilterMin,
int _maxPlayersFilterMax, int _maxPlayersFilterMax,
@ -278,9 +279,9 @@ public:
gameNameFilter = value; gameNameFilter = value;
refresh(); refresh();
} }
void setCreatorNameFilter(const QString &value) void setCreatorNameFilters(const QStringList &values)
{ {
creatorNameFilter = value; creatorNameFilters = values;
refresh(); refresh();
} }
void setGameTypeFilter(const QSet<int> &value) void setGameTypeFilter(const QSet<int> &value)

View file

@ -25,7 +25,7 @@ void GameFiltersSettings::setHideBuddiesOnlyGames(bool hide)
bool GameFiltersSettings::isHideBuddiesOnlyGames() bool GameFiltersSettings::isHideBuddiesOnlyGames()
{ {
QVariant previous = getValue("hide_buddies_only_games"); QVariant previous = getValue("hide_buddies_only_games");
return previous == QVariant() || previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setHideFullGames(bool hide) void GameFiltersSettings::setHideFullGames(bool hide)
@ -36,7 +36,7 @@ void GameFiltersSettings::setHideFullGames(bool hide)
bool GameFiltersSettings::isHideFullGames() bool GameFiltersSettings::isHideFullGames()
{ {
QVariant previous = getValue("hide_full_games"); QVariant previous = getValue("hide_full_games");
return !(previous == QVariant()) && previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setHideGamesThatStarted(bool hide) void GameFiltersSettings::setHideGamesThatStarted(bool hide)
@ -47,7 +47,7 @@ void GameFiltersSettings::setHideGamesThatStarted(bool hide)
bool GameFiltersSettings::isHideGamesThatStarted() bool GameFiltersSettings::isHideGamesThatStarted()
{ {
QVariant previous = getValue("hide_games_that_started"); QVariant previous = getValue("hide_games_that_started");
return !(previous == QVariant()) && previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setHidePasswordProtectedGames(bool hide) void GameFiltersSettings::setHidePasswordProtectedGames(bool hide)
@ -58,7 +58,7 @@ void GameFiltersSettings::setHidePasswordProtectedGames(bool hide)
bool GameFiltersSettings::isHidePasswordProtectedGames() bool GameFiltersSettings::isHidePasswordProtectedGames()
{ {
QVariant previous = getValue("hide_password_protected_games"); QVariant previous = getValue("hide_password_protected_games");
return previous == QVariant() || previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setHideIgnoredUserGames(bool hide) void GameFiltersSettings::setHideIgnoredUserGames(bool hide)
@ -69,7 +69,7 @@ void GameFiltersSettings::setHideIgnoredUserGames(bool hide)
bool GameFiltersSettings::isHideIgnoredUserGames() bool GameFiltersSettings::isHideIgnoredUserGames()
{ {
QVariant previous = getValue("hide_ignored_user_games"); QVariant previous = getValue("hide_ignored_user_games");
return !(previous == QVariant()) && previous.toBool(); return previous == QVariant() ? true : previous.toBool();
} }
void GameFiltersSettings::setHideNotBuddyCreatedGames(bool hide) void GameFiltersSettings::setHideNotBuddyCreatedGames(bool hide)
@ -80,7 +80,7 @@ void GameFiltersSettings::setHideNotBuddyCreatedGames(bool hide)
bool GameFiltersSettings::isHideNotBuddyCreatedGames() bool GameFiltersSettings::isHideNotBuddyCreatedGames()
{ {
QVariant previous = getValue("hide_not_buddy_created_games"); QVariant previous = getValue("hide_not_buddy_created_games");
return !(previous == QVariant()) && previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setHideOpenDecklistGames(bool hide) void GameFiltersSettings::setHideOpenDecklistGames(bool hide)
@ -91,7 +91,7 @@ void GameFiltersSettings::setHideOpenDecklistGames(bool hide)
bool GameFiltersSettings::isHideOpenDecklistGames() bool GameFiltersSettings::isHideOpenDecklistGames()
{ {
QVariant previous = getValue("hide_open_decklist_games"); QVariant previous = getValue("hide_open_decklist_games");
return !(previous == QVariant()) && previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setGameNameFilter(QString gameName) void GameFiltersSettings::setGameNameFilter(QString gameName)
@ -104,14 +104,14 @@ QString GameFiltersSettings::getGameNameFilter()
return getValue("game_name_filter").toString(); return getValue("game_name_filter").toString();
} }
void GameFiltersSettings::setCreatorNameFilter(QString creatorName) void GameFiltersSettings::setCreatorNameFilters(QStringList creatorName)
{ {
setValue(creatorName, "creator_name_filter"); setValue(creatorName, "creator_name_filter");
} }
QString GameFiltersSettings::getCreatorNameFilter() QStringList GameFiltersSettings::getCreatorNameFilters()
{ {
return getValue("creator_name_filter").toString(); return getValue("creator_name_filter").toStringList();
} }
void GameFiltersSettings::setMinPlayers(int min) void GameFiltersSettings::setMinPlayers(int min)
@ -182,7 +182,7 @@ void GameFiltersSettings::setShowSpectatorPasswordProtected(bool show)
bool GameFiltersSettings::isShowSpectatorPasswordProtected() bool GameFiltersSettings::isShowSpectatorPasswordProtected()
{ {
QVariant previous = getValue("show_spectator_password_protected"); QVariant previous = getValue("show_spectator_password_protected");
return previous == QVariant() ? true : previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setShowOnlyIfSpectatorsCanChat(bool show) void GameFiltersSettings::setShowOnlyIfSpectatorsCanChat(bool show)
@ -193,7 +193,7 @@ void GameFiltersSettings::setShowOnlyIfSpectatorsCanChat(bool show)
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanChat() bool GameFiltersSettings::isShowOnlyIfSpectatorsCanChat()
{ {
QVariant previous = getValue("show_only_if_spectators_can_chat"); QVariant previous = getValue("show_only_if_spectators_can_chat");
return previous == QVariant() ? true : previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }
void GameFiltersSettings::setShowOnlyIfSpectatorsCanSeeHands(bool show) void GameFiltersSettings::setShowOnlyIfSpectatorsCanSeeHands(bool show)
@ -204,5 +204,5 @@ void GameFiltersSettings::setShowOnlyIfSpectatorsCanSeeHands(bool show)
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanSeeHands() bool GameFiltersSettings::isShowOnlyIfSpectatorsCanSeeHands()
{ {
QVariant previous = getValue("show_only_if_spectators_can_see_hands"); QVariant previous = getValue("show_only_if_spectators_can_see_hands");
return previous == QVariant() ? true : previous.toBool(); return previous == QVariant() ? false : previous.toBool();
} }

View file

@ -24,7 +24,7 @@ public:
bool isHideNotBuddyCreatedGames(); bool isHideNotBuddyCreatedGames();
bool isHideOpenDecklistGames(); bool isHideOpenDecklistGames();
QString getGameNameFilter(); QString getGameNameFilter();
QString getCreatorNameFilter(); QStringList getCreatorNameFilters();
int getMinPlayers(); int getMinPlayers();
int getMaxPlayers(); int getMaxPlayers();
QTime getMaxGameAge(); QTime getMaxGameAge();
@ -42,7 +42,7 @@ public:
void setHidePasswordProtectedGames(bool hide); void setHidePasswordProtectedGames(bool hide);
void setHideNotBuddyCreatedGames(bool hide); void setHideNotBuddyCreatedGames(bool hide);
void setGameNameFilter(QString gameName); void setGameNameFilter(QString gameName);
void setCreatorNameFilter(QString creatorName); void setCreatorNameFilters(QStringList creatorName);
void setMinPlayers(int min); void setMinPlayers(int min);
void setMaxPlayers(int max); void setMaxPlayers(int max);
void setMaxGameAge(const QTime &maxGameAge); void setMaxGameAge(const QTime &maxGameAge);