Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
PrintingSelectorCardSortingWidget Class Reference

#include <printing_selector_card_sorting_widget.h>

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

Public Slots

void updateSortOrder ()
 Updates the sorting order (ascending or descending).
void updateSortSetting ()
 Updates the sorting setting in the application settings.

Public Member Functions

 PrintingSelectorCardSortingWidget (PrintingSelector *parent)
 A widget for sorting and filtering card sets in the Printing Selector.
QList< PrintingInfosortSets (const SetToPrintingsMap &setMap)
 Sorts a list of card sets based on the selected sorting option.
QList< PrintingInfofilterSets (const QList< PrintingInfo > &printings, const QString &searchText)
 Filters a list of card sets based on the search text.
QList< PrintingInfoprependPinnedPrintings (const QList< PrintingInfo > &printings, const QString &cardName)
QList< PrintingInfoprependPrintingsInDeck (const QList< PrintingInfo > &printings, const CardInfoPtr &selectedCard, DeckListModel *deckModel)
 Prepend card printings that are contained in the deck to the list of printings.

Private Attributes

PrintingSelectorparent
QHBoxLayout * sortToolBar
QComboBox * sortOptionsSelector
bool descendingSort
QPushButton * toggleSortOrder

Static Private Attributes

static const QString SORT_OPTIONS_ALPHABETICAL = tr("Alphabetical")
static const QString SORT_OPTIONS_PREFERENCE = tr("Preference")
static const QString SORT_OPTIONS_RELEASE_DATE = tr("Release Date")
static const QString SORT_OPTIONS_CONTAINED_IN_DECK
static const QString SORT_OPTIONS_POTENTIAL_CARDS
static const QStringList SORT_OPTIONS

Constructor & Destructor Documentation

◆ PrintingSelectorCardSortingWidget()

PrintingSelectorCardSortingWidget::PrintingSelectorCardSortingWidget ( PrintingSelector * parent)
explicit

A widget for sorting and filtering card sets in the Printing Selector.

This widget allows users to choose sorting options for the card sets, such as alphabetical order, release date, or user-defined preferences. It also allows users to toggle the sorting order between ascending and descending.

Here is the call graph for this function:

Member Function Documentation

◆ filterSets()

QList< PrintingInfo > PrintingSelectorCardSortingWidget::filterSets ( const QList< PrintingInfo > & printings,
const QString & searchText )

Filters a list of card sets based on the search text.

This function filters the given list of card sets by comparing their long and short names with the provided search text. If the search text matches either the long or short name of a card set, that set is included in the filtered list.

Parameters
printingsThe list of printings to be filtered.
searchTextThe search text used to filter the card sets.
Returns
A filtered list of card sets.

◆ prependPinnedPrintings()

QList< PrintingInfo > PrintingSelectorCardSortingWidget::prependPinnedPrintings ( const QList< PrintingInfo > & printings,
const QString & cardName )
Here is the call graph for this function:

◆ prependPrintingsInDeck()

QList< PrintingInfo > PrintingSelectorCardSortingWidget::prependPrintingsInDeck ( const QList< PrintingInfo > & printings,
const CardInfoPtr & selectedCard,
DeckListModel * deckModel )

Prepend card printings that are contained in the deck to the list of printings.

This function adjusts the list of printings by moving the printings that are already contained in the deck to the beginning of the list, sorted by the count of cards in the deck.

Parameters
printingsThe original list of printings.
selectedCardThe currently selected card.
deckModelThe model representing the deck.
Returns
A list of printings with the printings contained in the deck prepended.
Here is the call graph for this function:

◆ sortSets()

QList< PrintingInfo > PrintingSelectorCardSortingWidget::sortSets ( const SetToPrintingsMap & setMap)

Sorts a list of card sets based on the selected sorting option.

This function sorts the card sets according to the selected sorting option in the combobox. The options include:

  • Alphabetical
  • Preference
  • Release Date
  • Contained in Deck
  • Potential Cards in Deck
Parameters
setMapThe list of card sets to be sorted.
Returns
A sorted list of printings.
Here is the call graph for this function:

◆ updateSortOrder

void PrintingSelectorCardSortingWidget::updateSortOrder ( )
slot

Updates the sorting order (ascending or descending).

This function toggles the sort order between ascending and descending and updates the display.

Here is the caller graph for this function:

◆ updateSortSetting

void PrintingSelectorCardSortingWidget::updateSortSetting ( )
slot

Updates the sorting setting in the application settings.

This function saves the selected sorting option (from the combobox) to the application settings.

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

Member Data Documentation

◆ descendingSort

bool PrintingSelectorCardSortingWidget::descendingSort
private

◆ parent

PrintingSelector* PrintingSelectorCardSortingWidget::parent
private

◆ SORT_OPTIONS

const QStringList PrintingSelectorCardSortingWidget::SORT_OPTIONS
staticprivate
Initial value:
static const QString SORT_OPTIONS_ALPHABETICAL
Definition printing_selector_card_sorting_widget.h:35
static const QString SORT_OPTIONS_RELEASE_DATE
Definition printing_selector_card_sorting_widget.h:37
static const QString SORT_OPTIONS_PREFERENCE
Definition printing_selector_card_sorting_widget.h:36

◆ SORT_OPTIONS_ALPHABETICAL

const QString PrintingSelectorCardSortingWidget::SORT_OPTIONS_ALPHABETICAL = tr("Alphabetical")
staticprivate

◆ SORT_OPTIONS_CONTAINED_IN_DECK

const QString PrintingSelectorCardSortingWidget::SORT_OPTIONS_CONTAINED_IN_DECK
staticprivate

◆ SORT_OPTIONS_POTENTIAL_CARDS

const QString PrintingSelectorCardSortingWidget::SORT_OPTIONS_POTENTIAL_CARDS
staticprivate

◆ SORT_OPTIONS_PREFERENCE

const QString PrintingSelectorCardSortingWidget::SORT_OPTIONS_PREFERENCE = tr("Preference")
staticprivate

◆ SORT_OPTIONS_RELEASE_DATE

const QString PrintingSelectorCardSortingWidget::SORT_OPTIONS_RELEASE_DATE = tr("Release Date")
staticprivate

◆ sortOptionsSelector

QComboBox* PrintingSelectorCardSortingWidget::sortOptionsSelector
private

◆ sortToolBar

QHBoxLayout* PrintingSelectorCardSortingWidget::sortToolBar
private

◆ toggleSortOrder

QPushButton* PrintingSelectorCardSortingWidget::toggleSortOrder
private

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