Hide games created/hosted by people on your Ignore List (#3883)

* Implement filter for games created by ignored users.
This commit is contained in:
Phillip Wheatley 2020-01-13 15:13:36 +00:00 committed by Zach H
parent 7bfefee073
commit 0f18fa9546
9 changed files with 99 additions and 4 deletions

View file

@ -3,6 +3,7 @@
#include "gametypemap.h"
#include "pb/serverinfo_game.pb.h"
#include "tab_supervisor.h"
#include <QAbstractTableModel>
#include <QList>
#include <QSet>
@ -65,7 +66,9 @@ class GamesProxyModel : public QSortFilterProxyModel
Q_OBJECT
private:
bool ownUserIsRegistered;
const TabSupervisor *tabSupervisor;
bool showBuddiesOnlyGames;
bool hideIgnoredUserGames;
bool unavailableGamesVisible;
bool showPasswordProtectedGames;
QString gameNameFilter, creatorNameFilter;
@ -75,13 +78,18 @@ private:
static const int DEFAULT_MAX_PLAYERS_MAX = 99;
public:
GamesProxyModel(QObject *parent = nullptr, bool _ownUserIsRegistered = false);
GamesProxyModel(QObject *parent = nullptr, const TabSupervisor *_tabSupervisor = nullptr);
bool getShowBuddiesOnlyGames() const
{
return showBuddiesOnlyGames;
}
void setShowBuddiesOnlyGames(bool _showBuddiesOnlyGames);
bool getHideIgnoredUserGames() const
{
return hideIgnoredUserGames;
}
void setHideIgnoredUserGames(bool _hideIgnoredUserGames);
bool getUnavailableGamesVisible() const
{
return unavailableGamesVisible;
@ -119,6 +127,7 @@ public:
void resetFilterParameters();
void loadFilterParameters(const QMap<int, QString> &allGameTypes);
void saveFilterParameters(const QMap<int, QString> &allGameTypes);
void refresh();
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;