Cockatrice 2026-03-05-Development-2.11.0-beta.54
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
TabArchidekt Class Reference

Tab for browsing, searching, and filtering Archidekt decks. More...

#include <tab_archidekt.h>

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

Public Slots

void doSearch ()
 Trigger a debounced search using the current filters.
void doSearchImmediate ()
 Immediately trigger a search using the current filters.
void loadNextPage ()
 Load the next page of results for infinite scroll.
void processApiJson (QNetworkReply *reply)
 Process a network reply containing JSON data.
void processTopDecksResponse (QJsonObject reply)
 Handle a JSON response containing multiple decks.
void processDeckResponse (QJsonObject reply)
 Handle a JSON response for a single deck.
void prettyPrintJson (const QJsonValue &value, int indentLevel)
 Pretty-print a QJsonValue for debugging.
void actNavigatePage (QString url)
 Navigate to a specified page URL.
void getTopDecks ()
 Fetch top decks from the Archidekt API.

Public Member Functions

 TabArchidekt (TabSupervisor *_tabSupervisor)
 Construct a new TabArchidekt object.
void retranslateUi () override
 Update all UI text to reflect the current language or translation.
QString buildSearchUrl ()
 Construct the search URL from all current filters.
QString getTabText () const override
 Retrieve the tab display text.
CardSizeWidgetgetCardSizeSlider ()
 Get the card size slider widget.
Public Member Functions inherited from Tab
 Tab (TabSupervisor *_tabSupervisor)
const QList< QMenu * > & getTabMenus () const
TabSupervisorgetTabSupervisor () const
bool getContentsChanged () const
void setContentsChanged (bool _contentsChanged)
virtual bool closeRequest ()
virtual void tabActivated ()

Protected Member Functions

bool eventFilter (QObject *obj, QEvent *event) override
 Event filter to catch wheel events for infinite scroll.
Protected Member Functions inherited from Tab
void addTabMenu (QMenu *menu)

Private Member Functions

void initializeUi ()
 Initialize the main UI layout and toolbars.
void setupFilterWidgets ()
 Set up all filter widgets.
void connectSignals ()
 Connect all signals and slots for UI interactions.
void updatePackageModeState (bool isPackageMode)
 Update UI state when package mode is toggled.

Private Attributes

QNetworkAccessManager * networkManager
 Network manager for handling API requests.
QTimer * searchDebounceTimer
 Timer to debounce search requests.
int currentPage
 Current page number for infinite scroll.
bool isLoadingMore
 Flag to prevent multiple simultaneous page loads.
bool isListMode
ArchidektApiResponseDeckListingsDisplayWidgetlistingsWidget = nullptr
QWidget * container
 Root container for the entire tab.
QVBoxLayout * mainLayout
 Outer vertical layout containing toolbars and results.
QWidget * primaryToolbar
 Primary toolbar with most important filters.
QHBoxLayout * primaryToolbarLayout
 Layout for primary toolbar.
QWidget * secondaryToolbar
 Secondary toolbar with advanced filters.
QHBoxLayout * secondaryToolbarLayout
 Layout for secondary toolbar.
QScrollArea * scrollArea
 Scrollable area for results (enables infinite scroll)
QWidget * resultsContainer
 Container widget inside scroll area.
QVBoxLayout * resultsLayout
 Layout for results (decks appended here)
QLabel * sortByLabel
 Label for sort controls.
QComboBox * orderByCombo
 Dropdown for selecting the sort field.
QPushButton * orderDirButton
 Toggle button for ascending/descending sort.
QLabel * filterByLabel
 Label for filter controls.
QList< ManaSymbolWidget * > colorSymbols
 Mana symbol toggle buttons.
QSet< QChar > activeColors
 Set of currently active mana colors.
QCheckBox * logicalAndCheck
 Require ALL selected colors instead of ANY.
QLineEdit * nameField
 Input for deck name filter.
QLineEdit * ownerField
 Input for owner name filter.
QCheckBox * packagesCheck
 Toggle for searching card packages instead of full decks.
QPushButton * searchButton
 Button to trigger search.
QPushButton * advancedFiltersButton
 Button to show/hide advanced filters.
SettingsButtonWidgetsettingsButton
 Container for card size settings.
CardSizeWidgetcardSizeSlider
 Slider to adjust card size in results.
QLineEdit * cardsField
 Input for cards included in the deck.
QLineEdit * commandersField
 Input for commander cards.
QLineEdit * deckTagNameField
 Input for deck tag filtering.
SettingsButtonWidgetformatButton
 Collapsible button for format filters.
QVector< QCheckBox * > formatChecks
 Individual checkboxes for each format.
QComboBox * edhBracketCombo
 Dropdown for EDH bracket selection.
SettingsButtonWidgetdeckSizeButton
 Collapsible button for deck size filter.
QSpinBox * minDeckSizeSpin
 Spinner to select minimum deck size.
QComboBox * minDeckSizeLogicCombo
 Combo box for size comparison logic.
CardInfoPtr cardToQuery
 Optional pre-selected card for initial filtering.

Additional Inherited Members

Signals inherited from Tab
void userEvent (bool globalEvent=true)
void tabTextChanged (Tab *tab, const QString &newTabText)
Protected Slots inherited from Tab
void showCardInfoPopup (const QPoint &pos, const CardRef &cardRef)
void deleteCardInfoPopup (const QString &cardName)
Protected Attributes inherited from Tab
TabSupervisortabSupervisor

Detailed Description

Tab for browsing, searching, and filtering Archidekt decks.

This class provides a comprehensive interface for querying decks from the Archidekt API. Users can filter decks by name, owner, included cards, commanders, deck tags, colors, EDH bracket, and formats. It supports infinite scroll pagination for seamless browsing.

Constructor & Destructor Documentation

◆ TabArchidekt()

TabArchidekt::TabArchidekt ( TabSupervisor * _tabSupervisor)
explicit

Construct a new TabArchidekt object.

Parameters
_tabSupervisorParent tab supervisor responsible for tab management and callbacks

Initializes the network manager, creates all UI components, sets up layouts, connects signals and slots, and triggers an initial fetch of top decks.

Here is the call graph for this function:

Member Function Documentation

◆ actNavigatePage

void TabArchidekt::actNavigatePage ( QString url)
slot

Navigate to a specified page URL.

Parameters
urlThe URL to request

Typically called when a deck card is clicked in the listing.

Here is the caller graph for this function:

◆ buildSearchUrl()

QString TabArchidekt::buildSearchUrl ( )

Construct the search URL from all current filters.

Returns
QString Fully constructed URL including all query parameters

The search URL is dynamically built using the state of all filter widgets. Parameters included:

  • Deck name
  • Owner
  • Included cards
  • Commander cards
  • Deck tag
  • Colors and logical AND requirement
  • Formats
  • EDH bracket
  • Packages toggle
  • Sorting field and direction
  • Minimum amount of cards in the deck
  • Current page (for infinite scroll)
Here is the caller graph for this function:

◆ connectSignals()

void TabArchidekt::connectSignals ( )
private

Connect all signals and slots for UI interactions.

Links all widget signals to their appropriate handlers, including search triggers, filter changes, package mode toggling, and infinite scroll.

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

◆ doSearch

void TabArchidekt::doSearch ( )
slot

Trigger a debounced search using the current filters.

Resets to page 1 and starts the debounce timer. The actual search will execute after 300ms of inactivity.

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

◆ doSearchImmediate

void TabArchidekt::doSearchImmediate ( )
slot

Immediately trigger a search using the current filters.

Sends a network request to the Archidekt API using the URL generated by buildSearchUrl(). Updates the results display asynchronously.

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

◆ eventFilter()

bool TabArchidekt::eventFilter ( QObject * obj,
QEvent * event )
overrideprotected

Event filter to catch wheel events for infinite scroll.

