Add game filtering for spectator attributes (#4127)

This commit is contained in:
Kaitlin 2020-10-27 15:49:02 -04:00 committed by GitHub
parent 1a94261490
commit a49c4865bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 291 additions and 62 deletions

View file

@ -28,14 +28,25 @@ bool GameFiltersSettings::isShowBuddiesOnlyGames()
return previous == QVariant() ? true : previous.toBool();
}
void GameFiltersSettings::setUnavailableGamesVisible(bool enabled)
void GameFiltersSettings::setShowFullGames(bool show)
{
setValue(enabled, "unavailable_games_visible", "filter_games");
setValue(show, "show_full_games", "filter_games");
}
bool GameFiltersSettings::isUnavailableGamesVisible()
bool GameFiltersSettings::isShowFullGames()
{
QVariant previous = getValue("unavailable_games_visible", "filter_games");
QVariant previous = getValue("show_full_games", "filter_games");
return previous == QVariant() ? false : previous.toBool();
}
void GameFiltersSettings::setShowGamesThatStarted(bool show)
{
setValue(show, "show_games_that_started", "filter_games");
}
bool GameFiltersSettings::isShowGamesThatStarted()
{
QVariant previous = getValue("show_games_that_started", "filter_games");
return previous == QVariant() ? false : previous.toBool();
}
@ -129,3 +140,47 @@ bool GameFiltersSettings::isGameTypeEnabled(QString gametype)
QVariant previous = getValue("game_type/" + hashGameType(gametype), "filter_games");
return previous == QVariant() ? false : previous.toBool();
}
void GameFiltersSettings::setShowOnlyIfSpectatorsCanWatch(bool show)
{
setValue(show, "show_only_if_spectators_can_watch", "filter_games");
}
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanWatch()
{
QVariant previous = getValue("show_only_if_spectators_can_watch", "filter_games");
return previous == QVariant() ? false : previous.toBool();
}
void GameFiltersSettings::setShowSpectatorPasswordProtected(bool show)
{
setValue(show, "show_spectator_password_protected", "filter_games");
}
bool GameFiltersSettings::isShowSpectatorPasswordProtected()
{
QVariant previous = getValue("show_spectator_password_protected", "filter_games");
return previous == QVariant() ? true : previous.toBool();
}
void GameFiltersSettings::setShowOnlyIfSpectatorsCanChat(bool show)
{
setValue(show, "show_only_if_spectators_can_chat", "filter_games");
}
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanChat()
{
QVariant previous = getValue("show_only_if_spectators_can_chat", "filter_games");
return previous == QVariant() ? true : previous.toBool();
}
void GameFiltersSettings::setShowOnlyIfSpectatorsCanSeeHands(bool show)
{
setValue(show, "show_only_if_spectators_can_see_hands", "filter_games");
}
bool GameFiltersSettings::isShowOnlyIfSpectatorsCanSeeHands()
{
QVariant previous = getValue("show_only_if_spectators_can_see_hands", "filter_games");
return previous == QVariant() ? true : previous.toBool();
}

View file

@ -10,7 +10,8 @@ class GameFiltersSettings : public SettingsManager
public:
bool isShowBuddiesOnlyGames();
bool isUnavailableGamesVisible();
bool isShowFullGames();
bool isShowGamesThatStarted();
bool isShowPasswordProtectedGames();
bool isHideIgnoredUserGames();
QString getGameNameFilter();
@ -19,10 +20,15 @@ public:
int getMaxPlayers();
QTime getMaxGameAge();
bool isGameTypeEnabled(QString gametype);
bool isShowOnlyIfSpectatorsCanWatch();
bool isShowSpectatorPasswordProtected();
bool isShowOnlyIfSpectatorsCanChat();
bool isShowOnlyIfSpectatorsCanSeeHands();
void setShowBuddiesOnlyGames(bool show);
void setHideIgnoredUserGames(bool hide);
void setUnavailableGamesVisible(bool enabled);
void setShowFullGames(bool show);
void setShowGamesThatStarted(bool show);
void setShowPasswordProtectedGames(bool show);
void setGameNameFilter(QString gameName);
void setCreatorNameFilter(QString creatorName);
@ -31,6 +37,10 @@ public:
void setMaxGameAge(const QTime &maxGameAge);
void setGameTypeEnabled(QString gametype, bool enabled);
void setGameHashedTypeEnabled(QString gametypeHASHED, bool enabled);
void setShowOnlyIfSpectatorsCanWatch(bool show);
void setShowSpectatorPasswordProtected(bool show);
void setShowOnlyIfSpectatorsCanChat(bool show);
void setShowOnlyIfSpectatorsCanSeeHands(bool show);
signals:
public slots: