Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
RemotePublicDecksModel Class Reference

Flat, read-only list of the public decks published by another user. More...

#include <remote_public_decks_model.h>

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

Classes

struct  DeckEntry

Public Types

using FilterMode = VisualDeckStorageSortFilterProxyModel::FilterMode
 The color identity filter mode, shared with the Visual Deck Storage.

Signals

void loadingChanged (bool loading)
 Emitted when a refresh starts, completes, or fails (see loading()).
void loadFailed (const QString &message)
 Emitted when the last refresh failed; contains a user-facing message.

Public Member Functions

 RemotePublicDecksModel (AbstractClient *client, QObject *parent=nullptr)
int rowCount (const QModelIndex &parent=QModelIndex()) const override
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
void refresh (const QString &userName)
 Fetches the public decks of another user, replacing the current contents.
void clear ()
void setSearchText (const QString &text)
 Sets a case-insensitive substring filter on the deck name.
void setColorFilter (FilterMode mode, const QSet< QChar > &colors)
 Sets the active color identity filter and mode.
void setTagFilter (const QSet< QString > &selected, const QSet< QString > &excluded)
 Filters decks by required (selected) and forbidden (excluded) tags.
QSet< QString > allTags () const
 All tags present across all loaded decks, for building filter chips.
int filteredCount () const
 The number of decks after filtering.
int totalCount () const
 The number of decks before filtering.
bool isLoading () const
 True while a refresh request is in flight and the grid has no data yet.
DeckEntry entryAt (int row) const

Private Slots

void decksReceived (const Response &response, const CommandContainer &commandContainer)
void onLoadingTimeout ()

Private Member Functions

void addFolder (const ServerInfo_DeckStorage_Folder &folder)
void addTreeItem (const ServerInfo_DeckStorage_TreeItem &item)
void rebuildVisibleIndices ()
void setLoading (bool value)

Private Attributes

AbstractClient * client
QTimer * loadingTimeoutTimer
QList< DeckEntry > decks
QList< int > visibleIndices
 Row indices into decks that pass the current filters.
bool loading = false
int requestSequence = 0
 Monotonically increases per refresh; only the newest request may update the grid.
QString searchText
VisualDeckStorageSortFilterProxyModel::FilterMode colorFilterMode = VisualDeckStorageSortFilterProxyModel::Includes
QSet< QChar > activeColors
QSet< QString > includedTags
QSet< QString > excludedTags

Detailed Description

Flat, read-only list of the public decks published by another user.

Fetches the target user's public decks via Command_DeckListOtherUser and flattens the response tree into entries carrying the preview metadata stored on the server (banner card name/provider and color identity). No deck list is downloaded until the user actually opens a deck.

Name and color-identity filtering is applied against this metadata, mirroring the Visual Deck Storage's filter semantics, so the grid can be narrowed like the local deck storage.

Member Typedef Documentation

◆ FilterMode

The color identity filter mode, shared with the Visual Deck Storage.

Constructor & Destructor Documentation

◆ RemotePublicDecksModel()

RemotePublicDecksModel::RemotePublicDecksModel ( AbstractClient * client,
QObject * parent = nullptr )
explicit
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ addFolder()

void RemotePublicDecksModel::addFolder ( const ServerInfo_DeckStorage_Folder & folder)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addTreeItem()

void RemotePublicDecksModel::addTreeItem ( const ServerInfo_DeckStorage_TreeItem & item)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ allTags()

QSet< QString > RemotePublicDecksModel::allTags ( ) const
nodiscard

All tags present across all loaded decks, for building filter chips.

Here is the caller graph for this function:

◆ clear()

void RemotePublicDecksModel::clear ( )
Here is the call graph for this function:

◆ data()

QVariant RemotePublicDecksModel::data ( const QModelIndex & index,
int role = Qt::DisplayRole ) const
nodiscardoverride

◆ decksReceived

void RemotePublicDecksModel::decksReceived ( const Response & response,
const CommandContainer & commandContainer )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ entryAt()

RemotePublicDecksModel::DeckEntry RemotePublicDecksModel::entryAt ( int row) const
nodiscard
Here is the caller graph for this function:

◆ filteredCount()

int RemotePublicDecksModel::filteredCount ( ) const
inlinenodiscard

The number of decks after filtering.

◆ isLoading()

bool RemotePublicDecksModel::isLoading ( ) const
inlinenodiscard

True while a refresh request is in flight and the grid has no data yet.

Here is the caller graph for this function:

◆ loadFailed

void RemotePublicDecksModel::loadFailed ( const QString & message)
signal

Emitted when the last refresh failed; contains a user-facing message.

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

◆ loadingChanged

void RemotePublicDecksModel::loadingChanged ( bool loading)
signal

Emitted when a refresh starts, completes, or fails (see loading()).

Here is the caller graph for this function:

◆ onLoadingTimeout

void RemotePublicDecksModel::onLoadingTimeout ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rebuildVisibleIndices()

void RemotePublicDecksModel::rebuildVisibleIndices ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ refresh()

void RemotePublicDecksModel::refresh ( const QString & userName)

Fetches the public decks of another user, replacing the current contents.

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

◆ rowCount()

int RemotePublicDecksModel::rowCount ( const QModelIndex & parent = QModelIndex()) const
nodiscardoverride
Here is the caller graph for this function:

◆ setColorFilter()

void RemotePublicDecksModel::setColorFilter ( VisualDeckStorageSortFilterProxyModel::FilterMode mode,
const QSet< QChar > & colors )

Sets the active color identity filter and mode.

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

◆ setLoading()

void RemotePublicDecksModel::setLoading ( bool value)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSearchText()

void RemotePublicDecksModel::setSearchText ( const QString & text)

Sets a case-insensitive substring filter on the deck name.

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

◆ setTagFilter()

void RemotePublicDecksModel::setTagFilter ( const QSet< QString > & selected,
const QSet< QString > & excluded )

Filters decks by required (selected) and forbidden (excluded) tags.

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

◆ totalCount()

int RemotePublicDecksModel::totalCount ( ) const
inlinenodiscard

The number of decks before filtering.

Here is the caller graph for this function:

Member Data Documentation

◆ activeColors

QSet<QChar> RemotePublicDecksModel::activeColors
private

◆ client

AbstractClient* RemotePublicDecksModel::client
private

◆ colorFilterMode

◆ decks

QList<DeckEntry> RemotePublicDecksModel::decks
private

◆ excludedTags

QSet<QString> RemotePublicDecksModel::excludedTags
private

◆ includedTags

QSet<QString> RemotePublicDecksModel::includedTags
private

◆ loading

bool RemotePublicDecksModel::loading = false
private

◆ loadingTimeoutTimer

QTimer* RemotePublicDecksModel::loadingTimeoutTimer
private

◆ requestSequence

int RemotePublicDecksModel::requestSequence = 0
private

Monotonically increases per refresh; only the newest request may update the grid.

◆ searchText

QString RemotePublicDecksModel::searchText
private

◆ visibleIndices

QList<int> RemotePublicDecksModel::visibleIndices
private

Row indices into decks that pass the current filters.


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