Parameters
objThe object that received the event
eventThe event to filter
Returns
bool Whether the event was handled
Here is the call graph for this function:

◆ getCardSizeSlider()

CardSizeWidget * TabArchidekt::getCardSizeSlider ( )
inline

Get the card size slider widget.

Returns
CardSizeWidget* Pointer to the card size adjustment slider

Allows external code to read or manipulate the current card size or hook up the sliders signals.

◆ getTabText()

QString TabArchidekt::getTabText ( ) const
inlineoverridevirtual

Retrieve the tab display text.

Returns
QString Human-readable title for the tab

If a card is pre-selected (cardToQuery), its name is appended to the tab title.

Implements Tab.

◆ getTopDecks

void TabArchidekt::getTopDecks ( )
slot

Fetch top decks from the Archidekt API.

Called on initialization to populate the initial results display.

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

◆ initializeUi()

void TabArchidekt::initializeUi ( )
private

Initialize the main UI layout and toolbars.

Creates the container, main layout, primary toolbar (sort, colors, name, owner, packages), secondary toolbar (advanced filters), and scrollable results area.

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

◆ loadNextPage

void TabArchidekt::loadNextPage ( )
slot

Load the next page of results for infinite scroll.

Increments the current page and fetches additional results, which are appended to the existing results display.

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

◆ prettyPrintJson

void TabArchidekt::prettyPrintJson ( const QJsonValue & value,
int indentLevel )
slot

Pretty-print a QJsonValue for debugging.

Parameters
valueThe JSON value to print
indentLevelThe indentation depth (number of levels)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processApiJson

void TabArchidekt::processApiJson ( QNetworkReply * reply)
slot

Process a network reply containing JSON data.

Parameters
replyQNetworkReply object with the API response

Determines whether the response corresponds to a deck listing or a single deck, and dispatches it to the appropriate handler.

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

◆ processDeckResponse

void TabArchidekt::processDeckResponse ( QJsonObject reply)
slot

Handle a JSON response for a single deck.

Parameters
replyQJsonObject containing deck data

Clears the results area and displays the single deck details.

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

◆ processTopDecksResponse

void TabArchidekt::processTopDecksResponse ( QJsonObject reply)
slot

Handle a JSON response containing multiple decks.

Parameters
replyQJsonObject containing deck listings

If this is page 1, clears previous results. Appends new results to the display.

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

◆ retranslateUi()

void TabArchidekt::retranslateUi ( )
overridevirtual

Update all UI text to reflect the current language or translation.

This function re-applies translations to all labels, buttons, and placeholders. It should be called after a language change.

Implements Tab.

Here is the caller graph for this function:

◆ setupFilterWidgets()

void TabArchidekt::setupFilterWidgets ( )
private

Set up all filter widgets.

Creates filter widgets for:

  • Card search with autocomplete
  • Commander search with autocomplete
  • Deck tags
  • Format selection (collapsible)
  • Deck size filter (collapsible)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updatePackageModeState()

void TabArchidekt::updatePackageModeState ( bool isPackageMode)
private

Update UI state when package mode is toggled.

Parameters
isPackageModeWhether package mode is currently enabled

Disables format-specific and commander-specific filters when searching for card packages instead of full decks.

Here is the caller graph for this function:

Member Data Documentation

◆ activeColors

QSet<QChar> TabArchidekt::activeColors
private

Set of currently active mana colors.

◆ advancedFiltersButton

QPushButton* TabArchidekt::advancedFiltersButton
private

Button to show/hide advanced filters.

◆ cardsField

QLineEdit* TabArchidekt::cardsField
private

Input for cards included in the deck.

◆ cardSizeSlider

CardSizeWidget* TabArchidekt::cardSizeSlider
private

Slider to adjust card size in results.

◆ cardToQuery

CardInfoPtr TabArchidekt::cardToQuery
private

Optional pre-selected card for initial filtering.

◆ colorSymbols

QList<ManaSymbolWidget *> TabArchidekt::colorSymbols
private

Mana symbol toggle buttons.

◆ commandersField

QLineEdit* TabArchidekt::commandersField
private

Input for commander cards.

◆ container

QWidget* TabArchidekt::container
private

Root container for the entire tab.

◆ currentPage

int TabArchidekt::currentPage
private

Current page number for infinite scroll.

◆ deckSizeButton

SettingsButtonWidget* TabArchidekt::deckSizeButton
private

Collapsible button for deck size filter.

◆ deckTagNameField

QLineEdit* TabArchidekt::deckTagNameField
private

Input for deck tag filtering.

◆ edhBracketCombo

QComboBox* TabArchidekt::edhBracketCombo
private

Dropdown for EDH bracket selection.

◆ filterByLabel

QLabel* TabArchidekt::filterByLabel
private

Label for filter controls.

◆ formatButton

SettingsButtonWidget* TabArchidekt::formatButton
private

Collapsible button for format filters.

◆ formatChecks

QVector<QCheckBox *> TabArchidekt::formatChecks
private

Individual checkboxes for each format.

◆ isListMode

bool TabArchidekt::isListMode
private

◆ isLoadingMore

bool TabArchidekt::isLoadingMore
private

Flag to prevent multiple simultaneous page loads.

◆ listingsWidget

ArchidektApiResponseDeckListingsDisplayWidget* TabArchidekt::listingsWidget = nullptr
private

◆ logicalAndCheck

QCheckBox* TabArchidekt::logicalAndCheck
private

Require ALL selected colors instead of ANY.

◆ mainLayout

QVBoxLayout* TabArchidekt::mainLayout
private

Outer vertical layout containing toolbars and results.

◆ minDeckSizeLogicCombo

QComboBox* TabArchidekt::minDeckSizeLogicCombo
private

Combo box for size comparison logic.

◆ minDeckSizeSpin

QSpinBox* TabArchidekt::minDeckSizeSpin
private

Spinner to select minimum deck size.

◆ nameField

QLineEdit* TabArchidekt::nameField
private

Input for deck name filter.

◆ networkManager

QNetworkAccessManager* TabArchidekt::networkManager
private

Network manager for handling API requests.

◆ orderByCombo

QComboBox* TabArchidekt::orderByCombo
private

Dropdown for selecting the sort field.

◆ orderDirButton

QPushButton* TabArchidekt::orderDirButton
private

Toggle button for ascending/descending sort.

◆ ownerField

QLineEdit* TabArchidekt::ownerField
private

Input for owner name filter.

◆ packagesCheck

QCheckBox* TabArchidekt::packagesCheck
private

Toggle for searching card packages instead of full decks.

◆ primaryToolbar

QWidget* TabArchidekt::primaryToolbar
private

Primary toolbar with most important filters.

◆ primaryToolbarLayout

QHBoxLayout* TabArchidekt::primaryToolbarLayout
private

Layout for primary toolbar.

◆ resultsContainer

QWidget* TabArchidekt::resultsContainer
private

Container widget inside scroll area.

◆ resultsLayout

QVBoxLayout* TabArchidekt::resultsLayout
private

Layout for results (decks appended here)

◆ scrollArea

QScrollArea* TabArchidekt::scrollArea
private

Scrollable area for results (enables infinite scroll)

◆ searchButton

QPushButton* TabArchidekt::searchButton
private

Button to trigger search.

◆ searchDebounceTimer

QTimer* TabArchidekt::searchDebounceTimer
private

Timer to debounce search requests.

◆ secondaryToolbar

QWidget* TabArchidekt::secondaryToolbar
private

Secondary toolbar with advanced filters.

◆ secondaryToolbarLayout

QHBoxLayout* TabArchidekt::secondaryToolbarLayout
private

Layout for secondary toolbar.

◆ settingsButton

SettingsButtonWidget* TabArchidekt::settingsButton
private

Container for card size settings.

◆ sortByLabel

QLabel* TabArchidekt::sortByLabel
private

Label for sort controls.


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