Fix #3957: Properly set filters to defaults on initial load and disable "Clear filters" button if filters are set to defaults. (#4088)

* Fix #3957: Properly set filters to defaults on initial load and disable "Clear filters" button if filters are set to defaults

* Reuse resetFilterParameters() in GamesProxyModel constructor, and remove "off" designation for player min/max (as a default of 1/99 is enforced by the UI).
This commit is contained in:
Kaitlin 2020-09-09 11:24:54 -04:00 committed by GitHub
parent ade3e81682
commit 79f590c99a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 11 deletions

View file

@ -76,6 +76,11 @@ private:
QSet<int> gameTypeFilter;
int maxPlayersFilterMin, maxPlayersFilterMax;
static const bool DEFAULT_UNAVAILABLE_GAMES_VISIBLE = false;
static const bool DEFAULT_SHOW_PASSWORD_PROTECTED_GAMES = true;
static const bool DEFAULT_SHOW_BUDDIES_ONLY_GAMES = true;
static const bool DEFAULT_HIDE_IGNORED_USER_GAMES = false;
static const int DEFAULT_MAX_PLAYERS_MIN = 1;
static const int DEFAULT_MAX_PLAYERS_MAX = 99;
public:
@ -127,6 +132,7 @@ public:
void setMaxPlayersFilter(int _maxPlayersFilterMin, int _maxPlayersFilterMax);
int getNumFilteredGames() const;
void resetFilterParameters();
bool areFilterParametersSetToDefaults() const;
void loadFilterParameters(const QMap<int, QString> &allGameTypes);
void saveFilterParameters(const QMap<int, QString> &allGameTypes);
void refresh();