Cockatrice 2026-06-01-Development-3.1.0-beta.3
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
GamesProxyModel Class Reference

Proxy model for filtering and sorting the GamesModel based on user preferences. More...

#include <games_model.h>

Inheritance diagram for GamesProxyModel:
[legend]
Collaboration diagram for GamesProxyModel:
[legend]

Signals

void filtersChanged ()

Public Member Functions

 GamesProxyModel (QObject *parent=nullptr, const UserListProxy *_userListProxy=nullptr)
 Constructs a GamesProxyModel.
const GameFilterConfigsgetFilters () const
void setGameFilters (const GameFilterConfigs &_filters)
 Sets all game filters at once.
int getNumFilteredGames () const
 Returns the number of games filtered out by the current filter.
void resetFilterParameters ()
 Resets all filter parameters to default values.
bool areFilterParametersSetToDefaults () const
 Returns true if all filter parameters are set to their defaults.
void loadFilterParameters (const QMap< int, QString > &allGameTypes)
 Loads filter parameters from persistent settings.
void saveFilterParameters (const QMap< int, QString > &allGameTypes)
 Saves filter parameters to persistent settings.
void refresh ()
 Refreshes the proxy model (re-applies filters).

Protected Member Functions

bool filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override
bool filterAcceptsRow (int sourceRow) const

Private Attributes

const UserListProxyuserListProxy
GameFilterConfigs filters

Detailed Description

Proxy model for filtering and sorting the GamesModel based on user preferences.

Supports filtering games based on buddies-only, ignored users, password protection, game types, creator, age, player count, and spectator permissions.

Constructor & Destructor Documentation

◆ GamesProxyModel()

GamesProxyModel::GamesProxyModel ( QObject * parent = nullptr,
const UserListProxy * _userListProxy = nullptr )
explicit

Constructs a GamesProxyModel.

Parameters
parentParent QObject.
_userListProxyProxy for accessing ignore/buddy lists.
Here is the call graph for this function:

Member Function Documentation

◆ areFilterParametersSetToDefaults()

bool GamesProxyModel::areFilterParametersSetToDefaults ( ) const
nodiscard

Returns true if all filter parameters are set to their defaults.

◆ filterAcceptsRow() [1/2]

bool GamesProxyModel::filterAcceptsRow ( int sourceRow) const
nodiscardprotected

◆ filterAcceptsRow() [2/2]

bool GamesProxyModel::filterAcceptsRow ( int sourceRow,
const QModelIndex & sourceParent ) const
nodiscardoverrideprotected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ filtersChanged

void GamesProxyModel::filtersChanged ( )
signal
Here is the caller graph for this function:

◆ getFilters()

const GameFilterConfigs & GamesProxyModel::getFilters ( ) const
inlinenodiscard

◆ getNumFilteredGames()

int GamesProxyModel::getNumFilteredGames ( ) const
nodiscard

Returns the number of games filtered out by the current filter.

Here is the call graph for this function:

◆ loadFilterParameters()

void GamesProxyModel::loadFilterParameters ( const QMap< int, QString > & allGameTypes)

Loads filter parameters from persistent settings.

Parameters
allGameTypesMapping of all game types by room ID.
Here is the call graph for this function:

◆ refresh()

void GamesProxyModel::refresh ( )

Refreshes the proxy model (re-applies filters).

◆ resetFilterParameters()

void GamesProxyModel::resetFilterParameters ( )

Resets all filter parameters to default values.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ saveFilterParameters()

void GamesProxyModel::saveFilterParameters ( const QMap< int, QString > & allGameTypes)

Saves filter parameters to persistent settings.

Parameters
allGameTypesMapping of all game types by room ID.
Here is the call graph for this function:

◆ setGameFilters()

void GamesProxyModel::setGameFilters ( const GameFilterConfigs & _filters)

Sets all game filters at once.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ filters

GameFilterConfigs GamesProxyModel::filters
private

◆ userListProxy

const UserListProxy* GamesProxyModel::userListProxy
private

Proxy for checking user ignore/buddy lists.


The documentation for this class was generated from the following files: